texts: Why Ether balance is 0 after 5 airdrops?

texts:
I created an ether wallet to join some airdrops and 5 of this airdrops sent me tokens but in my ether wallet the balance is 0 (zero). I don't understand why.
I was searching tutorials but I could not find any answer.

If I check here: https://ethplorer.io/address/0x1be0b8c0e389ad74b0b36cb91e89bfcab874c128 I can see the 5 transfers to my eth wallet with 0 balance.


texts: SMT Checker : Unexpected " BMC: Insufficient funds happens here"

texts:
I was using the SMT Solidity Model Checker, and I Don't understand why I have a :" BMC: Insufficient funds happens here". My code is quite simple, I just wanted to check if the Model Checker analyses well reentrancy. Does anyone know if the checker model actually has a problem, or is it the code that is vulnerable? Thanks in advance for your answers
pragma solidity >=0.8.0;
contract Reentrancy {
uint public balance;

function withdraw(uint amount) public payable {
    require (balance > amount);
    balance -= amount;
    payable(msg.sender).transfer(amount);
}

}


texts:
When I store data in the oracle and then try and refer to it on the testrpc through the pay function it just doesn't work.  Any ideas?

pragma solidity ^0.4.6;

contract Oracle{
    struct DocumentStruct{
        uint value;
    }

    mapping(bytes32 => DocumentStruct) public documentStructs;

    function StoreDocument(bytes32 key, uint value) returns (bool success) {
        documentStructs[key].value = value;
        return true;
    }

}

contract Payment {
    address public counterparty1;
    address public counterparty2;
    uint public margin;
    address public oracleID;

    function Payment(address _cp2, address _oracleID) payable{
        margin = msg.value;
        counterparty1 = msg.sender;
        counterparty2 = _cp2;
        oracleID = _oracleID;
    }

    function Pay(bytes32 _keyval) returns (bool){
        var pValue = RetrieveData(_keyval);
        var npvalue = pValue >= margin ? (this.balance) : pValue;
        if (npvalue > 0 ){
            counterparty2.send(npvalue);
            return true;
        }
        else{
            throw;
        }
    }

    struct DocumentStruct{
        uint value;
    }
    Oracle oracle;

    function RetrieveData(bytes32 key)
    public
    constant
    returns(uint)
    {
        oracle = Oracle(oracleID);
        DocumentStruct memory doc;
        (doc.value) = oracle.documentStructs(key);
        return doc.value;
    }
}


texts: I need to generate a uint256 random number offchain (in a Node.js client). Since BN doesn't have a random() function, what's the best way to do so?


texts: Solidity, how to cast SmartContract type to address

texts:
I am currently a bit stuck with my contract, the issue is following:
I define a smartcontract type which is used for another address (aka address is smartcontract that provides the specified interface)
The question is whether there is a possibility to make address type checks or cast said contract interface object to address, since that what it's essentially. While I know that in terms of storage those are bytes that represent address, I just can't seem to figure out how to get from interface type back to bare address type and make proper checks against it.
I searched around for quite a bit, but couldn't find any samples how to accomplish this on the web or in the solidity docs.

See example bellow:

pragma solidity ^0.5.1;

contract SampleInterface {
    function foo(uint256 someValue) external returns (uint256);
}

library SampleLibrary {
    enum SampleType {
        FIRST,
        SECOND
    }
}

contract SampleInterfaceManager {
    mapping(uint => SampleInterface[]) public interfacesByType;

    function processFoo(uint256 someValue, SampleLibrary.SampleType sampleType) external returns (uint256) {
        SampleInterface[] storage sampleInterfaces = interfacesByType[uint(sampleType)];
        uint temp = someValue;
        for (uint i = 0; i < sampleInterfaces.length; i++) {
            SampleInterface sampleInterface = sampleInterfaces[i];

            //How to make this check work?

            if (sampleInterface != address(0)) {
                temp = sampleInterface.foo(temp);
            }
        }
        return temp;
    }
}

This code currently creates compilation error:

smartcontracts/Sample.sol:23:17: Error: Operator != not compatible with types contract SampleInterface and address payable
            if (sampleInterface != address(0)) {
                ^---------------------------^

Any advice on how to solve this is most welcome. I can try and do without this check but would rather hope to avoid this scenario.


texts: Safe to assume that Ethereum transactions are as fast as a client-server architecure and SQL database?

texts:
I come from the typical client-server architecture world. A website / mobile app makes a POST request to create a resource, and generally it's safe to assume that the response will arrive within 0-3 seconds and the user can move on with his life.

Can I assume the same for Ethereum? If I create a transaction, can I assume that it will be mined/verified within 0-3 seconds?

To put this into context, I'm trying to create an app that will turn on the TV using blockchain. So when the user presses a button on the app, it creates a transaction which needs to be mined. Will the delay be significant or basically soft-realtime? I don't want them to wait minutes until the TV is turned on.

With the scaling issues Ethereum seems to have, I feel like it's only useful for event logging or something that isn't time sensitive. Like if I were to make Google Analytics on Blockchain, I could use blockchain for nonblocking event logging in the background


texts:
Just want to make sure I can fully recover a geth wallet. There are many parts to a typical wallet file:

{"address":"ethaddress",
"Crypto":{"cipher":"..aes","ciphertext...

So basically theres the :

address,
the ciphertext
the parameters
kdf & kdfparameters
mac address
and id.
version

What of that do I need to fully restore a wallet? All of it or are parts of it sufficient?


texts: What are the reasons to use ERC-1155 instead of multiple ERC-20 contracts?

texts:
The ERC-1155 standard allows for multiple semi-fungible tokens.
If I understand correctly, this would be no different than creating multiple ERC-20 contracts, with the same token quantities, to represent the digital goods. The only benefit is having everything in the same place.
Are there other reasons to use ERC-1155 instead of multiple ERC-20 contracts?


texts: I am using the Ropsten testnet but it is stuck syncing only one block at a time around block 589000. How should i approach this? Just let it keep syncing? delete the whole blockchain and redownload it? or do I have to change to the Kovan testnet? I am looking for a Geth solution to the problem, not parity


texts: TypeError: web3.eth.Contract is not a constructor (What is the reason ?)

texts:
I always use following command to create a contract instance without any problem :

var contractInstance = new web3.eth.Contract(abi, '0xe1623AAf57fCbe260F022404C730ae32aebe39F6');

However, when currently I use this command, I receive following error :

TypeError: web3.eth.Contract is not a constructor

What is the reason ?


texts: Passing fixed size array of bytes32[] between two contracts

texts:
I am using two contracts where one calls a function of the other:

contract con1 {
    bytes32[5] data;

    function con1(){
    }

    function addData(bytes32[5] a) { //fills the array
    }

    function getData() public constant returns(bytes32[5]){  //retrieve array
        return (data);
    }
}

The next contract calls getData from the above contract after it has been filled using addData:

contract con2 {
    function con2(){
    }

    function try(address con1Contract){
        con1 b = con1(con1Contract);
        bytes32[5] y = b.getData();
    }
  ....
}

Since in Solidity we cannot pass dynamic sized arrays, I fixed the size of the array. However, I still get the following error:

TypeError: Type bytes32[5] memory is not implicitly convertible to expected type bytes32[5] storage pointer.
bytes32[5] y = b.getData();

What am I doing wrong?

Also, is there a more efficient way to do this?


texts: how do I know that NFT is from the right person

texts:
I understand the NFT (at least solidity part)..
There's something that's bugging me though.
Let's say someone made a super great cat(cat1), published it to ipfs, then called the ERC721 contract and added the new token pointing to URI(IPFS)
Now, another person did the same, made the cat too(the same one), and minted the new token.
I am the buyer. How do I know that the cat1 created by first person is the real one ? The only way I can think of is that that person announces(somewhere social network or whatever) that that's his tokenId, and because I trust his announcement, I also believe that his tokenId is the real one that will have the value.
The same thing can be thought of about music. True/Real person sings a song, mints the token on it. Then I sing the song too and mint the token. Imagine, that even though they are different on ipfs, our voices are the same.  How does one know which one is the real tokenId ? I guess the singer announces that this is his tokenId and that's how we start to believe ?
Question 1:  Is that the correct understanding ?
Question 2: This kind of seems like the same question. Let's say I bought one NFT that represents some painting painted by the original author. So I got tokenId = tokenURI = my address in solidity. Now, someone painted the same thing, and someone else(person1) bought it to. So they also have tokenId => tokenURI => myaddress.
How can third party figure out that I hold the original one and person1 holds NOT original ? we both have tokenId => tokenURI => person1Address (tokenId, tokenURI) are different for each of us, but still, third party can't detect which one is original. How can they ?


texts:
My understanding is that there are several different implementations of EVMs (geth, parity etc.). Do the different implementations effect the execution times of smart contracts?
I wanted to test the same bytecode across a few different EVMs to benchmark the execution times. Is this a valid method of comparing different EVMs? I also see mention benchmarking opcodes but I'm unsure where they fit in.


texts: Sample Contracts for Testing Static Analysis Tools

texts:
I have to analyse some static Analysis tools against  well documented vulnerabilities. My questions are ;

Can we use the provided sample contracts (in above link) directly or not ?
If not, then where should I can find such real vulnerable contracts?
If i want to download previously attacked smart contracts (i.e. DAO, parity, etc.), are they still available to test by open source static tools or not ?
The list of vulnerabilities in above link is completed/updated or not , in term of exposed/known vulnerabilities till today?

Any useful suggestion toward performing and contributing in static analysis domain , will be appreciated !


texts: Difference between web3.eth.getCoinbase() and web3.eth.getAccounts()[0]

texts:
What is the difference between web3.eth.getCoinbase() and  web3.eth.getAccounts()[0]. In both cases, I always get the value, which is the currently selected account in Metamask.

Note: The question is relative to a public-facing dApp. i.e. UI that uses web3.js & interacts with a user's crypto wallet Metamask. It is not for local blockchain development.


texts:
Connecting to Kaleido with websockets and listening on contract events works fine, but after some time (even if constantly receiving events) the connection is dropped by Kaleido.

The problem appears on web3js (@beta-37 and 55) as well on web3py(@4.9.2). I am currently using this workaround to reconnect after a dropped connection for js, which helps, but doesn't solve the actual issue.

instance.events.allEvents().on('data', event => {
      if (event.event == eventName) {
         console.log(event);
      }
    }).on('error', console.error);

Expected would be that events keep coming in over the open websocket connection. Actually, I receive a 'Connection dropped by remote peer' error with code 1006 after a random amount of time.


texts: how to connect ethereum local provider https://localhost:8545?

texts: I am using infura web3 provider in ethereum but I don't want to use third party providers in my project so I want to use localhost:8545? how to use this provider? Is it connect to the ethereum node? what is difference between localhost and infura?


texts: calling a function in another contracts gives me an error

texts:
I have a problem like this. I am very new to solidity Works. I have created two contracts.

This is how my first contract looks.

pragma solidity ^0.4.17;

contract TrafficFine{
    struct Officer {
        string firstName ;
        string lastName;
        address account;
    }

    address public manager;
    uint public numberOfOffiers;

    mapping(address=>Officer) public officers;

    modifier restricted(){
        require(msg.sender == manager);
        _;
    }

    constructor () public{
        manager = msg.sender;
    }

    function addOfficer(
        string firstName,
        string lastName,
        address officer) public  restricted{

        require(officer!=officers[officer].account);

        Officer  memory newOfficer = Officer({
            firstName:firstName,
            lastName:lastName,
            account:officer
        });

        officers[officer] = newOfficer;
        numberOfOffiers++;
    }

    function getofficer(address officer) public view returns(address){
        return officers[officer].account;

    }
}

This is how my second contract looks like.

contract DriverProfile{
    address watch_adrs=0x0971b5d216af52c411c9016bbc63665b4e6f2542;

    struct Driver{
        string lisenceId;
        string firstName ;
        string lastName;
        address account;
        string vehicle;
        string vehicleType;
        uint totalOffenceAmount;
        uint offenceCount;
        uint pendingPayments;
        mapping(uint=>Fine)  fines;
    }

    TrafficFine trafficfine;
    Driver public driver;

    constructor(string lisenceId,string firstName,string lastName,string vehicle,string vehicleType,address owner) public{
        trafficfine = TrafficFine(watch_adrs);
        trafficfine.addDriver();
        driver = Driver({
            lisenceId:lisenceId,
            lastName:lastName,
            firstName:firstName,
            account:owner,
            vehicle:vehicle,
            vehicleType:vehicleType,
            totalOffenceAmount:0,
            offenceCount:0,
            pendingPayments:0
        });

    }

     function doFine(uint offenceID,string location,address officer) public {
        address officersel=trafficfine.getOfficer(officer);
        require(officer==officersel);
        driver.offenceCount++;
     }

}

    contract TrafficFine{
        function addOfficer(string firstName,string lastName,address officer) public;
        function getOfficer(address officer) public view returns (address);

    }

This works very finely without ,

address officersel=trafficfine.getOfficer(officer);
require(officer==officersel);

these two lines of code but when I put these two line transaction is failed. I try to figure it out what is wrong with this. But I was unable to do that. Can someone help me to solve this problem? Thank You!!!


texts: Difference between Javascript VM vs injected w3 vs web3 provider

texts: It is related to remix ethereum browser. I am wondering what is the difference between them. I think Javascript VM is just test network environment where you do not need any ethereum to test. How about the other two ?


texts:
I see no option to import contracts. Would appreciate any help here.

I do not have the contract code, but I do have its address.


texts: Can I use variables declared in modifiers in my function?

texts:
Given the below code, can I use a variable defined in a modifier (ie _organization), in my function? It's not compiling now but wondering if there is any way to do this?

modifier onlyCEOOrCOO {
     Organization memory _organization = organizations[addressToOrgId[msg.sender]];
     require(
       msg.sender == _organization.cooAddress ||
       msg.sender == _organization.ceoAddress
     );
     _;
   }

function something () external onlyCEOOrCOO {
    // is _organization available here?
    // If I had used storage instead of memory can I update _organization here?
}


texts: How to convert/decode Solidity bytes32 to Python string via web3.py

texts:
Inside a Solidity contract, I have this variable: zBytes32 = "HelloBytes32";

after Python web3.py retrieving that variable,

zbytes32 = contractInstance.functions.getzBytes32().call()

print(zbytes32) shows what zbytes32's value is:

# b'HelloBytes32\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'

zbytes32 = zBytes32.decode('utf8')# shows HelloBytes32
print(zbytes32)

decode('utf8') removes b in the front, print() will hide ALL the \x00, but they are STILL THERE!!! To prove it:

zBytes32str= str(zbytes32)
print('zbytes32 = '+ zBytes32str)
if zBytes32str == 'HelloBytes32':
    print('zbytes32str == "HelloBytes32"')
else:
    print('zbytes32str != "HelloBytes32"')

zbytes32str != "HelloBytes32" is shown!!! SO HOW CAN I properly decode byte32 in Python???

print('\ngetBytes32 raw: {}'.format(zbytes32))# shows HelloBytes32
print('zbytes32.decode("utf8") as string = '+ zbytes32)# shows HelloBytes32

ALTHOUGH they look the same as HelloBytes32, actually they are NOT!

Perhaps that explains the following situation:

arr = contractInstance.functions.getVariables().call()
print('arr[4] in str()= '+ str(arr[4]))#must be converted to string
b2= arr[4].decode('utf8')
print('b2.decode("utf8")= '+ b2)
arr[4] = ''
print('after arr[4] = "", arr[4]= '+ arr[4])
arr[4] = b2
print('after arr[4] = b2, arr[4]= '+ arr[4])
arr[0] = 'What man?'
print('after arr[0] = "What man?", arr[0]= '+ arr[0])
print('\nget many variables: {}'.format(arr))

it shows in the terminal:

arr[4] in str()= b'HelloBytes32\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
b2.decode("utf8")= HelloBytes32
after arr[4] = "", arr[4]=
after arr[4] = b2, arr[4]= HelloBytes32
after arr[0] = "What man?", arr[0]= What man?

get many variables: ['What man?', '0x583031D11...', 111111, False, 'HelloBytes32\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', ['0xCA35b7d...', '0x14723A...'], [9999999, 555555]]

See the above array. When I set a new value to arr[0], it works.

But when I set a new value to arr[4], it kind of works ...

WHY is it when I show the whole array, arr[4] still shows those \x00 ???

I need to pass those values on to another script so I have to make sure they are clean from those \x00.
Please help. Thank you


texts:
Both Bitcoin and Ethereum private keys are usually a 256-bit number, isn't it possible to use the same private key for both Bitcoin wallets and Ethereum accounts?
For instance, the Bitcoin wiki states:

In Bitcoin, a private key is usually a 256-bit number (some newer wallets may use between 128 and 512 bits), which can be represented one of several ways. Here is a private key in hexadecimal - 256 bits in hexadecimal is 32 bytes, or 64 characters in the range 0-9 or A-F.
E9 87 3D 79 C6 D8 7D C0 FB 6A 57 78 63 33 89 F4 45 32 13 30 3D A6 1F 20 BD 67 FC 23 3A A3 32 62

Which is (removed the whitespaces):
e9873d79c6d87dc0fb6a5778633389f4453213303da61f20bd67fc233aa33262

With MyEtherWallet I generated the corresponding  public key for Ethereum:
0x60751Ab56d58781069b1C73064aD580dAde1F469

Now I see not every 256-bit number is a valid ECDSA private key for bitcoin. Can I use the same private key for Ethereum and Bitcoin? Is there a convenient way to generate both the ETH and BTC public key from any 256-bit random number?
This would be a cool way to store Ether and Bitcoin on the same account. Is it possible?


texts: Cannot deploy new contracts with pending transactions (Ropsten)

texts:
I have a very strange and annoying problem. I am trying to deploy a new contract however it just keeps cycling. I have the same problem on the POA testnet and on Ropsten. Please see below:

I have tried to cancel the transactions and even when I increase the gas to the fastest option, the transactions neither confirm nor reject.

Any ideas?

Thanks!


texts: how to estimate gas limit when using web3.eth.sendSignedTransaction

texts:
I am using web3 to transfer tokens by using web3.eth.sendSignedTransaction.

When I am setting the parameter rawTx like

    var rawTx = {

     "from"      : walletbase,
     "nonce"     : value,
     "gasPrice"  : web3.utils.toHex(2000000000), //2 gwei
      "gasLimit"  : estimateGas,
      "to"        : contractAddr,
      "value"     : "0x00",
      "data"      : data,
      // "chainId"    : 3
  }

I want to set the gasLimit dynamically.
I tried to calculate the gasLimit by using web3.eth.estimateGas like:

  web3.eth.estimateGas({

          to  : toAddress,
          data: data
          })

But the value is lower than need. I always got error like:

    Error: Transaction ran out of gas. Please provide more gas:

Do you have better way to calculate the gasLimit? Thank you.


texts:
I'd like to calculate a Merkle tree on chain, and then only store the root.

The tree will track all balances for an ERC20 token. How many accounts would this be feasible for? If there are 1000 balances would it be possible to iterate over all the balances to create the Merkle root? What is the maximum number of balances for which this would be possible?

I intend to do some testing myself, but was wondering if anyone has already dealt with this and knows what sort of limits I can expect to encounter.


texts:
When I "Brownie compile" I don't receive a .json file under build>contracts
If anyone can please help me I'll gladly send you a tip for your time.


texts: How Do I Update A Struct Property in Solidity

texts:
I am trying to update the value of one of the props in a struct in a solidity contract.

updating a variable works fine if it is not in a struct. but when i try to update a value in a struct like in the contract below, gas is used to update the contracts as i would expect, but when i read the updated value, it has not been changed.

Can anyone see how my contracts definition is incorrect?

My contract is defined as:

Users.sol

pragma solidity ^0.4.17;

contract Users {
    struct User {
        string firstName;
        string lastName;
    }
    mapping(address => User) public users;

    function getFirstName() public view returns (string) {
        User memory user = users[msg.sender];
        return user.firstName;
    }

    function setFirstName(newName) public {
        User memory user = users[msg.sender];
        user.firstName = newName;
    }
}

i'm new to working with solidity so any help is appreciated.


texts: How to restrict a function in a contract so that it can only be called by a designated contract?

texts:
First, I'm aware of a similar question, but that answer is not sufficient.

Say I deployed an contract A, then I deploy another contract B some time later. I want to make sure that a function A.f1() in A can only be called from contract B. To do so, I implement a function register(address trusted_contract) to register B to A, which basically stores B's address to an array in A.. Since I own A, I'm the only one who can call it to register an address.

Now if B calls A.f1(), then within f1(), I check if msg.sender is in the array and decide if to serve the call.

Is this the right way to do it?

If it is, I still have a questions. What prevent another contract C to send a msg and claims that it is B? My understanding is that unlike an external account, a contract does not have a private key and thus can not sign a message. If so, how does receiver A verify the caller is contract B, not some bad actor C?


texts: Difference between transactions and raw transactions in web3.js

texts:
Reading the documentation of web3.js I have come across sending transactions and raw transactions.In the documentation it's specified that send raw transaction sends an already signed transaction.

Does this imply that web3.js does not sign transactions when sendTransaction() is called?


texts: How do I create a MetaMask Connect request to auth a wallet with MetaMask

texts:
I am looking for how to authenticate completely in the browser with MetaMask, presumably by having it sign with some private keys and prove that the user owns a wallet that lists the corresponding public keys.

Every online tutorial I have found speaks about a more strange-looking dialog, which MetaMask uses to confirm signing an arbitrary string. What I want, however, is the dialog found on veritaseum.com:

It's clearly possible, but I can't find what APIs to use to call it. It looks like oAuth, except that I bet the domain, name and icon come from being hosted on some server under my control, while the title and icon of the account is coming from the MetaMask extension.

Can you please post the actual code snippet to make this work, using MetaMask API or maybe web3 can do it?


texts: Re-send Transaction With Higher Gas Price In Web3js

texts: I've seen that the geth client has functions to re-send transactions with a higher gas price but I'm not seeing that functionality anywhere in the web3js client.  Does it exist?  If not, is it possible to implement this yourself?  Does anyone have any suggestion as to how to do this?


texts: I'm trying to understand how a simple hex string like 0x25d8dcf2 is enough information to execute a function in a contract. I've read up on the ABI and understand that the hex string is basically just a hash of the function signature, but how is it determined that this piece of data will end up jumping to the appropriate address for that function in the bytecode of the contract?


texts: Is there a way to verify transactions afterwards they are entered in the ethereum blockchain?

texts: Suppose I sent a signed transaction using the web3.js library. But, I might be using some third party API like an Infura node or others. So there are chances of attacks and data manipulation. So, is there any way to verify if the all transaction data entered in the blockchain is same as the one entered by me or if it has been manipulated by someone?


texts: DApp sign transactions on mobile and transfer to server - Web security

texts:
I'm currently developing an app for iOS and Android using React Native where users will have a wallet, made using: https://www.npmjs.com/package/ethereumjs-wallet-react-native. They then are able to sign and send transactions to my Web API using this: https://github.com/ethereumjs/ethereumjs-tx.

I'm by no means an expert on Web security but the server I'm using is using HTTPS for the communications between client and server. I was wondering what could be possible security implications for the specified procedure.

Steps:

User creates wallet and stores private key on device.
User creates transaction and signs the transaction on the device.
User sends signed transaction over HTTPS to my WebAPI.
My WebAPI sends it onto the blockchain.

Additionally, I'd like to create some way for users to be able to retrieve their wallets should the device get corrupted somehow. I can't think of a particularly secure way of doing this. Unless, when I store the private key on the keychain (or similar for Android), does Apple / Android manage the recovery? For example, if I log in on one device and then log in on another device will it use the same private key?

Thanks in advance and I appreciate your help.


texts: Freeze account for a limited time after transaction

texts: Is it possible ina contract to freeze an account for a specific period of time, 1 month in example, after a transaction, let say the user sends 1 ETH to my contract and he can't do another transaction for a month?


texts: Creating eth_newFilter topic listeners with Python

texts:
Ethereum JSON RPC allows one to listen to contract events through eth_newFilter call. Based on non-authoritative sources, eth_newFilter takes topics parameter which is somehow a hash that is calculated from the event name and signature.

Where is explained what is topics parameter and how this should be calculated?

How to calculate topics parameter for a known Solidy event signature in Python?


texts: Issue in truffle unbox zeppelinos/zepkit

texts: As it is visible in the screenshot, I did not get a green check in the "setting up box". Anyone know why it is happening and will it cause any issue in the future?


texts: What does a payable parameter mean in constructor?

texts:
constructor(
    uint _biddingTime,
    address payable _beneficiary
) public {
    beneficiary = _beneficiary;
    auctionEndTime = now + _biddingTime;
}

This code is from the contract SimpleAuction in the solidity documentation.
https://solidity.readthedocs.io/en/v0.6.4/solidity-by-example.html

What does a payable parameter mean?


texts: Geth node Compromised. Securing Geth Node in Private Ethereum

texts: What happens if a Geth node is compromised? How to Geth Node in Private Ethereum network assuming I need to enable rpc on the node?


texts: What if there is an interruption in the geth sync process

texts:
I run geth attach command that s currently doing some sync with the blockchain.  I can see the status in the geth JavaScript console like,

When I execute the command of eth.syncing,
The output is,

{
  currentBlock: 4050305,
  highestBlock: 4764190,
  knownStates: 5436672,
  pulledStates: 5431426,
  startingBlock: 1694745
}

I can see the remaining blocks with executing the command, eth.syncing.highestBlock - eth.syncing.currentBlock

The output is 713055

Let's imagine, at this point, the internet connection or the electricity goes away. Will the blockchain synchronization start from the current point or from the beginning?


texts: geth 1.3.6 consistently drops synchronisation after ~5 minutes

texts:
My geth consistenly stops synchronising after approximately 5-10 minutes of healthy downloading blocks. I've google around and tried various fixes including:

Running with the flags: --rpc, --cache=512 as mentioned in:
Geth stopped syncing after a while
Installing the latest mist wallet and synchronising with that but synchronisation also hangs after about 5 minutes

I ran using the flag --vmodule=downloader=6 as suggested here and the output always converges to something like:

I0601 17:17:38.609524    3531 downloader.go:240] Unregistering peer 2af85be2f92b1abe
I0601 17:17:38.658460    3531 downloader.go:931] Peer 038325873b9be31b [blocks 0.00/s, receipts 0.00/s, states 0.00/s, lacking    0]: head header timeout
I0601 17:17:38.658514    3531 downloader.go:339] Synchronisation terminated after 3.001480912s
I0601 17:17:38.658529    3531 downloader.go:263] Removing peer 038325873b9be31b: timeout
I0601 17:17:38.658543    3531 downloader.go:240] Unregistering peer 038325873b9be31b
I0601 17:17:38.723505    3531 downloader.go:252] Attempting synchronisation: 55836d952b9d4432, head [f427565c…], TD 23853227086448968682
I0601 17:17:38.723629    3531 downloader.go:337] Synchronising with the network using: 55836d952b9d4432 [eth/63]
I0601 17:17:38.723662    3531 downloader.go:905] Peer 55836d952b9d4432 [blocks 0.00/s, receipts 0.00/s, states 0.00/s, lacking    0]: retrieving remote chain height
I0601 17:17:38.747023    3531 downloader.go:228] Registering peer 3527031fc9945b8a
I0601 17:17:38.905869    3531 downloader.go:240] Unregistering peer be55471dfeaddea0
I0601 17:17:40.509484    3531 downloader.go:240] Unregistering peer a7f8f52fa4b64dfa
I0601 17:17:41.227673    3531 downloader.go:252] Attempting synchronisation: 55836d952b9d4432, head [f427565c…], TD 23853227086448968682
I0601 17:17:41.227723    3531 downloader.go:260] Synchronisation already in progress
I0601 17:17:41.252802    3531 downloader.go:228] Registering peer 172d5f6904a60131
I0601 17:17:41.725586    3531 downloader.go:931] Peer 55836d952b9d4432 [blocks 0.00/s, receipts 0.00/s, states 0.00/s, lacking    0]: head header timeout
I0601 17:17:41.725675    3531 downloader.go:339] Synchronisation terminated after 3.002020145s
I0601 17:17:41.725689    3531 downloader.go:263] Removing peer 55836d952b9d4432: timeout
I0601 17:17:41.725701    3531 downloader.go:240] Unregistering peer 55836d952b9d4432
I0601 17:17:41.994328    3531 downloader.go:240] Unregistering peer f42cd23b442bed31

Cancelling (using ctrl-c) and restarting causes geth to sync from the last downloaded block without any issues (but I don't want to have to continuously do this, I'm about 100000 blocks behind -.-).

Any help greatly appreciated!

P.s. I'm willing to remove my entire db and resync using --fast but I thought I'd check if there was anything else I could do first.


texts: Transaction failed due to "out of gas", how can I get refund?

texts:
https://etherscan.io/tx/0xf0d9a39afef87aab8072876dbdeb1a4c8818dee20e13e6c57a13d8fa2a640985

My transaction from okcoin to another exchange failed because out of gas.
When I contact okcoin, they said they need to wait till the ETH "completely return to their sending wallet", but this transaction happened 4 days before and got 19000 confirmations, how is it possible that still not returned to their wallet?

Can anyone tell me if this error occurred, the ETH is immediately returned, or it need a few days? and is there a way I can check whether the amount has been returned?  I suppose there will not be a new transaction created on the blockchain for this particular return, so how can I track it?

Thanks a lot!


texts: Web3 - Getting variable value from deployed contract without ABI

texts:
I'm trying to build a wallet capable of managing ERC20 tokens added by the users, using Web3 1.0.0-beta.34. After adding a certain token to the wallet using its address, I was able to fetch the amount of coins in a certain wallet.
Since I want the users to add any ERC20 token, I don't know the ABI of the token contract. Web3 requires the ABI to instantiate a contract, and I solved this issue getting the ABI of the single balanceOf function and then instantiating the contract using:

var contract = new web3.eth.Contract(balanceOfABI, contractAddress);

Now I need to get the decimals of the token, so I basically need a getter on the decimals variable but this is not possible since this is not a function and I can't use the trick above.
Is there a way to create the ABI for a common getter method? JavaScript code should be something like this at the end:

var contract = new web3.eth.Contract(getterABI, contractAddress);
contract.methods.decimals().call(function (error, result) {
    if(!error)
        console.log(result);
});

I hope I made my point, thanks a lot.


texts: Compile source code error expected pragma

texts:
I am getting an error when coding a token with the Ethereum wallet. Namely, Expected pragma, import directive or contract/interface/library definition. function burn (uint256 _value)public returns(bool success) {

could anyone help me with this error, as i am not sure what is really missing, in this line of code.


texts: tx fee (2.11 ether) exceeds the configured cap (1.00 ether), how to bypass default cap?

texts:
I'm getting this error when trying to make a simple ETH(BNB) transaction with very high gas, I've tried using different scripts with both web3 and ethers.js and both throw the same error on the BSC Mainnet and Testnet, on ropsten and others it works fine. Any clue how to change the cap?
EDIT: I just realized this isn't possible on Metamask as well, the scripts are not the problem.
Is it even possible to bypass it? You can try this yourself by trying to send a tx with 8k gwei and 700000 gasLimit. Metamask won't let you through, weird thing is this works perfectly on all other chains I've tested.


texts: How to encode data for low level call? (Compound/Uniswap governence)

texts:
I can't get the transaction to execute no matter how much I play with it. I know that it reverts during the secondary call because I always get this revert message: Timelock::executeTransaction: Transaction execution reverted.Here is the function I am calling:
function executeTransactions(address[] targets, uint[] values, string[] memory signatures, bytes[] memory data) public payable returns (bytes memory)

    bytes memory callData;
    for(uint i = 0; i < targets.length; i++){

        if (bytes(signatures[i]).length == 0) {
            callData = data[i];
        } else {
            callData = abi.encodePacked(bytes4(keccak256(bytes(signatures[i]))), data[i]);
        }

        // solium-disable-next-line security/no-call-value
        (bool success, bytes memory returnData) = targets[i].call.value(values[i])(callData);
        require(success, "Timelock::executeTransaction: Transaction execution reverted.");

        return returnData;
    }
}

Here is how I'm calling it (with web3.eth.Contract):
      Contract.methods.executeTransactions(
        ["0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984"],//targets
        [0],//values
        [web3.eth.abi.encodeFunctionSignature("transfer(address,uint)")],//signatures
        [web3.eth.abi.encodeParameters(["address", "uint"], ["0xC722A3F999983325c611e7E1D967a3c27063F8b0", 5000000000000000000000000])]//calldata

      ).send({from: accounts[0], gas: 5000000})

Help is greatly appreciated as with my current setup I have to run through a simulation that takes ~15 mins per shot in the dark to test this :/


texts:
I am calling the function getPrice() with arguments tokenId but it returns 0, while i have assigned price = 1 ether, where is the problem in this code?

pragma solidity ^0.6.7;

import "./S5Implement.sol";

  contract newToken is S5Implement {

      uint256 private price = 1 ether;

      mapping (uint256 => uint256) private priceMapping;

      function getPrice(uint256 _tokenId) public returns(uint256) {

           price = priceMapping[_tokenId];

      }
  }


texts:
When using web3, calling a function that returns an enum type converts it to a uint. Initially I assumed that enums are converted incrementally: 0,1,2,3.... However what I received was a hexadecimal. How is it converted, and how do you parse it?

For example:

contract Foo {
   enum Letter {A, B, C}
   function say(uint index) returns (Letter) {
       if(index == 0) return Letter.A;
       if(index == 1) return Letter.B;
       if(index == 2) return Letter.C;
       throw;
   }
}

If you call Foo.say.call(1) you get a hex number (0x3ad324...). How would I check if it was Letter.A or 'Letter.B` that was returned?


texts: Reading deployed contract state in Python

texts:
I'd like to monitor (or poll or just do one off reads in the first place) a contract I deploy in the Ethereum network from a Python server-side application. Specifically it's a modified standard token contract deployed by me and I'd like to now and then check the status of accounts.

What options I have: Interacting via RPC with geth (using ethjsonrpc https://github.com/ConsenSys/ethjsonrpc) or any API services?
I'd like to read the current contract state variables - how do I can get access to current state variables over RPC?


texts:
Please bear with me for I am a newbie. I transferred my UTRUST tokens to my METAMASK account successfully. I can see the number of tokens using ETHERSCAN but it is still showing zero ETH on my METAMASK browser.

Can someone help to explain why is happening? Is it possible to rectify the problem by crediting the account with the value in ETH or redirect the tokens to another address?

Here are my addresses:

CONTRACT address:  0x70a72833d6bf7f508c8224ce59ea1ef3d0ea3a38

METAMASK address:  0x418722958BEA3B3e6411E7fA67d392a2FE410E2a


texts:
I have this interface:

pragma solidity ^0.4.24;
interface EventsInterface
{
   function removeValueFromArray(uint _userId, uint[] array) external
   returns(uint[]);
}

And this contract:

pragma solidity ^0.4.24;

import "./EventsInterface.sol";

contract EventsImpl is EventsInterface {

    function removeValueFromArray(uint _userId, uint[] _array) internal returns(uint[]) {

    uint[] storage auxArray;

    for (uint i = 0; i < _array.length; i++){
        if(_array[i] != _userId)
            auxArray.push(_array[i]);
    }

    return auxArray;
}
}

When I try to deploy de contract. Remix report me a error:

  This contract does not implement all functions and thus cannot be created.

Changing to public the Impl function:

function removeValueFromArray(uint _userId, uint[] _array) public returns(uint[]) {

    uint[] storage auxArray;

    for (uint i = 0; i < _array.length; i++){
        if(_array[i] != _userId)
            auxArray.push(_array[i]);
    }

    return auxArray;
}

I get the following error

  TypeError: Function overload clash during conversion to external types for arguments

To fix the issue I set to public bouth functions (Interface/Implementation) and works. But I getting one warning that tell me that interface function must be external and not public


texts: getting an "Expected token Lparen dot 'identifier' " error on last function, anyone know what's wrong?

texts:
pragma solidity ^0.4.0;

contract insure {
  address public doctor;

  function Person() private {
    doctor = msg.sender;
  }
  modifier onlyDoctor {
    require(msg.sender == doctor);
    _;
  }
}

contract postRecord is insure {
  string diagnosis;

  struct patient {
      address client;
      bool consent;
      bytes32 name;
   }

  event Post(string records);

  function modify(string records) private onlyDoctor {
      diagnosis = records;
  }

  function Person() private {
      doctor = msg.sender;
  }

  modifier rightPerson {
      if (msg.sender != doctor){
        throw;
      }else{
        _;
      }
  function returnString() public payable {
     Post(records);
  }
}


texts: How to convert ETH ethereum transaction value to decimal in javascript

texts:
Example value: 0x2c1c986f1c48000

from: here

Expected value back: 0.19866144 Eth


texts: Why is privateKey padded before secp256k1 signing?

texts:
I am checking how the Ethereum handles signing but I can't figure out why the math.PaddedBigBytes is necessary:

func Sign(digestHash []byte, prv *ecdsa.PrivateKey) (sig []byte, err error) {
    if len(digestHash) != DigestLength {
        return nil, fmt.Errorf("hash is required to be exactly %d bytes (%d)", DigestLength, len(digestHash))
    }
    seckey := math.PaddedBigBytes(prv.D, prv.Params().BitSize/8)
    defer zeroBytes(seckey)
    return secp256k1.Sign(digestHash, seckey)
}

Does it have to do something with the intention to generate a 65 bytes sig length?


texts: Is it possible to do something on a specific block number? (e.g. publish a contract or execute a transaction)


texts: Etherescan Unique Address Growth Chart - How is it computed?

texts:
how does Etherscan get this information from the blockchain? Is it possible via using a web3 module? Any insight?

https://etherscan.io/chart/address


texts: passing an element of struct array as a function argument is pass by value or reference

texts:
suppose I have the defined a struct in solidity as below

    struct Organisation {
    string name;
    address ethAddress;
    uint rating;
    string regNumber;
}

I have defined an dynamic array of the above struct as

//  list of all insurers/Organisations

Organisation[] allOrgs;

If i need to pass the element of this array to a internal function which is actually just comparing the value against another value, will it be passed by reference?

function getInsurerEth(string uname) public payable returns(address) {
    for(uint i = 0; i < allOrgs.length; ++ i) {
        if(stringsEqual(allOrgs[i].name, uname)) {
            return allOrgs[i].ethAddress;
        }
    }
}

The function StringsEqual defined as below. I need to know if the first parameter is passed by reference or value. If by value, then I can actually remove the argument attribute 'storage' and make the function pure. Also note that this is a internal function call which will use the jump opcode and also i am not editing the storage element allOrgs[i].name.

    //   internal function to compare strings

function stringsEqual(string storage _a, string memory _b) internal returns (bool) {
    bytes storage a = bytes(_a);
    bytes memory b = bytes(_b);
    if (a.length != b.length)
        return false;
    // @todo unroll this loop
    for (uint i = 0; i < a.length; i ++)
    {
        if (a[i] != b[i])
            return false;
    }
    return true;
}


texts: Why is "+=" operator used in this auction example?

texts:
Here's an auction code from blog.ethereum.org

contract auction {
  address highestBidder;
  uint highestBid;
  mapping(address => uint) refunds;
  function bid() {
    if (msg.value < highestBid) throw;
    if (highestBidder != 0)
      refunds[highestBidder] += highestBid;
    highestBidder = msg.sender;
    highestBid = msg.value;
  }
  function withdrawRefund() {
    uint refund = refunds[msg.sender];
    refunds[msg.sender] = 0;
    if (!msg.sender.send(refund))
     refunds[msg.sender] = refund;
  }
}

  refunds[highestBidder] += highestBid;

What's the reason behind using "+=" instead of "="?


texts: How to persist ganache-cli data when run from within a docker container

texts:
The reason for persisting the data is that every time i run the ganache-cli container , the deployed smart contracts address changes each time i restart it .SO i am looking for a work around to either persist the data so that contract address wont change on frequent restart or else automatically deploy the contract and get the contract address out of it.
For time being i have used the below statement to run ganache :

sudo docker run -d --name ganache --network=test1 --ip=172.28.5.2  -p 8545:8545 trufflesuite/ganache-cli:latest -i 2100 --db=path/to/ganache/data

however the data is not saved in ganache directory.let me know if you need any more clues.Thanks in advance!


texts:
solidity 0.4.17

I have an array of int128 elements, I chose in128 because I want to check for -1.

int128[] elements;
int128 numberOfElements;//I increment this as I add elements

function hasElement(int128 element) returns (bool) {
    for ( int128 i = 0; i < numberOfElements; i++ ) {
        if (elements[i] == element) {
            return true;
        }
    }
    return false;
}

but I get the error:

  TypeError: Type int128 is not implicitly convertible to expected type
  uint256 on the i in elements[i].

Yet i is int128 and so are the contents of elements.


texts: Can't unlock account while deploying contract with truffle

texts:
I am trying to set up a private blockchain with geth, using truffle to deploy a smart contract to it. My goal is to get a private blockchain running with several accounts, deploy some contracts to it and connect some peers. It is supposed to be learning exercise.
I am running:

geth 1.9.15
truffle 5.1.30
Ubuntu 18.04

Here are the steps I took to set up the private blockchain:

Create 5 accounts: geth account new --datadir private-chain --password pw.txt
Initialize blockchain: geth --datadir private-chain init private-chain/genesis-block.json
Start the console: geth --datadir private-chain --http --http.addr 127.0.0.1 --http.port 8545 --http.api eth,net,web3,personal --networkid 3456 console 2> private-chain/private-chain.log

My genesis-block.json file funded the new accounts with 120 ethers each.
When I try to deploy the contract with truffle, this is what I get:
Starting migrations...
======================
> Network name:    'geth'
> Network id:      3456
> Block gas limit: 2000000 (0x1e8480)

1_initial_migration.js
======================

   Deploying 'Migrations'
   ----------------------

Error:  *** Deployment Failed ***

"Migrations" -- Returned error: authentication needed: password or unlock.

So I tried to unlock the account by changing 1_initial_migration.js to the following:
const web3_lib = require ("web3");
const Migrations = artifacts.require ("Migrations.sol");

module.exports = function (deployer, network, addresses)
{
    const web3 = new web3_lib (new web3_lib.providers.HttpProvider ('http://127.0.0.1:8545'));
    console.log ('>>>>> Attempting to unlock account');
    console.log ('>>>>> Using password ' + process.env.GETH_PW);
    web3.eth.personal.unlockAccount ('0x1234567890abcdef1234567890abcdef12345678', 'my-pw', 36000).then (console.log ('Account unlocked!'));

    console.log ('>>>>> Deploying migration');
    deployer.deploy (Migrations);
};

The "Account unlocked!" message was printed to the screen, but I got the same error as before.
Then I went to the geth console and tried to unlock the account from there and this was the result:
> web3.personal.unlockAccount ("0x1234567890abcdef1234567890abcdef12345678", "my-pw", 36000)
GoError: Error: account unlock with HTTP access is forbidden at web3.js:6347:37(47)
    at native
    at <eval>:1:91(6)

Is this even possible? Is there something I am forgetting, or not understanding about how this is supposed to work? What would be the correct way to do what I am trying to do?


texts: Can no more connect to my local node using web3

texts:
I start my local node using the following command:

geth --datadir  "D:\EthereumLocalNode" --networkid 1114 console 2>>  "D:\EthereumLocalNode\myLog.log" --rpc --rpccorsdomain "*" --nodiscover --nodekey boot.key

and until 2 weeks ago, I could successfully connect and query my blockchain in chrome browser using :

web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
abi = JSON.parse('.....myContract abi here.....');
myContract = web3.eth.contract(abi);
contractInstance = myContract.at('...My Contract address in bc...');

Now I'm getting the following error in developer tool of chrome :

Response to preflight request doesn't pass access control check: The 'Access-Control-Allow-Origin' header has a value 'null' that is not equal to the supplied origin. Origin 'null' is therefore not allowed access.

However I can still connect to this node and send transactions using remix, or with a js script that I run with nodejs that can make transactions to exactly same node still using web3 , which in the first line starts with:

Web3 = require('web3');
web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));

and this works fine.

So I'm guessing something has changed with the way Chrome works since the last one or two updates.

There are people complaining about Chrome's latest updates about something has changed with CORS. Anyways, I dont know what to do with CORS or how to change its settings.

Do I need to:

change the way I start my node?
change something in Chrome settings?
or add some lines to my javascript code I use in my html.

Would be glad if someone helped me here.


texts: I want to send Ethereum(ETH) from one individual to another individual using API. so please can you help me to solve out this one.


texts: When watching events using web3, does .stopWatching() block the code running?

texts:
this is a sample code in web3 document :

  var myEvent = myContractInstance.MyEvent({some: 'args'}, {fromBlock: 0, toBlock: 'latest'});

  myEvent.watch(function(error, result){
     ...
  });

  myEvent.stopWatching();

  // extra code to run

The first and second line will have all matching events to undergo the callback function, asynchronously.

If there is more code to run, does stopWatching() method wait until all events complete their callback functions, or do the callback functions run parallel with the extra code?


texts: Truffle Console Script giving Error: Cannot find module

texts:
I am trying to run the following script:
const messageBuild = require('./build/contracts/MyContract.json')

const MyContract = require('~/Truffle_programs/script_transfer_Eth_thr_Truffle/contracts/MyContract.sol');
const MyContractTester = require('~/Truffle_programs/script_transfer_Eth_thr_Truffle/contracts/MyContractTester.sol');
module.exports = (callback)=>{
var acc1 = accounts[1]
var acc2 = accounts[2]
const myC = MyContract.deployed()
const myCT =  MyContractTester.deployed()
web3.eth.sendTransaction({to:myC.address, from:acc2, value: web3.utils.toWei('11')})
balance2 =  web3.eth.getBalance(acc2)
web3.utils.fromWei(balance2, "ether")
mybal = web3.eth.getBalance(myC.address)
web3.utils.fromWei(mybal, "ether")
myC.sendTo(myCT.address, web3.utils.toWei('3',"ether"), {from:accounts[0]})
myCbal = web3.eth.getBalance(myC.address)
web3.utils.fromWei(myCbal, "ether")
myCTbal = web3.eth.getBalance(myCT.address)
web3.utils.fromWei(myCTbal, "ether")
}

but I am getting the error:
truffle(development)> truffle exec ./myscript.js
Using network 'development'.

internal/modules/cjs/loader.js:638
    throw err;
    ^
Error: Cannot find module '~/Truffle_programs/script_transfer_Eth_thr_Truffle/contracts/MyContract.sol'

I tried the "ls" command and found that the path is correct:
@lc2530hz:~$ ls ~/Truffle_programs/script_transfer_Eth_thr_Truffle/contracts/
Migrations.sol  MyContract.sol  MyContractTester.sol

Somebody please guide me.
Zulfi.


texts: Transaction fails during smart contract deployment from Remix IDE, while i confirm the transaction from MetaMask

texts:
I am able to connect to private ethereum network and able to do the transactions from Metamask, but while deployment of smart contract from remix IDE, it launches MetaMask and i get below error while I confirm the transaction. Please guide.

ALERT: [ethjs-rpc] rpc error with payload {"id":3682247715857,"jsonrpc":"2.0","params":["*****************"],"method":"eth_sendRawTransaction"} Error: invalid sender

I am deploying very basic and first smart contract.

pragma solidity ^0.4.4;

contract MyFirstContract {
    string private name;
    uint private age;

    function setName(string newName) {
    name = newName;
    }

    function getName() returns (string) {
    return name;
    }

    function setAge(uint newAge){
    age = newAge;
    }

    function getAge() returns (uint){
    return age;
    }
}


texts: Unable to sync Geth on testnet -- "potential rewrite attack"

texts:
I'm trying to do a fast sync on testnet and when I'm a few thousand blocks from the end it get's caught up in "potential rewrite attack" and the sync craws to a standstill. Retried a few times.

From what I read this happens because it's connecting to peers on another chain. How can I fix this? Really need to get the Ropsten blockchain up and running.

This is on Geth 1.5.5

I0109 12:28:25.240911 core/blockchain.go:1042] imported 1 blocks,     1 txs (  0.068 Mg) in   7.873ms ( 8.676 Mg/s). #307220 [2be43506…]
I0109 12:28:50.384733 eth/downloader/downloader.go:723] Peer 8c5ef4d490aa810b [hs 0.00/s, bs 0.00/s, rs 0.00/s, ss 0.00/s, miss    0, rtt 16.242456742s]: potential rewrite attack: #217220 [00000000…] <= #217220 limit
I0109 12:30:43.874138 eth/downloader/downloader.go:723] Peer 2243f34584f582c2 [hs 0.00/s, bs 0.00/s, rs 0.00/s, ss 0.00/s, miss    0, rtt 20s]: potential rewrite attack: #217220 [00000000…] <= #217220 limit
I0109 12:30:51.981788 eth/downloader/downloader.go:723] Peer 34282ad7b29591ab [hs 0.00/s, bs 0.00/s, rs 0.00/s, ss 0.00/s, miss    0, rtt 20s]: potential rewrite attack: #217220 [00000000…] <= #217220 limit
I0109 12:31:05.643768 eth/downloader/downloader.go:723] Peer 17ddc3eb0ac57a21 [hs 0.00/s, bs 0.00/s, rs 0.00/s, ss 0.00/s, miss    0, rtt 20s]: potential rewrite attack: #217220 [00000000…] <= #217220 limit
I0109 12:31:18.876271 eth/downloader/downloader.go:723] Peer 0cbd61469dce5c4b [hs 0.00/s, bs 0.00/s, rs 0.00/s, ss 0.00/s, miss    0, rtt 20s]: potential rewrite attack: #217220 [00000000…] <= #217220 limit
I0109 12:31:30.268372 eth/downloader/downloader.go:723] Peer 8779e82b7fe6ea55 [hs 0.00/s, bs 0.00/s, rs 0.00/s, ss 0.00/s, miss    0, rtt 20s]: potential rewrite attack: #217220 [00000000…] <= #217220 limit
I0109 12:33:41.239244 eth/downloader/downloader.go:723] Peer b3e5e884df039c61 [hs 0.00/s, bs 0.00/s, rs 0.00/s, ss 0.00/s, miss    0, rtt 20s]: potential rewrite attack: #217220 [00000000…] <= #217220 limit
I0109 12:33:45.293838 eth/downloader/downloader.go:723] Peer d40bfe9758cfb344 [hs 0.00/s, bs 0.00/s, rs 0.00/s, ss 0.00/s, miss    0, rtt 20s]: potential rewrite attack: #217220 [00000000…] <= #217220 limit


texts: Can't deploy on https://wallet.ethereum.org: DAO

texts:
I'm writing Decentralised Application.
I've added function vote() an function changeName().
After that my code can't compile on wallet.ethereum.org.
Though remix.ethereum.org shows no mistakes.

pragma solidity ^0.4.19;

contract SimpleDAO {

  string public name;
  string public symbol;
  uint8 public decimals;

  uint256 public totalSupply;

   mapping (address => uint256) public balanceOf;

   mapping (address => mapping (address => uint256)) public allowance;

    uint8 public minVotes = 6;
   string public proposalName;
   bool public voteActive = false;
  struct Votes{
     uint256 current;
     uint numberOfVotes;
   }
   Votes public election;

   event Transfer(address from, address to, uint256 value);

   event Approve(address from, address to, uint256 value);

    function SimpleDao() public {

     decimals = 0;

    totalSupply = 1000000 * (10 ** uint256(decimals));
    balanceOf[msg.sender] = totalSupply;

    name = "SimpleDAO";

    symbol = "tDAO";
  }

 function  _transfer (address _from, address _to, uint256 _value) internal{
  require (_to != 0x0);
 require(balanceOf[_from] >= _value);
 require(balanceOf[_to] + _value >= balanceOf[_to]);
 balanceOf[_from] -= _value;
 balanceOf[_to] += _value;
  Transfer(_from,_to,_value);
}
 function transfer(address _to, uint256 _value) public {
   _transfer(msg.sender, _to, _value);
 }

   function transferFrom (address _from, address _to, uint256 _value) public {

  require(_value <= allowance[_from][_to]);
   allowance[_from][_to] -= _value;

  _transfer(_from, _to, _value);
}
   function approve(address _to, uint256 _value) public{

   allowance[msg.sender][_to] = _value;

   Approve(msg.sender, _to, _value);
 }

  function newName (string _proposalName)  public{
     require(!voteActive);
     proposalName = _proposalName;
     voteActive = true;
  }
  function vote(bool _vote) public {
       require(voteActive);
       if (_vote) {
         election.current += uint256(balanceOf[msg.sender]);
         }
       else {
         election.current      -= uint256(balanceOf[msg.sender]);
        }
         election.numberOfVotes += uint256(balanceOf[msg.sender]);
      }
   function changeName() public{
     require(voteActive);
    require(election.numberOfVotes >= minVotes);
     if (election.current > 0) {
         name = proposalName;
      }
       election.numberOfVotes = 0;
       election.current = 0;
       voteActive = false;
  }
}


texts:
Follow up on this post
Does parity include a console?

It is possible to have a JS script -with web3 nodejs library- running in a linux machine which only has installed parity as a client (no geth)?

Thanks!


texts: I came across a repo on github https://github.com/ethereum/go-ethereum . Is this ethereum's official implementation? I mean is it official protocol?


texts: If I get transaction hash by PersonalSendTransaction, It means the transactions always be mined？

texts:
I want to know if I get the transaction hash by PersonalSendTransaction, Whether It means the transaction will be mined in eth and will not be lost?

If not, whether should I record the hash and check the receipt periodly, and if I don't got the right receipt (with block hash) in one hour, recall PersonalSendTransaction?

Ignore the price problem. I build a private eth network for a project.


texts: Relation between the number of block and transaction rate in Quorum

texts:
I want to know the relation between the number of blocks generated and the transaction send rate in quorum.
I did some experiments on quorum with RAFT consensus, and I get (I invoked the same function of a deployed smart contract in each workload)

10 blocks for 10 transaction send rate
7 blocks for 20 transaction send rate
21 blocks for 30 transaction send rate
21 blocks for 50 transaction send rate
20 blocks for 100 transaction send rate
23 blocks for 200 transaction send rate
156 blocks for 1000 transaction send rate

I can't determine the logic for blocks generation with relation to the transaction send rate


texts:
I am puzzled that where are the keystor files of default 10 accounts testrpc provides?

I start testrpc --db ./data

I can see account default accounts:

    Available Accounts

(0) 0x32fc58d738e05b95fd38149307aa6d4f0c6f2e9a
(1) 0xca656349efa15f9eaff70ad0fb385974690c4f66

Private Keys

(0) 39ae40325da1a15ee8b726e091ed36f65cd1421118d468d73f28da3f0e3da8ad
(1) 1119f02b97540a17640afa07f7452989e4ee7281a97b5d3ba55fb02078042a6c

like these...

I can't find anything in keystore folder for these accounts.

I want to IMPORT All these Accounts in METAMASK


texts: Uniswap: Fail with error ‘Dai/insufficient-allowance’

texts:
I am trying to deposit kovan DAI to my smart contract by using transferFrom of the ERC20 function, but I get an Dai/insufficient-allowance.
So I tried approving it explicitly and then trying to transfer… The approval works but this the transferFrom doesn't.
Please help me. I just started with ERC 20.
Thanks in advance!
The code:
 function appDai(uint _amount) public {
    daitoken.approve(msg.sender, _amount);
 }

function depDai(uint _amount) public {
    require(daitoken.balanceOf(msg.sender) >= _amount);
    daitoken.transferFrom(msg.sender, address(this), _amount);
    emit Deposit(msg.sender, _amount);
}

and I also tried approved and increasaAllowance methods too
function incDai(uint _amount) public {
    daitoken.increaseAllowance(address(this), _amount);
}

function incDaiSend(uint _amount) public {
    daitoken.increaseAllowance(msg.sender, _amount);
}`


texts: How can an ethereum contract protect copyright/license?

texts: If I create a program or a novel, how do I prove that I am the author and how do I control copyright/license, including derivative works? I assume that I make a hash of the document and enter a record in the blockchain. But how exactly could an ethereum contract be implemented to protect my copyright/license?


texts: Getting ABI data for ERC20 tokens programatically with Web3

texts:
I am just starting to dive into Web3. I am trying to display the various ERC20 token values for a given Ethereum Address.

The pieces I need to do this are:

Token Contract Address
Token Contract ABI

Are there any programmatic ways to get the Contract ABI given a Contract Address from the blockchain?

If not, it seems fair to assume the contract ABI is constant for any Token Contract... has anyone centralized a database that can be used to interact with these ERC20 tokens programmatically?

Are you able to interact with a Token Contract at all without the full ABI? For example, based on the ERC20 standard, every contract must have balanceOf(), can we call this function given an address and no ABI?


texts: Why is eth.coinbase node based and not blockchain based?

texts:
I have tested with geth using --datadir and found that if I have more than one node created using

personal.newAccount

then the account data is not shared.

This seems confusing to me. I believed the point of the EVM was to share all the account data and hence we can interrogate any node and get the full data for that block.

It brings me to question how the account is kept and where. It clearly is not kept in a block, or a contract, so it is kept in some kind of node storage?

Has anyone details of how the account is stored and why that data is not accessible by any node without an explicit reference to the node holding the account?


texts: I have an assignment from my prof to make an ethereum exchange. Is it possible to use HD wallet to generate multiple public address for all the customers? if so, what is the easiest implementation?


texts: How to check if a mining pool runs the forking client or not? [The DAO]

texts:
As Geth and Parity forking version are out, the switch to a soft fork related to The DAO is said to happend on block 1800000 if block gas limit is below or equal to 4M. We can see global gas limit on sites like https://ethstats.net/ but they don't represent the whole Ethereum system.

But how to check a particular pool (Ethermine on which I mine is 0xEA674fdDe714fd979de3EdF0F56AA9716B898ec8) gas limit to see if it runs the client in this particular fork mode ?


texts: The Ethereum blockchain is described as containing "ommer" blocks, usually called "uncle" blocks by the general public.  What is an ommer/uncle block, and why are they needed?


texts: What is the purpose of non-mining sealer nodes in clique POA private ethereum network with respect to the clique consensus

texts:
I did setup a private POA ethereum network with 4 nodes with 3 of them mining . I went on to try a lot of combinations with some miners and sealers and reached to a conclusion that every miner hash to be a sealer otherwise it wont seal a block . However the network works fine with 3 sealers of them 2 mining and a non-mining sealer node.
My question is that how this non-mining sealer node is used in clique consensus?


texts: Is difference between light_verify and verify just DAG size?

texts:
I am looking at this doc:

https://github.com/ethereum/wiki/blob/master/Dagger-Hashimoto.md

And from what I gather, light_verify uses quick_hashimoto which calculates the DAG using a recursive algorithm and caching all the values along the way. Is quick_hashimoto considered "light" because you just have to calculate at most m + (mix % 2**64) % m nodes (minimum m nodes) vs having to generate the whole DAG?


texts: Contract function to decrypt a value after a certain date

texts:
I want to create a contract function that will decrypt and return a value given a password (or key) - but only after a certain date.

e.g. outside the blockchain I encrypt the value "ABCDEF" and store the encrypted result "1fa329" in a contract on the blockchain:

storeEncryptedValue("1fa329')

After the year 2020 anyone can call a function providing they know the password (key) like this:

revealTheValue('my-password')

This function will throw if the date is not > 2020-01-01.

Does solidity have a decrypt function?

Obviously once somebody has called revealTheValue(...) function the password is visible to the world, but that is not a concern in this use case.


texts: How to tell where an ENS domain name resolves to in etherscan?

texts:
When someone buys an ENS domain name (.eth), they have the option to resolve the domain to a wallet address in order to receive crypto, as well as resolve the domain to forward to a website.

https://etherscan.io/token/0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85?a=68905179442367361887488322133713918484789628715760259299554289913151757812251

In Etherscan, how can I tell that the registrant of the domain above has chosen to resolve their ENS domain to a wallet and/or website? Where do I go on that page to find those details


texts:
I'm writing a pre-minted ERC20 token contract derived from openzeppelin-solidity like:

pragma solidity >=0.4.24;

import "../node_modules/openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";
import "../node_modules/openzeppelin-solidity/contracts/token/ERC20/ERC20Detailed.sol";

contract SampleToken is ERC20Detailed, ERC20 {
  constructor(string memory _name, string memory _symbol, uint8 _decimals, uint _initialSupply)
    ERC20Detailed(_name, _symbol, _decimals) public {
    require(_initialSupply > 0, "INITIAL_SUPPLY has to be greater than 0");
    _mint(msg.sender, _initialSupply);
  }
}

I'm deploying it to the Rinkeby network, using truffle. My account has enough balance.

After running truffle deploy --reset --network rinkeby, I get:

   Replacing 'SampleToken'
   -----------------------
   > transaction hash:    0x126c13b5fc64dbd90db60dfff754a7a6825add3138e69e1ab27ac90a8fe166bf
   > Blocks: 0            Seconds: 9
   > contract address:    0x557858779C6C5240B05005bCbd60dD06fBcCF479
   > block number:        4377271
   > block timestamp:     1557788535
   > account:             0xceB4c079Dd21494E0bc99DA732EAdf220b727389
   > balance:             7.326879674
   > gas used:            1111289
   > gas price:           20 gwei
   > value sent:          0 ETH
   > total cost:          0.02222578 ETH

   Pausing for 2 confirmations...
   ------------------------------
   > confirmation number: 1 (block: 4377272)
   > confirmation number: 2 (block: 4377273)

   > Saving migration to chain.
   > Saving artifacts
   -------------------------------------
   > Total cost:          0.02222578 ETH

If I go to EtherScan, I can see the contract was deployed, the event of the first coinbase transaction was generated:

However, after adding the token to my Metamask Wallet, it still shows my balance as zero:

I've also tried to change the visibility of _balances and _totalSupply in  openzeppelin-solidity/contracts/token/ERC20/ERC20.sol and assign them directly from my contract, but the behavior I saw was still the same.


texts: In Ethereum what is read tx per second ( not write tx per second )

texts: It is every where documented that how much tx per second ethereum can do (which is for writing) , but I want to know what is possible read tx per second ? and if difference then why


texts: What is Swarm and what is it used for?  And what is Swarm's relationship with Whisper?


texts: How to recover EtherLi Multi-Sig Wallet without SMS?

texts:
For any reason is phone number in my EtherLi Multi-sig wallet settings wrong.

I don't receive the 2nd verification code by SMS due to the wrong digit in my phone number. Please let me know how to update my profile in Ether.Li Multi-sig wallet or how to transfer my ETH.


texts:
Like how we import oraclize in Solidity (as follows), is there some way to import tensorflow libraries for machine learning purpose?

import "github.com/oraclize/ethereum-api/oraclizeAPI.sol";


texts: Pending Ethereum transaction on smartrix

texts: Good evening. I registered on smatrix and I upgraded my first level 40hrs ago and my Eth was deducted. Yesterday, I checked my account ....then I saw 0payment sent but my 0.02 ethereum was deducted . Dnt knw wats wrong?


texts: Using Web3 v1.0.0 in a web application: issue with XHR2

texts:
I am building a simple Vue-based web application which uses Web3 v1.0.0 (the latest version available). Currently, I'm struggling to make something as simple as the following run:

import Web3 from 'web3'

const api = new Web3(new Web3.providers.HttpProvider('...', 2000))

const batch = new api.eth.BatchRequest()
batch.add(api.eth.getBalance.request('...', 'latest', (err, balance) => console.log({ err, balance })))

batch.execute()

This snippet runs fine in the NodeJS environemnt, but throws an error in browser:

xml-http-request.js?37da:91 Uncaught TypeError: Cannot read property 'node' of undefined

A brief investigation gave me the following:

Web3 HTTP provider runs requests using XMLHttpRequest from the xhr2-cookies library
The XMLHttpRequest constructor has the following line in its constructor:

_this._userAgent = "Mozilla/5.0 (" + os.type() + " " + os.arch() + ") node.js/" + process.versions.node + " v8/" + process.versions.v8;

Apparently, referencing process in the browser environment maks little sense and eventually causes the application to crash.

I've also checked the dist/web3.js in the web3 repo: it seems to reference xhr2-cookies the very same way.

As a result, I have no idea how is this supposed to work in browser. Any ideas?


texts: Different kind of Wallet/Addresses/Accounts

texts:
I have a few questions regarding crypto wallet accounts and currencies.
Recently I came across https://www.bitaddress.org/. This website generates bitcoin wallets. Now, when I tried to verify that account created by this website, I searched for a bitcoin address validator and in that, I used that address given by that website and it worked.
Just out of curiosity, I went to https://etherscan.io and tried to check that address but it didn't work.
I want to know

Are Bitcoin wallet and Ethereum wallet are created differently? if yes, What is the process?
Using a bitcoin wallet, can I receive Ethereum ... or other cryptocurrencies?
Is there something all a common wallet generator that can work with all kind of cryptocurrencies.
Can anyone explain the process involved in creating Ethereum wallet and Bitcoin wallet.


texts:
I just have no means of testing it out myself right now.

contract A() {
     function() {
          throw;
     }
}
contract B is A() {}


texts:
I was exploring sidechains and two-way pegs but didn't clearly understand one point: How does a sidechain know if funds are locked in the main chain?

To my understanding blockchains are "isolated" meaning they can't know what's happening outside without a transaction. It's the reason we need oracles. So when someone locks some ether in the Ethereum mainchain, how does the sidechain know the funds are indeed locked?

So far I've seen Simple Payment Verification SPV proofs and federations. SPV proofs would show you actually made the payment but it can't be made on chain. Meaning, again, the sidechain VM has no access to main chain and without the block headers of the main chain the SPV proof is not complete.

Is how this happens is by syncing two chains separately and observing them when fund lock happens and publishing the transaction accordingly to the other chain. This would be off chain and I guess is the idea behind a federation?

I would be thankful if someone can clarify these points. Thanks


texts: Why does the `DoCall` function use the first account by default?

texts:
In this line,

    // Set sender address or use a default if none specified
    var addr common.Address
    if args.From == nil {
        if wallets := b.AccountManager().Wallets(); len(wallets) > 0 {
            if accounts := wallets[0].Accounts(); len(accounts) > 0 {
                addr = accounts[0].Address
            }
        }
    } else {
        addr = *args.From
    }

if the from is nil, geth uses the first account of the first wallet.

What if I don't have any wallet/account in account manager?
Will it surprise the user?
Why is the from parameter optional?


texts:
I'd like to access geth.ipc file in order to connect geth via IPC.
I've got an advice and it suggested me to access geth.ipc, but I've not found it on my mac.
Could you tell me when that file is produced? Btw, I installed go-ethereum by git as follows.

git clone https://github.com/ethereum/go-ethereum

The image shows my Ethereum directory. Doesn't it contain geth.ipc right?


texts:
This question have just been published in StackOverflow as well, but you might be able to guide me on a better direction:

I'm looking for the most valid path to download and keep downloading every single smart contract on the ethereum network.

As I've been programming for a few years, I've been thinking about using cURL to make this. But I'm aware this is probably very outdated as it should be possible to be done somehow using the blockchain...

I'm willing to store all the contracts in a traditional MySQL database, in order to run multiple security audits on them. Is there any other database engine compatible with PHP that you would recommend to store them?

How would you approach this?


texts: Using modifier on view function works locally, but fails on Ropsten

texts:
Hey I'm trying to make it inconvenient to view stored data in a contract, but it seems that the function is returning null values when I add a modifier.
The modifier makes sure someone is approved before viewing the data using the getter.
I've made sure the data is getting stored and the person is indeed approved.

Example:

struct StoredData {
    int a;
    uint256 b;
    uint256 c;
    uint256 d;
    uint256 e;
    uint256 f;
}

mapping (uint256 => StoredData) private data;
mapping (address => bool) public allowedToView;

modifier onlyViewer() {
  require(allowedToView[msg.sender]);
  _;
}

function getStoredData(_index) onlyViewer constant public
returns (int, uint256, uint256, uint256, uint256, uint256)
   {
     return (data[_index].a, data[_index].b, data[_index].c, data[_index].d, data[_index].e, data[_index].f);
   }


texts: What is the best practice when storing a custodial wallet with node.js and mysql?

texts:
I'm using Adonis.js v4 (it's node.js) and mysql (on RDS) as my database.
I need to create an ethereum wallet for each of my user's and I need to make transaction on their behalf with their wallet (they don't even need to know they have one).
The strategy I would like to go with is to have an external db (let's say aws secret manager) where I store the key that I will use to hash/encrypt the user's private key. So this way even if someone gets my db and a key they won't have access to all wallets but to only one wallet.
Also, should I encrypt or hash the private key?


texts: Problem reading events, with web3 v1.0 beta 36 and infura

texts:
I am trying to read events from a contract already deployed on the blockchain. The event might return uint which is has the indexed property.

First I was using web3 from metamask and worked normally, but I want to use infura now, independently if the user has metamask or not. So I created the websocket but when I try to read I get this error: Error: Returned values aren't valid, did it run Out of Gas.

Searching on the web some people say is because the returned value from the event has the property indexed, I could change the contract, but do not feel like I should.

Has anyone else came across this type of error?

I am using vue... The way I am calling the event is:

getADN() {
  let ADNCreated = this.$store.state.contractADN().getPastEvents('allEvents', {
      fromBlock:0,
      toBlock: 'latest'
  }, function(error, events){ console.log("error:", error); }).then(function(events){
    console.log(events) // same results as the optional callback above
  });

As you can see there is nothing much special about it.


texts: How can I identify that transaction is ERC20 token creation contract?

texts:
I think I can identify it by parsing input data of then transaction then checking it declares the required functions and events. Are there any good ways or tools?

Update 1

Sebastian gave me the answer.

I can identify whether a transaction is for creating token or not by the following.

block := ethrpc.EthGetBlockByNumber(blockNumber)
for key, value := range block.Transactions {
    if value.Input != "0x" && strings.Contains(value.Input, "18160ddd") && strings.Contains(value.Input, "70a08231") && strings.Contains(value.Input, "dd62ed3e") && strings.Contains(value.Input, "a9059cbb") && strings.Contains(value.Input, "095ea7b3") && strings.Contains(value.Input, "23b872dd") {
        fmt.Println("key:", key, " value.Hash:", value.Hash)
    }
}

However the above check is not enough. Etherscan says it is Not ERC-20 Compliant for some cases. I guess it is due to lack of information like token name and symbol.

e.g.
https://etherscan.io/tokens?q=0x1e025340d6f75a2a4ef81139049cfbf976782eeb

Now I'm trying to find out whether transaction is fully valid ERC20 Token standard. Do you have any good idea?

Update 2

I think I need to know how the input data is created. I will try to understand getData method of web3.eth.contract. well, I have a long way to go.

var ST = web3.eth.contract(HumanStandardToken.abi);
var creation_data = ST.new.getData(args[0], args[1], args[2], args[3], {from: addr, data: "0x" + HumanStandardToken.prototype.binary, gasPrice: 50000000000, gas: 3100000});

https://github.com/ConsenSys/Token-Factory/search?utf8=%E2%9C%93&q=ST&type=


texts: How do online wallets store users' tokens?

texts:
Online wallets like Coinbase hold private keys for users. How does it work internally? Does Coinbase generate a private key/address for each of its millions of users and thus keep track of millions of private keys?

Or does it only store all funds in a few keys/addresses and store users' balances in a database? If this is the case, how come every user has a unique address?


texts:
I have two contract. I call function placeBid in other contract and i have warning gas estimation. help me. thanks. Can i call function which use gas  in loop through other contract? How i can get around this warning(gas estimate)?

Auction contract:

function placeBid(uint amount)  public notOwner returns(bool) {
    require(auctionState == State.Running);
    require(count>=amount);
    trc20.transferFrom(msg.sender, address(this), startPrice);
    return true;
}

other contract:

function placeBidBox(address[] memory _addresses, uint[] memory _amounts)public{

   for(uint i=0; i<_addresses.length; i++){
       a = Auction(address(_addresses[i]));
       a.placeBid(_amounts[i]);
   }

}

update:
i resolved this problem with address of sender. i need send address of sender in arguments of function such as i call other contract and contract dont know sender.


texts: Create PSS clients connection for each user?

texts:
Good morning! I am looking at the PSS API checking the erebos/pss.js example. I am slightly confused with the follow:

const alice = new PssAPI(createRPC('ws://127.0.0.1:8501'))
const bob = new PssAPI(createRPC('ws://127.0.0.1:8502'))

Do we have to create a new connection/port for each user? Having as reference a simple chat with n users. How would this even work?

Thank you!


texts: In a private chain of one-hundred miners where we assume all miners have comparable computing power to mine with is there any way to guarantee each miner mines an approximately equal number of blocks per day?


texts: Unable to send ether to a function of an imported contract

texts:
pragma solidity 0.5.16;

contract receive{
function dep() external payable{
    //Processing the received ether
    }
}
function fallback() external payable{}

pragma solidity 0.5.16;

import "./receive.sol";

contract send {
    receive rc = receive (address(0x0DCd2F752394c41875e259e00bb44fd505297caF)); //Address of deployed receive contract
    function snd(uint256 amount) public payable {
        rc.dep.transfer(amount);
    }
    function fallback() external payable{}
}

I get the following error on send.sol:8:9 while compiling on remix.

TypeError: Member "transfer" not found or not visible after argument dependant lookup in function () payable external.
rc.dep.transfer(amount);
^----------------------^

I do not know how to convert address of rc to address payable.
I also tried rc.dep.value(amount)() but it sends only data not wei as I want to. Any help would be much appreciated!


texts: Do I have control over my account or not?

texts:
I am pretty new to this ethereum thing so here's my question:

I have created a wallet with a password. Afterwards I formatted the PC and installed an utility that mines through nanopool. My question is: Did I have to backup something else than just the wallet's number and the initial password?

Thanks!


texts: How can I create a single function which on its own, will reward an address with minted tokens if a certain time condition is met? Every time I try, I can only get it to work if I create two functions and use pull pattern; to pull out the minted tokens to the subject address of my choice.


texts: Installation of openzeppelin/contracts Library

texts:
I have created a node.js project, within which I have created a truffle directory and initialised its project. I have installed the openzeppelin (npm install @openzeppelin/contracts) library in this truffle project directory, but nothing appears to have been installed, although I did not received any error during the install process. The import statement in my project displays the error hereafter:
import "@openzeppelin/contracts/token/ERC721/ERC721Full.sol";

Source "@openzeppelin/contracts/token/ERC721/ERC721Full.sol" not found: File import callback not supported

Thank you. J


texts: Consensus for Ethereum blocks and code execution

texts:
During consensus, if two miners mine two different blocks around the same time, then they will broadcast to the network those two different blocks after they have executed the transactions locally and possibly updated their local states.

One of the blocks will end up being in the longest blockchain, so the other block that did not end up in that chain may have updated its owner node's local states. How does that node "undo" the transactions to reset its local states?


texts: How payments to multiple ethereum public address can be routed to single private keys?

texts:
I'm using coinbase commerce for accepting ethereum payments. Each time the user opens the link (for example this), they are asked for payment with different ethereum address. I made a mock payment of small amount acting as a 2 different payer (this & this). Upon payment got mined on ethereum blockchain, it got reflected in my coinbase commerce account.

Subsequently, I imported the 12 key phase from coinbase commerce account to JAXX wallet and both the payments are reflected in the wallet despite totally different public address in wallet itself. Now, if I visit my JAXX wallet ethereum address etherscan page (link), there's no payment against this address.

Ques) How is it possible to pay to some other address and it got credited to different ethereum address and what mechanism does coinbase commerce is using to accept payment with new ethereum address each time?


texts: All gas consumed when deploying contract

texts:
When deploying a contract, my transaction fails (flag status set to 0) and all gas is marked as used. What could be the possible reasons?

Any help appreciated

Edit with the solidity code in question (which is a very simple token contract) :

pragma solidity ^0.4.24;

contract MinimumToken {
    // Fields
    mapping(address => uint256) balanceOf;
    uint256 total;
    address[] participants;

    // Constructor
    constructor (address from, uint256 _total) public {
        total = _total;
        balanceOf[from] = total;
    }

    // Public functions
    function transferFrom (address from, address to, uint256 amount) public {
        require(!(to == address(0)), "error");
        require(!(from == to), "error");
        require(amount <= balanceOf[from], "error");

        balanceOf[from] = balanceOf[from] - amount;
        balanceOf[to] = balanceOf[to] + amount;

    }
}


texts: How to configure parity to work with the ETC chain?

texts: I have some ETC/DAO-C funds that I want to claim, so I'm interested in running a parity node to do this. How can I configure parity to follow the ETC chain?


texts: How to calcualate Ethereum transaction fee

texts:
I have got 1 Ether in a account, which I would like to empty the account by sending to some other account. May I know the calculation that how much have to be subtracted from 1 ether and send to some other account.

Note: this calculation should work for any no of ether to be transferred


texts: Will payable modifier throw if no ether is sent to it?

texts: Should I add a check to make sure Ether was sent along with the transaction or is that redundant?


texts: etherscan api token name and symbol not shown,is this bug for etherscan?

texts:
http://api.etherscan.io/api?module=account&action=tokentx&address=0x4e83362442b8d1bec281594cea3050c8eb01311c&startblock=0&endblock=999999999&sort=asc&apikey=YourApiKeyToken

I am test etherscan for getting token transactions, it shows up but the token name and token symbol show empty, and some token the token name and symbol shows but some not, all created long time ago. Is this a bug? Thanks


texts: Monitoring failing ethereum transactions sent to a specific smart contract

texts:
What is the recommended way to monitor failed ethereum transactions sent to a specific smart contract?

Considering that:
a) Events are not emmitted when a transaction fails
b) I do not want to include conditions in my smart contract to handle failed transaction. I just want to include some "require"s that can cause a failed transaction.
c) I do not have the hashes of failed transactions
d) I would love a better way than look for all transactions in the blockchain


texts: If I set private blockchain, will the dapp be private only?

texts: I have an ethereum private blockchain, and I need to build a web application, in which the content of blocks in private blockchain would be visible from anywhere after logging in on the web page. Is it possible?


texts:
This is some function in some contract. Using this type of function like transfer and transferFrom in the DAO contract， use can transfer their tokens to another account or contract.
But how can ethereum recognize this type of transfer? Does it convert token transfer to ether transfer or someting else.

How does this type of transfer code be compiled and how does EVM handle this.

How does this type of transfer differ from the normal ether transfer?


texts: Mining one gas costly transaction yourself due to lowered gas limits

texts:
Giving the current Ethereum network circumstances with transaction spam, a lot of miners have decreased their transaction upper gas limit. However this makes deploying some more complex contracts, like multisig wallets (example), impossible.

If one would buy mining capacity from miners or Amazon EC2 high performance computation instances, how one could tell geth or parity to mine one particular transaction?


texts:
I'm a bit puzzled about the ethereum.org/token example which states further down in the advanced examples that it can be coupled to proof-of-work. I really like the idea of mining a token. The example looks something like this:

function giveBlockReward() {
  balanceOf[block.coinbase] += 1;
}

Now my question is, this looks like a honeypot for malicious inflation. Isn't it possible to execute giveBlockReward() multiple times per block? Would a simple mechanism to make sanity checks on blocknumber be sufficient to make this possible?


texts: Parity chain specification - use remote file?

texts:
When using Parity with a private blockchain, you type:

$ parity --chain /path/to/chainspec.json

I wonder if there is a way to make this chain spec remote?  Could be useful when using multiple nodes.  Something like:

$ parity --chain http://aws.instance.com/chainspec.json


texts: Is there a way to differentiate between an account on the main-net and the test-net?

texts: Given a particular ethereum account address, can we find out if it is from the main-net or the test-net?


texts: Gas required exceeds allowance truffle migrate

texts:
Hi i am trying to work truffle migrate and firstly it start to Migration.sol and then Election.sol. When start to deploy ELection.sol it throws following error. What should i write gas:270000 instead of this value?Because i tried a lot of number like 470000 or 100000, 300000 doesnt work. Should i increase number or decrease?

truffle migrate --reset --network rinkeby

"Election" received a generic error from Geth that
can be caused by hitting revert in a contract constructor or running out of gas.
   * Returned error: gas required exceeds allowance (2700000) or always failing transaction.

Election.sol

     pragma solidity 0.5.8;

     contract Election {
      // Model a Candidate
          struct Candidate {
          uint id;
          string name;
          uint voteCount;
     }

// Read/write Candidates
mapping(uint => Candidate) public candidates;
// Store Candidates Count
uint public candidatesCount;

 constructor() public {
    addCandidate("Candidate 1");
    addCandidate("Candidate 2");
}

function addCandidate (string  memory _name) private {
    candidatesCount ++;
    candidates[candidatesCount] = Candidate(candidatesCount, _name, 0);
}
 }

Migrations.sol

   pragma solidity >=0.4.21 <0.6.0;

   contract Migrations {
   address public owner;
   uint public last_completed_migration;

   constructor() public {
     owner = msg.sender;
   }

   modifier restricted() {
     if (msg.sender == owner) _;
   }

   function setCompleted(uint completed) public restricted {
     last_completed_migration = completed;
   }

   function upgrade(address new_address) public restricted {
     Migrations upgraded = Migrations(new_address);
     upgraded.setCompleted(last_completed_migration);
   }
  }

Genesis.file

   {
"config": {
    "chainId": 88888,
    "homesteadBlock": 0,
    "eip155Block": 0,
    "eip158Block": 0
},
"coinbase" : "0x0000000000000000000000000000000000000000",
"difficulty" : "0x1",
"extraData" : "0x00",
"gasLimit" : "0x47e7c5",
"nonce" : "0x0000000000000042",
"timestamp" : "0x00",
"alloc" :{
    "0x560ae6e63f0e79c9027a590900291399cc954f00": {"balance": "0xffffffffffffffffffffffff"}
}

}

Output:

   1_initial_migration.js
   ======================

   Replacing 'Migrations'
   .......
   then

   2_deploy_contracts.js
   =====================

   Replacing 'Election'
   Error: Error: Error:  *** Deployment Failed ***

truffle.config

   rinkeby: {
  host: "127.0.0.1",     // Localhost (default: none)
  port: 8545,            // Standard Ethereum port (default: none)
  network_id: "4",       // Any network (default: none) (Rinkeby's id
   is given)
  from:"address",
  gas: 3000000
 }


texts:
I have tried to use web3.js with my web UI but when I run my web UI I get the below error.

I don't know what is the problem.

Edit

I have tried the below command while starting Geth.

geth --rinkeby --syncmode "fast" --rpc --rpcapi db,eth,net,web3,personal --cache=2048  --rpcport 8545 --rpcaddr 127.0.0.1 --rpccorsdomain "*"


texts: How does one enable and use SWARM demon & Whisper messaging functionality provided by Geth 1.5?

texts:
The release notes for Geth 1.5 states that:

  The Swarm daemon (bzzd) and associated helper tools are included and
  somewhat functional. Whisper v5 PoC code is included in the
  repository, but not enabled yet.

So how do you enable and use these features?


texts: How to get events emitted by a transaction with web3.js

texts:
I'm writing a user interface in Javascript and I'm using the web3.js library.

I have the transaction hash of a confirmed transaction. I would like to get an array of all events emitted by that transaction.

I don't necessarily need all events, just the ones emitted by my smart contract by the execution of that transaction.

Can this be done using web3.js? What's a good way to accomplish this?


texts:
I'm getting this warning:

 Warning: Using "years" as a unit denomination is deprecated.
    uint date = now + 1 years;

Any idea how to fix it?


texts: getTransactionReceipt() in JavaScriptVM Environment

texts:
Is it possible to get a transaction receipt using Remix in JavascriptVM Environment?
If it is how can i do that?
Thanks in advance


texts: Contract call does not works through web3

texts:
I have contract method transferFrom that failed when I calling it the site's from backend, but in the same time it works from Remix.

Both calls are performed through Metamask. Initially I thought that it could be related to gas amount but when I called method from Remix and specified gas amount that was used for failed transaction - it works, so I  have no idea what is the problem.

Here is failed transaction that called using this code:

Eth.contract._approve(toAddress, fromAddress, amount)
.then(async result => {
  const tx = await Eth.contract.transferFrom.sendTransaction(fromAddress, toAddress, amount);

  return res.json({success: true, data: {from: fromAddress, to: toAddress, amount: amount, tx: tx}});
})
.catch(error => {
  return res.boom.badImplementation('Unable to approve transfer ' + amount + ' tokens to the address ' + fromAddress, {success: false});
});

_approve is special function in the contract that accessible only for contract owner and has 3 parameters insteand of 2 required by ERC20 interface.

And here is working transaction that is called from Remix with the same contract loaded.


texts: Offline create accounts and sign transactions

texts:
I have a question about Ethereum client-side, maybe someone could give a hint...

It's about building a DApp, we need a web client capable of creating offline a private key and a public key, and also send signed transactions to an Ethereum node.

After investigating for a while we came to the conclusion this is possible through the web3.js library (and others like ethereumjs), but it implies using nodejs and browserfy, right? The question is:

Is there any other simpler solution, such as using a simple js file?

Thx in advance!


texts: How return variable from simple smart contract

texts:
Hello I'm trying to make my first and simple test for get a variable from my first contract:

Truffle version:  Truffle v4.1.14
Node: 8.12.0

pragma solidity ^0.4.4;

contract SimpleContract {
  bytes32  hello = "hello";
  function getHello() public view returns (bytes32){
    return hello;
  }
}

And I did a simple test like:

pragma solidity ^0.4.4;

import "truffle/Assert.sol";
import "truffle/DeployedAddresses.sol";

import "../contracts/SimpleContract.sol";

contract TestSimpleContract {

  function testGetHello() public {
    SimpleContract w = SimpleContract(DeployedAddresses.SimpleContract());
    bytes32  expected = "hello";
    bytes32  hello = w.getHello();

    Assert.equal(hello,expected, "SHould hello!");
  }
}

And I have a Migrations:

var Simple = artifacts.require("SimpleContract");

module.exports = function(deployer) {
  deployer.deploy(Simple);
};

And I have this truffle config

module.exports = {
   networks: {
     development: {
      host: "localhost",
      port: 7545,
      network_id: "5777"
    }
   }
 };

But I can't understand and how figure out why it return this error:

  1) TestSimpleContract
         testGetHello:
       Error: VM Exception while processing transaction: revert
        at Object.InvalidResponse (C:\Users\Lorenzo\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\web3\lib\web3\errors.js:38:1)
        at C:\Users\Lorenzo\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\web3\lib\web3\requestmanager.js:86:1
        at C:\Users\Lorenzo\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\truffle-provider\wrapper.js:134:1
        at XMLHttpRequest.request.onreadystatechange (C:\Users\Lorenzo\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\web3\lib\web3\httpprovider.js:128:1)
        at XMLHttpRequestEventTarget.dispatchEvent (C:\Users\Lorenzo\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\xhr2\lib\xhr2.js:64:1)
        at XMLHttpRequest._setReadyState (C:\Users\Lorenzo\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\xhr2\lib\xhr2.js:354:1)
        at XMLHttpRequest._onHttpResponseEnd (C:\Users\Lorenzo\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\xhr2\lib\xhr2.js:509:1)
        at IncomingMessage. (C:\Users\Lorenzo\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\xhr2\lib\xhr2.js:469:1)
        at endReadableNT (_stream_readable.js:1064:12)
        at _combinedTickCallback (internal/process/next_tick.js:139:11)
        at process._tickCallback (internal/process/next_tick.js:181:9)