texts: cpp-ethereum cmake error with json and curl

texts:
I got the following error when I do cmake on cpp-ethereum.

I have libjson-rpc-cpp, curl. Even then I am getting the following error:

-- Found jsoncpp: /usr/lib/x86_64-linux-gnu/libjsoncpp.so

-- JsonCpp headers: /usr/include/jsoncpp

-- JsonCpp lib   : /usr/lib/x86_64-linux-gnu/libjsoncpp.so

CMake Error at cmake/Findjson_rpc_cpp.cmake:105 (string):

  string sub-command REGEX, mode REPLACE needs at least 6 arguments total to
  command.

Call Stack (most recent call first):

  cmake/UseJsonRpc.cmake:4 (find_package)

  cmake/EthDependencies.cmake:203 (eth_apply)

  eth/CMakeLists.txt:7 (eth_use)

CMake Error at cmake/Findjson_rpc_cpp.cmake:106 (string):

  string sub-command REGEX, mode REPLACE needs at least 6 arguments total to
  command.

Call Stack (most recent call first):

  cmake/UseJsonRpc.cmake:4 (find_package)

  cmake/EthDependencies.cmake:203 (eth_apply)

  eth/CMakeLists.txt:7 (eth_use)

CMake Error at cmake/Findjson_rpc_cpp.cmake:107 (string):

  string sub-command REGEX, mode REPLACE needs at least 6 arguments total to
  command.

Call Stack (most recent call first):

  cmake/UseJsonRpc.cmake:4 (find_package)

  cmake/EthDependencies.cmake:203 (eth_apply)

  eth/CMakeLists.txt:7 (eth_use)

-- Could NOT find json_rpc_cpp: Found unsuitable version "..", but required is at least "0.4" (found /usr/local/include)

-- json-rpc-cpp headers: /usr/local/include

-- json-rpc-cpp lib   : /usr/local/lib/libjsonrpccpp-common.so;/usr/local/lib/libjsonrpccpp-server.so;/usr/local/lib/libjsonrpccpp-client.so

-- Found CURL: /usr/lib/x86_64-linux-gnu/libcurl.so
-- curl headers: /usr/include

-- curl lib   : /usr/lib/x86_64-linux-gnu/libcurl.so

CMake Error at /home/iiita/cmake-3.2.2/Modules/FindBoost.cmake:1182 (message):
  Unable to find the requested Boost libraries.

  Unable to find the Boost header files.  Please set BOOST_ROOT to the root
  directory containing Boost or BOOST_INCLUDEDIR to the directory containing
  Boost's headers.

Call Stack (most recent call first):
  libdevcore/CMakeLists.txt:9 (find_package)

-- Could NOT find leveldb (missing:  LEVELDB_LIBRARY LEVELDB_INCLUDE_DIR)

CMake Error at cmake/FindPackageHandleStandardArgs.cmake:138 (message):
  Could NOT find CryptoPP (missing: CRYPTOPP_INCLUDE_DIR CRYPTOPP_LIBRARY)

  (Required is at least version "5.6.2")
Call Stack (most recent call first):
  cmake/FindPackageHandleStandardArgs.cmake:374 (_FPHSA_FAILURE_MESSAGE)

  cmake/FindCryptoPP.cmake:107 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)

  cmake/UseCryptopp.cmake:2 (find_package)

  cmake/EthDependencies.cmake:203 (eth_apply)

  libdevcrypto/CMakeLists.txt:8 (eth_use)

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.

Please set them or make sure they are set and tested correctly in the CMake files:

/home/iiita/cpp-ethereum/libdevcore/Boost_INCLUDE_DIR
   used as include directory in directory /home/iiita/cpp-ethereum/libdevcore
/home/iiita/cpp-ethereum/libdevcore/LEVELDB_INCLUDE_DIR

   used as include directory in directory /home/iiita/cpp-ethereum/libdevcore
LEVELDB_LIBRARY (ADVANCED)

    linked by target "devcore" in directory /home/iiita/cpp-ethereum/libdevcore

-- Configuring incomplete, errors occurred!
See also "/home/iiita/cpp-ethereum/build/CMakeFiles/CMakeOutput.log".


texts: Is there a way in web3 to get a transaction by address and nonce?

texts:
I know I can get the current nonce using eth.getTransactionCount(address), but I'm looking for something like eth.getTransaction(address, nonce) (for arbitrary nonce), similarly to eth.getTransactionFromBlock(blockHashOrNumber, index).

An alternative would be to get all (perhaps just recent) transactions that originated from an address.


texts: Does the EVM support garbage collection (reclaim unused memory)?

texts:
The EVM can reclaim storage by using the ‘delete’ keyword in Solidity.

However, memory expands when more is allocated by the ‘new’ keyword, right? Are local variables also stored in memory?

When does memory shrinks, so that memory doesn’t keep expanding?


texts: Error: VM Exception while processing transaction: revert: When trying to migrate a truffles initialised contract?

texts:
I'm trying to migrate/deploy a multi-signature contract through truffles, I am receiving

  "Error: VM Exception while processing transaction: revert" when the
  contract starts to migrate/deploy.

The contract code is here https://github.com/conwise18/Multi-sig-Test/blob/master/Multi-Sig-1.sol

I have already set the gas price and limit within the config.js folder.

thanks in advance !!!


texts: Python filtering the type of event in contact

texts:
I am building a python app that is listening to events from a contract. The issue is that I have different events in only one contract, let me explain.
Currently my code is :
def handle_event(event):
    receipt = w3.eth.waitForTransactionReceipt(event['transactionHash'])
    result_event1 = contract.events._Event1().processReceipt(receipt)
    result_event2 = contract.events._Event2().processReceipt(receipt)

    if len(result_event1) == 1:
        event_args1 = result_event1[0]['args']

    if len(result_event2) == 1:
        event_args2 = result_event2[0]['args']

def log_loop(event_filter, poll_interval):
    while True:
        for event in event_filter.get_new_entries():
            handle_event(event)
            time.sleep(poll_interval)

def main():
    block_filter = w3.eth.filter({'fromBlock': 'latest', 'address': address})
    log_loop(block_filter, 2)

To know which event was run, I need to check for each event if I have any result.
Is there a way to get directly the event that triggers all my code, and so have only 1 line to do that? Because if I need to do if/else for each event, it can be really long if I have 10-20 or more events.
Thanks.


texts: How make Ethereum QR-code with Input Data?

texts:
how i can make QR code with address, amount, gas price and Input Data?

Is it possible?


texts:
If I want to build commercial blockchain applications, do I need to join to the main ethereum network? or I just can build ethereum private enterprise blockchain? by creating some peers?

What is the benefit to join the main network if I have to pay fees for each transaction? is it only to exchange real ethers?

And why main ethereum network is more more protected and secured?


texts: How to convert an bytes to address in Solidity?

texts: How to convert bytes or string (eg: 0xf2bd5de8b57ebfc45dcee97524a7a08fccc80aef) to address in solidity?


texts: Read value from other contract, update and write it again

texts:
I developed and debugged this function in Remix but when I deploy the contract and execute this function it will either run out of gas or does not run at all. This is usually because Parity thinks it takes 21,000 gas to run the function.

function verifyPass(address _owner) {
  require(_owner != 0x0);
  var (,c,h,) = Storage(usedStorage).passByOwner(_owner);
  uint _country = uint(c);

  // An embassy can only verify passports of its own country
  require(_country != 0 && _country == embassiesOfCountry[msg.sender]);

  Storage(usedStorage).updatePassport(_owner, _country, bytes32(h), true);
}

Do you know why it fails? Or do you have a better idea to do the process of reading a value from another contract, updating values and posting it to another contract?


texts:
I have used in burn() function of NFT Contract.
 function burn(address to, uint256 tokenId) external {
    require(_exists(tokenId), "Contract: operator query for nonexistent token");

    for (uint256 i = 0; i < _tokenIds.length; i ++) {
        if (_tokenIds[i] == tokenId) {
            _tokenIds[i] = _tokenIds[_tokenIds.length - 1];
            _tokenIds.pop();
        }
    }

    // Clear metadata (if any)
    delete _Info[tokenId];
    delete _tokenOwnersMap[tokenId];
    delete _tokenApprovalsMap[tokenId];

    emit Burn(to, tokenId);
}

According to some resources on internet, loops and use of delete cause more gas consumption, is that correct? Any other alternative for delete?


texts:
Have a problem with web3.
In the project on angular use this library. In all browsers everything is good but in ie 11 it gives an error and does not load.

Error in this line

const {keccak256, keccak256s} = __webpack_require__("../../../../web3/packages/web3-eth-accounts/node_modules/eth-lib/src/hash.js");

Can't find identifier, and crashed all app!
Error throws in IE only.
All polyfills install to angular, if I excluded this lib, project run correctly.
Thanks for any idea.


texts: Unable to interact with Smart Contract using Ethereum node Javascript console

texts:
I deployed a smart contract and to interact with that I've written Javascript.

When I use loadScript('requestor.js') in my geth console

I'm getting the following error

Line 236 in my code is

const readline = require('readline');

but when I compile readline usage example code from nodejs its working fine.

ex:

const readline = require('readline');

const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout
});

rl.question('What do you think of Node.js? ', (answer) => {
  // TODO: Log the answer in a database
  console.log(`Thank you for your valuable feedback: ${answer}`);

  rl.close();
});

I'm new to Javascript. I don't know whether readline is removed from my node version 9.11.2 or geth javascript is not supporting it?


texts: Why is there a difference between a public array and a function which returns it?

texts:
On-chain example:

pragma solidity 0.4.24;

contract MyContract {
    uint[] public array;

    constructor() public {
        array.push(1);
        array.push(2);
        array.push(3);
    }

    function getArray() public view returns(uint[]) {
        return array;
    }
}

Off-chain example:

contract("MyContract", function(accounts) {
    it("Test", async function() {
        myContract = await artifacts.require("MyContract.sol").new();
        let array = await myContract.getArray();
        let item0 = await myContract.array(0);
    });
});

As you can see, the getArray function indeed returns the array.

But when I "call" the array, I need to pass an index (in other words, the array "returns" an item).

Attempting to execute:

let array = await myContract.array();

Results with:

Invalid number of arguments to Solidity function

Why has the Solidity standard defined it this way?

Thank you!


texts: how can i translate the ethers.js "getSigner" utility to web3?

texts:
I have a web3 object but I'm working off an example that uses ethersProvider.getSigner(). Is there an equivalent (or mostly equivalent) in the web3 library?

For reference, the ethersProvider is instantiated with const ethersProvider = new ethers.providers.Web3Provider(window.web3.currentProvider);

and the signer is ethersProvider.getSigner()


texts: Account Management in Private Blockchain

texts:
I am new to Blockchain Application. I have read about the working of blockchain. Working on a POC where it requires private blockchain(Enterprise DApp).
My question is how the accounts are managed in private blockchain.
from what I understood is in private blockchain, accounts has to be created using geth or similar client in the geth node(provider node )itself as compare to public blockchain.
If the provider node has to create and manage the ethereum accounts, is this like Ethereum wallet file will be kept in geth node keystore.
Does provider has to fund these accounts as these are private blockchain accounts.
Coming to context of Android Application, my Understanding when user login or signup an account(as part of this )new Ethereum account has to be created by Provider itself and fund by transferring from default base account.

Please help me if I am wrong in my undestanding.
Tools: geth(private blockchain), truffle(smart-contract), web3j(Android)


texts: What are the security guarantees of state trie pruning?

texts:
From what I got from this post and my intuition, here is how pruning would work in Ethereum on a blockchain of length N:

the pruned client downloads all the N block headers, so that it may still calculate the proof-of-work of the chain;
the pruned client downloads the latest version of the state trie using DHT requests;
the pruned client sets a number of non-pruned blocks K, that should be low enough to save disk space, but high enough to guarantee resilience against chain reorganisations;
the pruned client downloads all the K last transaction Merkle trees;
the pruned client is now able to verify all incoming transactions, and when a new block is appended to the chain, the old Kth block is pruned (i.e. we only keep its header) and the next state trie is reconstructed.

The storage overhead would be greatly reduced with this technique, as the size s_pb of the pruned blockchain would be:
s_pb = N * s_head + s_state + K * s_trans
with s_head the size of a block header, s_state the size of a state trie and s_trans the size of a transaction Merkle tree.
Using this source, as of March 2020:
There are approximately N = 12,000,000 blocks. Each block header weighs about s_head = 500 bytes. I can't find any info on the size of the state trie, intuitively I would say that it is proportional to the number of non-zero accounts and contracts, but here I will just consider that it is equal to s_state = 10,000,000,000 bytes. I will set a conservative K = 1000. I will approximate the size of a transaction Merkle tree by the block size, which is around s_trans = 50,000 bytes. Using these figures, the size of the pruned blockchain would be around 16 GB:
s_pb = 12,000,000 * 500 + 10,000,000,000 + 1000 * 50,000
     = 6,000,000,000 + 10,000,000,000 + 50,000,000
     = 16,050,000,000

From my perspective, even a miner would be able to operate correctly without downloading the whole ledger with this technique. The only condition is that any chain reorganisation beyond the last K blocks remains almost as unlikely as a reorganisation from the genesis block. And if this condition is met, then I would say that pruned clients benefit from the same level of security as full or archive nodes. Am I correct in my reasoning?
Sorry if I made many approximations, I am new to the Ethereum ecosystem, feel free to correct me if you want.
Thank you for your help.


texts: How does Truffle know the address of contracts published via truffle migrate?

texts:
In Truffle's documentation, it says DeployedAddresses.sol is how Truffle identifies and stores the addresses of contracts published to the blockchain via truffle migrate.

How does this file work, and what does it look like? If I publish an Adoption contract, how does Truffle know that the word Adoption in truffle console refers to that contract?


texts: Geth won't sync because I cannot connect to peers

texts:
I have already explicitly allowed tcp in and out on port 30303 through windows firewall. Other people were told previously to use geth attach ipc:\\.\pipe\geth.ipc  or geth attach http://127.0.0.1:8545, and neither of those have worked for me: I just get Fatal: Failed to start the JavaScript console: api modules: Post http://127.0.0.1:8545: dial tcp 127.0.0.1:8545: connectex: No connection could be made because the target machine actively refused it.
All I want to do is full sync. When I run the geth command, wireshark says that 0 tcp packets are delivered from port 30303. What more do I need to do?


texts: How to get the POW-Hash of a specific block?

texts:
I am trying to obtain the pow-hash of a block. Is there a way of doing this easy?

Thanks in advance :)


texts:
I sent some ethereum from my Coinomi wallet to a Poloniex trading account and it has been over 8 days and it has still not been received. over 30k confirmations and steadily rising and it appears all of the gas has been used and that the transaction is stuck. At this point is there anyway of pushing the transaction through or getting my Ethereum back? Yes I sent more than the minimum required deposit (0.5 ETH).

TxHash: 0x91f238cbe405c70ac04e6328c590bf1995e741f2890afb810688fed3e91feed7

Etherscan: https://etherscan.io/tx/0x91f238cbe405c70ac04e6328c590bf1995e741f2890afb810688fed3e91feed7

Thanks :)


texts: workflow on signing a string with private key, followed by signature verification with public key

texts:
I know this question has been asked and answered, but while trying to get everything to work, I've come across some problems.  This is what I'm trying to do:

1. take a target string 'Schoolbus'
2. use JSON with geth to eth_sign it
3. obtain v,r,s of signature
4. attempt to verify with a solidity contract, need the hash of 'Schoolbus'

So here's what I got. First of all, we can't all use the same private key, so if someone can verify my work and get a gist of my problem, that would be great.

Pretending that my priv key is '0xd1ade25ccd3d550a7eb532ac759cac7be09c2719', to sign 'Schoolbus', I use

curl -X POST --data '{"jsonrpc":"2.0","method":"eth_sign","params":["0xd1ade25ccd3d550a7eb532ac759cac7be09c2719", "Schoolbus"],"id":1}'

Where I get the result

    0x2ac19db245478a06032e69cdbd2b54e648b78431d0a47bd1fbab18f79f820ba407466e37adbe9e84541cab97ab7d290f4a64a5825c876d22109f3bf813254e8601

I'm using (I might be wrong here)

v=2a
r=c19db245478a06032e69cdbd2b54e648b78431d0a47bd1fbab18f79f820ba407
s=466e37adbe9e84541cab97ab7d290f4a64a5825c876d22109f3bf813254e8601

Then I whipped up my contract, which is a variation of an answer in a related thread:

contract Auth {
    function verify( bytes32 hash, uint8 v, bytes32 r, bytes32 s) constant returns(address retAddr) {
        retAddr= ecrecover(hash, v, r, s);
    }
}

Because I never got the hash of 'Schoolbus', I tried a couple of things in web3.js (the UTF8 one confused me, I was expecting that {encoding:'hex'} version to be the correct one):

console.log('1 '+ web3.sha3(web3.toHex('Schoolbus'))); //05ab39621b81764697fcfb6ae4fcf6b023cd644721c67c13a49fbd769c75671c
console.log('2 '+ web3.sha3(web3.toHex('Schoolbus'),{encoding:'hex'}));//d030d9a04df643f62a1502b017f51c41a659268091abbd20e2de97b935724d7c
console.log('3 '+ web3.sha3('Schoolbus'));//d030d9a04df643f62a1502b017f51c41a659268091abbd20e2de97b935724d7c
console.log('4 '+  web3.sha3(  unescape(encodeURIComponent('Schoolbus'))  ) ); //to UTF8 //d030d9a04df643f62a1502b017f51c41a659268091abbd20e2de97b935724d7c
console.log('5 '+  web3.sha3(  unescape(encodeURIComponent('Schoolbus')), {encoding:'hex'} ) ); //to UTF8 //8f1cbe7efcf383ffeb1aeaf1e826c778a087153344cbeba144fbe967ad3ab11a

I ended up using this, but don't know why:

0xd030d9a04df643f62a1502b017f51c41a659268091abbd20e2de97b935724d7c

Then I called the contract:

var contDep=web3.eth.contract( [abi def] ).at( contractAddress);

console.log(
    contDep.verify('d030d9a04df643f62a1502b017f51c41a659268091abbd20e2de97b935724d7c', 2a,'c19db245478a06032e69cdbd2b54e648b78431d0a47bd1fbab18f79f820ba407', '466e37adbe9e84541cab97ab7d290f4a64a5825c876d22109f3bf813254e8601')
);

Here's my problem.  I keep getting this weird address back.  It starts with 0x, it's 20 bytes, but it doesn't have [a-f] in it:

0x3433663632613135303262303137663531633431

If I swapped r and s, I get almost the same result back.
I was wondering if someone can verify my experience, or point out what I was doing wrong.  I feel like a crazy person here.

Thanks for all your help.


texts: Sending ethereum smart contract transactions to miners

texts:
We are building a decentralized document issuance application using the ethereum blockchain. For every transaction, some gas costs deduced in the form of ether.

Is it possible to host ethereum miner and then send it to that specific miner for mining so that gas cost be reduced?


texts: I can't run truffle commands in powershell Ise

texts:
I am looking around for questions similar to mine but basically I cannot run any truffle commands in the powershell Ise ONLY. I can make it run on the node.js command line.

example:

> PS C:\Users\user\Documents\internship\Blockcerts\proof-of-existence-master>
> truffle compile truffle : The term 'truffle' is not recognized as the
> name of a cmdlet, function, script file, or operable program. Check
> the  spelling of the name, or if a path was included, verify that the
> path is correct and try again. At line:1 char:1
> + truffle compile
> + ~~~~~~~
>     + CategoryInfo          : ObjectNotFound: (truffle:String) [], CommandNotFoundException
>     + FullyQualifiedErrorId : CommandNotFoundException

I tried to follow up a similar question where the answer was to uninstall and install the following but this still occurs.


texts: Remix IDE, Stupidly simple question, function call

texts:
Trying to make a Node js script that will record a Remix errors in console. So, first, trying to call two functions.
Here, I succeed in the call for balance of contract:
  function balanceOfWETH() external view returns (uint256) {
    uint256 wethBalance = IWETH(WETH).balanceOf(address(this));
    return wethBalance;
  }

Nodejs code:
`(async () => {
  const account1 = "0x00...";

  const contractAddress = "0x0.....";

  const metadata = JSON.parse(
    await remix.call("fileManager", "getFile", "browser/artifacts/Contract.json")
  );
  const accounts = await web3.eth.getAccounts();
  console.log(accounts);

  let contract = new web3.eth.Contract(metadata.abi, contractAddress);

  let re = await contract.methods.balanceOfWETH().call({ from: account1 });
  console.log("balance_", re);

})();`

Now, trying to call transaction function. Remix usually will check if transaction will reverted before sending, so I actually don't want to send the transaction, but trying to get the same error as Remix would show when using GUI.
function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
        external
        virtual
        override
        ensure(deadline)
        returns (uint[] memory amounts)
    {
        require(path[path.length - 1] == WETH, 'UniswapV2Router: INVALID_PATH');
        amounts = UniswapV2Library.getAmountsOut(factory, amountIn, path);
        require(amounts[amounts.length - 1] >= amountOutMin, 'UniswapV2Router: INSUFFICIENT_OUTPUT_AMOUNT');
        TransferHelper.safeTransferFrom(
            path[0], msg.sender, UniswapV2Library.pairFor(factory, path[0], path[1]), amounts[0]
        );
        _swap(amounts, path, address(this));
        IWETH(WETH).withdraw(amounts[amounts.length - 1]);
        TransferHelper.safeTransferETH(to, amounts[amounts.length - 1]);
    }

Here defining variables and trying to call
(async () => {
  const account1 = "0x00...";

  const contractAddress = "0x0.....";
  const amountIn = "111";
  const amountOutMin = "222";
  path = ["0x00..", "0x01.."];
  to = "0x00...";
  deadline = "999...";
  const metadata = JSON.parse(
    await remix.call(
      "fileManager",
      "getFile",
      "browser/artifacts/Contract.json"
    )
  );
  const accounts = await web3.eth.getAccounts();
  console.log(accounts);

  let contract = new web3.eth.Contract(metadata.abi, contractAddress);

  let re = await contract.methods
    .swapExactTokensForETH( amountIn,  amountOutMin, path,  to,  deadline)
    .call({ from: account1 });
  console.log("result", re);
})();

So, here after this call no answer was received. What is the right way to call this type of function?


texts:
If use gethcommand,then the node starts to sync with Ethereum Mainnet by default.If usegeth --testnet --networkid 3 --datadir <testnetdatapath>,then the node will connect to Ropsten.

How does this connection established? What are the steps executing at that time?
Connecting to Blockchain,downloading genesis,downloading other blocks?
How this functionality is achieved?


texts: Which accounts are involved in mounting the recursive call vulnerability attacks on The DAO?

texts:
The first transaction 0x0ec3f2488a93839524add10ea229e773f6bc891b4eb4794c3337d4495263790b was initiated from account 0x969837498944ae1dc0dcac2d0c65634c88729b2d to the contract at 0xc0ee9db1a9e07ca63e4ff0d5fb6f86bf68d47b89.

The (formatted) payload of the first transaction was:

0xc4463c80
000000000000000000000000000000000000000000000000000000000000003b
000000000000000000000000b656b2a9c3b2416437a811e07466ca712f5a5b5a
000000000000000000000000f835a0247b0063c04ef22006ebe57c5f11977cc4
0000000000000000000000000000000000000000000000000000000000000009
000000000000000000000000f35e2cc8e6523d683ed44870f5b7cc785051a77d

There seems to be some accounts in the payload that are:

Account 0xb656b2a9c3b2416437a811e07466ca712f5a5b5a
Contract 0xf835a0247b0063c04ef22006ebe57c5f11977cc4
Account 0xf35e2cc8e6523d683ed44870f5b7cc785051a77d.

The destination contract for the hacked ethers is 0x304a554a310c7e546dfe434669c62820b7d83490 currently holding  3,641,694.241898506 Ether ($52,403,980.14).

In particular, which accounts used in the attack are under control of the attacker?

Some further information:

The first transaction used to mount the attack was 0x0ec3f2488a93839524add10ea229e773f6bc891b4eb4794c3337d4495263790b as listed in Is there any way to determine how long it took for the DAO attacker to deploy the attack?
Here is a .zip of the debug.traceTransaction(...) of the first of the attacker's transaction - TheDAORecursiveCallAttack-FirstTransactionDebug.txt.zip.


texts: Modifiers causing internal compilation error

texts:
My modifiers are throwing internal compilation errors: Internal compiler error: Identifier type not expected in expression context.

modifier critical {
    if (mutex) throw;
    mutex = true;
    _;
    mutex = false;
}

function createPlayer() {
    critical;
    var player = players[msg.sender];
    if (player.ready) { throw; }
    player.ethaddress = msg.sender;
    player.creationdate = block.timestamp;
    player.balance += msg.value;
}


texts: Ethereum geth linux installation directory, files details and enode strange IP address

texts:
I follow ethe main website and install go ether through ppa repository
now i can only find a bin file in usr folder for ubuntu!

So is it the only file there for that?

AND

When i run these two instruction

geth --datadir ~/.ethereum_private init ~/dev/genesis.json

geth --fast --cache 512 --ipcpath ~/Library/Ethereum/geth.ipc --networkid 12345 --datadir ~/.ethereum_private  console

And run command admin.nodeInfo.enode i got a address with IP after @! It is ok but the problem is that i got an IP address for my personal private node that is not my real external IP when I check my IP by other services out there! So what is this IP that is assigned to me? ( put ip here as reference to see if that maybe is some public cloud Ethereum address!!! 100.104.55.117:30303 )


texts: How can a DApp user make function calls to his and only his contract at a later stage after creating and deploying the contract to Ethereum?

texts:
My target: I'm new to the blockchain concept as well as Ethereum and trying to develop a web-app which allows the user to upload some data (let's say contact numbers) and also manipulate it at a later stage. The way I approached this when writing a contract is that a user deploys a contract and with this his Ethereum address is stored in the contract. Now whenever he wants he can add contact numbers to this contract through provided functions. The functions checks if the message to manipulate is coming from the contract owner and then only allows it. Also tested it on the embark simulator(RPC).

Doubt: What I don't understand is once the user had deployed his contract and added some contact numbers. Later when he wants to add more contacts numbers to the contract how will his messages go to his and only his contract i.e how to make sure that at a later point the user is making calls to his contract and not others'. I did got something about how there's contract address which points to the contract. I'm wondering  if I don't even need to bother about this stuff and just make web3js calls to the contract and it will by itself make sure the calls are made to the user's contract and not others.

I searched the web for stuff on this but came up with nothing. Can someone please help me understand this part of the puzzle or at least provide links which can help?


texts: How do i transfer from main eth network to kovan test network in metamask?

texts:
I transferred Ether to the main network in Metamask. This might seem like a stupid question, but how do I transfer that Ether to the Kovan Test Network?

Cheers


texts:
I was looking to develop an application using Whisper & NodeJS and I'm having trouble finding an example that works and is updated.

I've encountered this doc web3js.readthedocs.io/en/1.0/web3-shh.html and this guide https://github.com/ethereum/wiki/wiki/Whisper-Overview, but they are incompatible with each other ( probably version thing).

I've managed to get this far, in what I think should publish a message on Whisper, but I don't know why isn't working nor how to listen to it.

var net = require('net');
var Web3 = require('web3');
var web3 = new Web3(new Web3.providers.IpcProvider('/Users/tloriato/Library/Ethereum/geth.ipc', net));

var KeyID;
var PubKey;

var message = web3.utils.toHex("Test");

web3.shh.newKeyPair().then((data) => {
    console.log(data);
    web3.shh.getPublicKey(KeyID).then((data) => {
        console.log(data);
    }).then(() => {
        shh.post({
            pubKey: PubKey,
            sig: KeyID,
            ttl: 120,
            payload: message,
            powTime: 2,
            powTarget: 1
            }, function(err, data){
                if (err) console.log(err);
                console.log(data);
        });
    });
});

[Q]: Does anybody has a working example for whisper working with the recent version of geth or partiy?


texts: Is it possible to execute ethereum alarm clock via desktop wallet?

texts: Is it possible to execute a scheduled function of ethereum alarm clock via desktop version of Ethereum Wallet. I know the contract can be added to custom contract, but unable to see the methods to execute?


texts:
Just starting with this code -

pragma solidity ^0.4.17;

contract test {
    uint public manager;

}


texts: Connecting external server to Ethereum node via RPC failed "bind: cannot assign requested address"

texts:
I am trying to connect an external server to my Ethereum node. Considering I don't want to use --rpcaddr 0.0.0.0 (which it works)for security reasons, I am using the following command to start geth:
geth console --syncmode "fast" --rpcapi personal,web3,eth --rpc --rpcaddr 95.179.179.41 --rpcport 8545

but I get the following error:
Fatal: Error starting protocol stack: listen tcp 95.179.179.41:8545: bind: cannot assign requested address

How do I whitelist an IP address to the port 8545 correctly?


texts: How can I create a new public blockchain cloned from Ethereum?

texts:
Basically I know how to create a private blockchain, or Testnet,

But how would you go about creating a complete fork of Ethereum, while changing the name of Ethereum to something custom ?

For example I know Musicoin did fork Ethereum and create their own blockchain, they even renamed geth command line to something else, so this is definitely possible.

What should I do, where to look at to start this process ? (After forking ethereum codebase)


texts: How to pass an array as the function parameter?

texts:
I meet the same problem as this question:
Passing an array as a parameter from javascrpt (web3) to a Solidity function

If I call my function in the browser-solidity with the parameter [122,44], it works well.
But if I use it in my own web UI, it throw out "Error: new BigNumber() not a number".
The way I call it is like:

myContract.myFunction([122,44],{from:accounts[0]},function(err,res){...})

or

myContract.myFunction(["122","44"],{from:accounts[0]},function(err,res){...})

I don't know why. It should be the same result as in the browser-solidiy.


texts:
I have question about creating Struct where size of array passed to that struct could have different lengths. As in code below I could pass to this Recipe 2 ingredients, 3 ingredients or whatever amount if ingredients I would like with corresponding array of amounts.

Unfortunately I'm getting error:

TypeError: Invalid type for argument in function call. Invalid implicit conversion from uint8[2] memory to uint256[] memory requested.

I know that this comes from that I am passing fixed array size to dynamic array pole in Struct, what could be solution for that, if I want to be able to pass different sizes of arrays?

pragma solidity ^0.4.2;

contract Game {
    address public owner;

    // RECIPES
    mapping(uint256 => Recipe) private recipeInfo;

    struct Recipe {
        uint256 recipeId;
        uint256[] ingredientId;
        uint256[] ingredientAmount;
        uint256 ethCost;
    }

    // constructor of game;
    function Game() public {
        owner = msg.sender;
        recipeInfo[1] = Recipe(1, [1, 5], [100, 100], 50000000);
        recipeInfo[2] = Recipe(2, [2, 3, 4], [100, 200, 300], 100000000);
    }
}


texts: How can i use Token from an ERC20 Contract in my own contract?

texts:
I have following contract here on ropsten
https://ropsten.etherscan.io/address/0x813870feba76f27ec1afcf79432e065a4839f7ab#code

I want to use tokens from a different erc20 contract(0x8eB24319393716668D768dCEC29356ae9CfFe285) inside my own contract.

I know that i have to approve the amount i want to use in my own contract from the Token contract those tokens i want to use in my contract (0x8eB24319393716668D768dCEC29356ae9CfFe285).

What i did
In remix i compiled the code and selected TOKEN from inside my contract,
i deployed TOKEN "at address" of 0x8eb24319393716668d768dcec29356ae9cffe285

i than approved this address 0x813870feba76f27ec1AfcF79432e065A4839F7(my contract)

and set amount to approve to 2
Which all worked.

But when i try to use the buy Function from inside my code- the transaction fails.

How can i use Token from a different erc20 Contract in my Contract?


texts:
I have Eth.Wallet 0.8.1 for Win 64 bit. I can see the correct balance for a moment, but then it turns white. The bar with Eth. Wallet, Accounts , Edit, View, Develop, Window is visible, but the rest of the window is white. I had the same issue with the previous version since the last week. It worked perfectly before.

My computer skills are really basic and I will be really grateful for a step by step solution without IT jargon.

Thanks a lot!


texts: How can I verify that token balance (not ether balance) sent in a transaction were indeed transferred successfully?

texts:
In a transaction in which some token (e.g. DGD, DAO) balance is transferred, there is no need to verify that the address has enough tokens before sending the transaction.

But if the sender doesn't have enough token balance, the transaction will be broadcasted but the balances of sender and receiver won't change.

How can I know programatically that this transfer couldn't go through?


texts: why library contract still exist after killed by devs99 on 6 Nov?

texts:
everyone.
I'm new to Ethereum, here's a little question about parity wallet hacking on 6 Nov.

Parity wallet security issue happened again. We all know this is because he called kill function to kill the library contract. But after I checked this transaction on etherscan, it doesn't show this is the last transaction on this contract. I'm confused by why library contract can still keeping its transaction with other accounts, which also called initWallet() again.
I think library contract was killed, which means removed from blockchain forever and can not be used anymore....

Library Contract Address : 0x863DF6BFa4469f3ead0bE8f9F2AAE51c91A907b4

Transaction on etherscan
https://etherscan.io/address/0x863df6bfa4469f3ead0be8f9f2aae51c91a907b4

hackers address :0xae7168deb52586...(just two txs)


texts: Computational complexity of EVM consensus

texts:
Are there any resources that look at the computational complexity of running Ethereum on a private network? I am not considering any smart contracts or even transactions. I simply am trying to find the computational cost and perhaps communication cost of implementing Ethereum's consensus protocol (i.e. ensuring each node has the same version.)

If each node is a miner, would this simply be the cost of Proof-of-Work and the logical operation of comparing chain length?

I have not been able to find anything of this sort. I am looking for something such as a complexity O(n) where n is the number of nodes. There has to be some overhead for just implementing the Ethereum blockchain in its simplest form.


texts: I tried everything in order to see my Envion tokens on MEW myetherwallet, I tried contract adress, symbol, decimals ... I also tried with Envion private key and mnemonic phrase ... I bought Envion tokens with Bitcoins and maybe this is the problem ... I can only see my tokens on Envion dashboard, but not in MEW or Metamask ... if someone knows what is the problem, please help, I was in contact with Envion support team, but they are not helping


texts: Out of gas while using transfer function

texts:
I simply want the transaction to occur in integral ethers. I wish to refund the balance amount. I am using the following function in my contract for that. I am getting out of gas while running this function. I have increased the gas limit to 1 ether but to no avail.

function() payable {
    uint refund_amt = (msg.value % 1000000000000000000);
    tokens[msg.sender] += (msg.value - refund_amt) / 1000000000000000000;
    if (refund_amt != 0) msg.sender.transfer(refund_amt);
}


texts: web3.py manually derive address from public key string [for dummies]

texts:
Let's say I need to derive the address from a public key string.
0xbb8250cc01a0afa7dcaee987b2adda8d1b0a0bb2f7cc427bd942a98c7837364d62e6ea4728a99db39fd55a6f7474a159ca88a96b40279044a1349a2280c8cd43

According to this reply here I need to:

hash it:
I used this online hash generator because the built in Web3.sha3() function doesn't seem to return the same value for some reason and I don't know how to specify the input for the soliditySha3() function.

So the hash is now:

>>> hash = a591d48139d1f97e701cc15cb42a35c0ba7abf1aa44cfc82cdba0033779719eb

Cut the first 20 characters and add 0x prefix:

hash = "0x" + hash[24:]
=> 0xb42a35c0ba7abf1aa44cfc82cdba0033779719eb

Unfortunately this is not the correct address. The address should be 0xD4aD2c314d60089654bf292874AC0488F3ee77bA

So what's the correct way for dummies to derive the address from a public key string?


texts: Truffle test: error when passing more than one file as input

texts:
I have several test files, which I can successfully execute via truffle test (having started a ganache-cli process).

For example:

ganache-cli
truffle test test/test1.js
truffle test test/test2.js

However, when I try to input both files at once, for example:

ganache-cli
truffle test test/test1.js test/test2.js

Truffle completes the first one successfully, but throws an error for the second one:

Contract: Test2 "before all" hook: prepare suite:
Uncaught Error: Error: LevelUpArrayAdapter named 'blockLogs' index out of range: index 6; length: 6
at C:\Users\barak\AppData\Roaming\npm\node_modules\ganache-cli\build\cli.node.js:85357:23
at C:\Users\barak\AppData\Roaming\npm\node_modules\ganache-cli\build\cli.node.js:85331:5
at C:\Users\barak\AppData\Roaming\npm\node_modules\ganache-cli\build\cli.node.js:85777:12
at C:\Users\barak\AppData\Roaming\npm\node_modules\ganache-cli\build\cli.node.js:85542:19
at C:\Users\barak\AppData\Roaming\npm\node_modules\ganache-cli\build\cli.node.js:87681:7
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickCallback (internal/process/next_tick.js:180:9)
...

Here is my truffle-config.js file:

// See <http://truffleframework.com/docs/advanced/configuration>
module.exports = {
    contracts_build_directory: "./build/contracts",
    networks: {
        development: {
            host: "127.0.0.1",
            port: 8545,
            network_id: "*", // Match any network id
            gas: 4712388, // Gas limit used for deploys
            gasPrice: 100000000000, // Gas price used for deploys
        },
    },
    solc: {
        optimizer: {
            enabled: true,
            runs: 5000000,
        },
    },
};

Does anybody have any idea what I am missing here?

I found this related thread on GitHub, which gives the following explanation:

You throw an error that is unhandled.
Read the error message.
"Uncaught Error" means that something @#$% up and there was no one to clean up.
The program has no choice but to exit.

But it doesn't quite explain why everything works correctly when I truffle test one file at a time.

Thank you!!!


texts: I wanted to store the metadata of my ERC721 tokens on IPFS. Currently, I am inheriting from OpenZeppelin ERC721.sol contract,  and I saw there is a tokenURI function which returns the URI of the metadata. This token URI function build its URI based on the baseURI concatenated with the tokenID. The thing is if I would like to store on IPFS, the URI will be the hash of the content stored, and it will be nowhere close to the URI built by the tokenURI function. Thus I am unsure of how to build the tokenURI in my case? (of course I could build it manually, but is there a way to write a function to automate this?)


texts: There is a built-in default max transaction fee of 1 ETH with my GETH node + web3.js library.  Where can I change that?  I cannot find the option anywhere...


texts: Correct ABI payload packaging to call another Contract's address

texts:
Let's suppose I have the two following contracts, Dest and Proxy:

pragma solidity ^0.5.0;

contract Dest {
  function foo(string memory name, string memory symbol, uint256 decimals, uint256 totalSupply, address sender, uint256 value) public {
    /*
     * Logic code Here
     */
    }

  function bar(address a, address b, address c, address d, uint256 e, address f, address sender, uint256 value) public {
    /*
     * Logic code Here
     */
  }
}

contract Proxy {
  address private _owner;
  address private _dest;

  constructor(address dest) public {
    _owner = msg.sender;
    _dest = dest;
  }

  function getDest() public view returns(address) {
    return _dest;
  }

  function setDest(address dest) public {
    require(msg.sender == _owner);
    _dest = dest;
  }

  // Invoke takes msg.sender and msg.value and concatenates both to payload before to call the correct method
  function invoke(string memory method, bytes memory data) public payable {
    bytes memory payload = abi.encodePacked(bytes4(keccak256(bytes(method)))), data, abi.encode(msg.sender), abi.encode(msg.value));
    (bool ok, bytes memory response) = _dest.call(payload);
  }
}

Both foo and bar methods in Dest contract have address sender, uint256 value as final input parameters.

The logic is that users will call Proxy passing the complete method signature and all abi encoded parameters except for the last two.

Proxy sequentially packs together method signature, partial call parameters, msg.sender and msg.value in a unique bytes packed payload, then invokes the call method on the Dest address using the packed payload as input.

The problem is that when the foo method is called, the value of sender input parameter is not the original msg.sender address, but contains some inconsistent value.

But everything works fine when the bar method is called.

My suspicion is that the problem is related to the fact that in the head of the input parameters of the foo method there are strings, which have variable length, while in bar there are only parameters with fixed length.

Any suggestion on how to build a general purpose solution?


texts: question regarding linearization of inheritance

texts:
If I have the following inheritance:

pragma solidity ^0.4.24;

interface A {
    function foo(uint256 _x) external pure returns(uint256);
}

contract B1 is A {
    function foo(uint256 _x) public pure returns(uint256) { return _x + 1; }
}

contract B2 is A {

}

contract C_OK is B1, B2 {
    function foo(uint256 _x) public pure returns(uint256) { return super.foo(_x); }
}

contract C_NOT_OK is B1, A {
    function foo(uint256 _x) public pure returns(uint256) { return super.foo(_x); }
}

contract C_OK compiles fine, but for contract C_NOT_OK I get a

TypeError: Linearization of inheritance graph impossible
contract C_NOT_OK is B1, A {

I don't really see why I get an error here but not for C_OK, since the only difference is that C_OK inherits from B2 instead of from A, but B2 is empty and directly inherits from A, so C_OK and C_NOT_OK should be equivalent.

What's going on here?


texts:
I'm hoping to be able to debug a main net transaction without needing to pay the gas fees to have it fail.  Metamask tells me that it is going to cost 1.8 eth to run the transaction so I cant exactly just run it to see what it does...
Is there a way to execute a function locally while using the main net data so that I can debug what it is doing?
The contract uses live erc-20s as payment for minting erc-721s.  I tested it with erc-20 tokens that i generated on rinkby and I never saw an issue like this.
EDIT: I tried forking the main net with ganache and infura and that worked-ish, but I needed more data and without paying i couldnt access all the data that I needed. I ended up grabbing a bunch of different ERC20 implementations from various verified projects on etherscan and deploying them to rinkby so that I could test how they behaved with my contract. I found a few that resulted in the same revert and I was able to fix my issue.


texts: Assuming, I've never imported my pre-sale wallet from the initial ethereum crowd fund, could I simultaneously send the the contents of my wallet to an ETH address and an ETC address? I'd like to sell the ETC from the wallet but don't want to risk losing ETH.


texts: Accessing the wallet with the keystore generated using myetherwallet.com

texts:
I assume the UTC file which got generated in myetherwallet is the keystore file. Also I have my private key noted.

I understand that the myetherwallet will stay long and there is no plan to close in near future.

Could you please let me know how to use the keystore file or private key and access my wallet without using myetherwallet ?


texts: Why did the DAO soft fork had a DOS attack vector?

texts:
It has been said that the soft-fork initially proposed to solve the whole DAO situation had a fatal attack vector that posed a danger to the whole network. I do not contest this fact, as it has been widely accepted, I'm just trying to understand it. The initial statement released was:

  But the soft fork creates a denial of service attack vector which, if
  exploited, would prevent the network from processing valid
  transactions at negligible expense to the attacker. Specifically, an
  attacker can flood the network with transactions that execute
  difficult computation, and end by performing an operation on the DAO
  contract

From: http://hackingdistributed.com/2016/06/28/ethereum-soft-fork-dos-vector/

But this seems at odds with this other excerpt:

  Ethereum transactions are atomic - if an exception is thrown, all
  state transitions are reverted. The only exception to this rule (no
  pun intended) is gas payment - any gas used up until the OutOfGas
  exception is deducted and sent to the miners.

From: https://github.com/ebuchman/evm-tools/blob/master/analysis/guide.md

So it seems to me that the attack vector would not "come for free" for the attacker, who would still have to pay some gas to perform these useless operations. Assuming the gas used per operation is really proportional to the actual amount of work each node must perform, it would seem to me that in order to considerably pull off the attack it would still cost a considerable amount of resources. Wouldn't it?


texts: Do all Ethereum networks return the revert reasons as a "message" field?

texts:
I noticed that reverted transactions on Kovan don't include the revert reason. I'm getting the generic "Reverted"/ "VM execution error."
Is Koval special in this regard? I know that Ethereum Mainnet includes the reason in the "message" response of the JSON-RPC call.


texts:
Can you please help me with this error ! How to fix this ??

web3.eth.getAccounts(console.log)

  TypeError: this.provider.sendAsync is not a function
      at RequestManager.sendAsync (/home/chaitanyarajeev/ethereum_voting_dapp/chapter1/node_modules/web3/lib/web3/requestmanager.js:80:19)
      at Eth.get [as getAccounts] (/home/chaitanyarajeev/ethereum_voting_dapp/chapter1/node_modules/web3/lib/web3/property.js:116:33)


texts:
I have seen the announcement about the privacy changes that Meta Mask has made about no longer injecting Web3.  And the article post they made gave a snip of code to include to request Web3 to be injected. If I am testing a dapp locally using Ganache do I need to add anything to that script to make sure that Web3 points to my local blockchain?  I am hitting a bit of a road block here.

The code that I am referencing is in this link.
https://medium.com/metamask/https-medium-com-metamask-breaking-change-injecting-web3-7722797916a8


texts: If I set unlimited gas in a dev environment, am I just postponing dealing with a problem in my contract or is it a Truffle issue?

texts:
Booted up ganache with this command:
ganache-cli --gasLimit=0x1fffffffffffff --allowUnlimitedContractSize -e 1000000000

because I was running into this error on truffle migrate in my development environment:

"ContractName" ran out of gas. Something in the constructor (ex: infinite loop) caused gas estimation to fail. Try:
   * Making your contract constructor more efficient
   * Setting the gas manually in your config or as a deployment parameter
   * Using the solc optimizer settings in 'truffle-config.js'
   * Setting a higher network block limit if you are on a
     private network or test client (like ganache).

Was my contract failing because it's too big or is it just an issue with Truffle? Said another way, by running this ganache command am I just kicking the can down the road?


texts:
I have:

mapping (uint256 => uint64[]) public Arry;

I am trying to do:

Arry[123][0]++;

And I am getting the generic invalid opcode.

To me, I am accessing map key 123 which is a uint64 array. I am then incrementing the uint64 in position 0 by one. I don't understand why it dies here.


texts:
getting the following error.

npm ERR! Linux 4.4.0-87-generic
npm ERR! argv "/usr/local/n/versions/node/8.2.1/bin/node" "/usr/bin/npm" "install" "-g" "ethereumjs-testrpc"
npm ERR! node v8.2.1
npm ERR! npm  v3.5.2
npm ERR! code MODULE_NOT_FOUND

npm ERR! Cannot find module 'ansi'
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

Can someone help?


texts: Returning an array of inner structs of a struct

texts:
How can I return an array of child structs of a parent struct?

as an example: After pushing multiple chapters into the parent struct, how can I retrieve all the child structs as an array (or something else suitable)?

contract NewBook {

    struct ChapterData {
        // string chapterID;
        string title;
        uint pages;
    }

    struct BookData {
        // string bookID;
        ChapterData[] chapters;
    }

    mapping(bytes32 => BookData) books; // bookId => BookData

    function addChapter(bytes32 _bookID, string memory title, uint pages) public {
        ChapterData memory c = ChapterData({
            title: title,
            pages: pages
        });
        books[_bookID].chapters.push(c);
    }


texts: Double checking about the TheDAO hard fork

texts:
Been a bit out the loop but I think I'm fairly caught up but want to check.

I moved my presale ether to another wallet that has never made a transaction from it. As I understand, that wallet now exists on 2 chains (ETH and ETC) with identical private and public keys.

Is my ether safe if I don't touch it?

What do I do about my ETC?

Do I need to put my ether through a splitter contract?

Thank you.


texts: web3.eth.sign not returning a valid signature - Or how else does this work?

texts:
EDIT: Problem Solved; working example of login below

I use the sha3 of a message I want to sign with eth.sign
m = web3.sha3("Please work.")

I then runeth.sign(eth.coinbase, m)

And it returns me: 0x1c28d6720234343026c24718728cf0c251b0d09c87c32a6e380396a3360065290d0e7ec99a48e547e36645cecc11fd8d09742955c3d16c32eb75d9b24dd158d754

Theoretically, I would be able to derive the validity of the signature from this.

r = 0x1c28d6720234343026c24718728cf0c251b0d09c87c32a6e380396a336006529

s = 0x0d0e7ec99a48e547e36645cecc11fd8d09742955c3d16c32eb75d9b24dd158d7

v = 54?! ( I was under the impression this would  be a 0 or 1. For ecrecover I tried 27 and 28 )

Now I plug these into ecrecover(m, v, r, s) and I get...

With 27: 0x8c6c953abf2957f7fec4c689f8fe2ff09b81b245

With 28: 0xb8feaa9b9bfd7f10caefdc6d7baa1f74c37cedef

What in the world is going on? I'm trying to implement a login for my application using web3 and this is a major roadblock. I'm hoping you geniuses can correct me where I'm wrong.

Thanks.


texts: Questions related to the aftermath of breaking an iterative loop

texts:
Loops that do not have a fixed number of iterations, for example,
  loops that depend on storage values, have to be used carefully: Due to
  the block gas limit, transactions can only consume a certain amount of
  gas. Either explicitly or just due to normal operation, the number of
  iterations in a loop can grow beyond the block gas limit which can
  cause the complete contract to be stalled at a certain point.

What happens if a scenario occurs where a loop grows beyond the block gas limit? particularly; for how long will the contract be stalled?  To extend, If only 50 out of 500 (a random number) values of an array were effected by the loop iteration, would the function which started the loop then be callable another 9 times and effect the remaining 450 values of the array or would it just continuously effect only the same first 50 out of the 500?  Finally, How does one mitigate against this properly when looping through storage values and not function parameter input arguments?


texts: Why would some exchanges not support receiving Ether via smart contract?

texts: I notice that some exchanges, such as Bitstamp, only support withdrawing Ether via a smart contract. On the other hand, many exchanges do not support receiving Ether via smart contract. Why would an exchange not support smart contracts?


texts: geth attach not working on osx, problem with geth.ipc?

texts:
According to this information, I should be able to attach to geth with the following command on my OSX machine:

geth attach ipc://somePath/geth.ipc

in consideration of what to do about that "somePath", I attempted to follow the advice here, and use:

~/Library/Ethereum/

However, when I run the command:

 geth attach ipc:~/Library/Ethereum/geth.ipc

I get the following error message:

Fatal: Unable to attach to remote geth: dial unix ~/Library/Ethereum/geth.ipc: connect: no such file or directory

Also tried

geth attach --ipcdisable

which resulted in this:

Ultimately what I'd like to do is connect to the geth console without it spewing out a bunch of text so that I can examine the account balance of my address for my testnet mining, like I was asking about here.

Any ideas about what's wrong with my geth.ipc or how I can check that address would be greatly appreciated.


texts: Is there a transaction browser for ethereum?

texts: Is there a transactions/blocks browser/explorer for Ethererum? Just like blockchain or blockexplorer for bitcoin. I'd like to search a transaction for a given address.


texts: How to auto Reload dapp when Metamask is Unlocked or Locked by user

texts:
How can I auto-reload dapp base on Metamask account status?

I wish to design a metamask based authentication (like the one used in Crypokitties), for which I am able to design code which identifies if Metamask is locked or not. But the challenge is I have to manually refresh my web page to capture the latest status of metamask if it is locked or unlocked.

Suppose, if a user logs out of metamask, I want to catch that instance and close the dapp at the same time without any further action from the user (in my case this happens only after I manually refresh the page).

Will be grateful if someone has created similar feature and can guide with logic or code snippets.


texts:
How do I prevent mist from ever downloading the blockchain?

I have a small HDD and can't afford the disk space.


texts:
How to calculate the number of tokens to be sent out for an incoming transaction of 1ETH. Assume my value for token is 0.80 USD?

Token Price : 0.80 USD
Value       : 0.0016940 ETH == 1694000000000000 WEI

Then i have calculated like this

uint256 public rate = 5.02373716 * (10 ** 8);

Where 5.02373716 = 1 / 1694000000000000


texts: ERC20- Error encountered during contract execution [Reverted] Transfer Already Created Token

texts:
I have created contract on Ropston TestNet which will send any already created tokens.

Unfortunately its giving me error

Transaction Details Available at: https://ropsten.etherscan.io/tx/0x573387d8f0d24c090f9314bc6429040d415b119eb2850ec042b7d31e6a8cabe1

Contract Code: https://ropsten.etherscan.io/address/0x268359be8042358adc2fc9f72fe3d4132ed2015d#code

Note: I am calling function transfer which accept 3 parameters including (TokenContractAdreess, Receiver Address and Value). Contract has 2 functions with same name.

Please help me where I am lacking.

Thanks in advance!!!


texts: Call a payable function from a smart contract

texts:
Lets say we have contract A

contract A{
      function foo(uint8 value) payable{
       require(msg.value !=0)
       do something ...
      }
   }

and contract B

contract B{
      function bar(uint8 value) payable{
       calls the function foo of the contract A
      }
   }

Assume that I have correctly set the addresses and contract B knows the address of contract A. What would be the syntax for calling the function foo?

Doing something like A.foo(value) reverts due to the requirement of A.foo().


texts: type conversion from fixed and ufixed to string

texts:
i have a contract and within the contract i have a function which takes two variables from the input from the user, one of them is integer and one of them is double (both are necessary to the operation). i could type cast from int to string, but i could not type cast from fixed and ufixed to string. does anyone know how to convert? the compiler of course does not allow explicit type conversion from fixed to string, Explicit type conversion not allowed from "ufixed128x18" to "string storage pointer"
function getAbonacci(uint yclose, ufixed128x18 dclose) public payable {
   if (provable_getPrice("URL") > address(this).balance) {
       emit LogNewProvableQuery("Provable query was NOT sent, please add some currency to cover for the query fee");
   } else {
       emit LogNewProvableQuery("Provable query was sent, standing by for the answer..");

       //s2 = yclose; uint256 conversion to string
       s2 = uint2str(yclose);

       //s3 = dclose;
       x1 = string(dclose);

       s4 = string(abi.encodePacked(s1, "yclose=" , s2 , "&dclose=" , s3));
       //http://abwservice.com/api/webapi/service/?Token=xxxx&yhigh=0&ylow=0 &yclose=0&dclose=1888
       provable_query("URL", string(s4));
   }

}
s1, s2, s3, s4 are all strings. and i tried nearly everything for s3


texts: How can I create a correct seedhash in ethereum?

texts:
In the ethereum yellowpaper, about the creation of seedhash, I found that, when height is less 30000, the seedhash S = keccak256({0}32), description is:

  Seed hash. The seed hash is different for every epoch. For the first epoch it is the Keccak-256 hash of a series of 32 bytes of zeros. For every other epoch it is always the Keccak-256 hash of the previous seed hash.

but, in the python code, like this:

 def get_seedhash(block):
     s = '\x00' * 32
     for i in range(block.number // EPOCH_LENGTH):
         s = serialize_hash(sha3_256(s))
     return s

And in go-ethereum, the code is:

func seedHash(block uint64) []byte {
    seed := make([]byte, 32)
    if block < epochLength {
        return seed
    }
    keccak256 := makeHasher(sha3.NewKeccak256())
    for i := 0; i < int(block/epochLength); i++ {
        keccak256(seed, seed)
    }
    return seed
}

So, it seems that some different between the yellow paper and code. In the code, when height is less 30000, the seedHash return {0}32.
I'm in a puzzle in this problem.
Thank you for anyone can help me!


texts: why does ERC20 Token Balance shows 0 frequently?

texts:
I have a DAPP and ERC20 Token which has an initial supply of 9000 for testing purpose..First step is to login/register into the DAPP where all the information resides..There is an element in the DAPP which shows user token balance..The major issue is whenever I refresh the page it makes token balance to zero..Surprisingly, when I open the dev mode and try to refresh, it actually shows user actual  token balance before showing zero again.
I also have other elements which load on page refresh, takes some time to load but eventually they show accurate information instead of zero..But the token balance often show zero...
Moreover, I'm testing this with Metamask(Rinkeby Testnet)
For instance: if i refresh the page 10 times then there are chances it will show token balance only once or twice I guess...

Solidity

mapping(address => uint256) internal tokenLedger;

function getBalance(address _owner)  public view returns(uint256) {
    return tokenLedger[_owner];
}

web3js

if ($('.user_balance')) {
contract.getBalance(web3.eth.coinbase, (err, balance) => {
    if (err) {
        alert(err.message);
    } else {
        $('.user_balance').text(Math.floor(balance));
    }
});

}


texts: what is _; in solidity, well after every require statement this is follwed and why?

texts:
modifier onlyOwner() {
  require(isOwner());
  _;
}

what is the use of the the underscore here and why it is used after almost every require statements!


texts: Solidity multiple variables assignment ends up with null

texts:
Contract code:

contract RecordStore{
  struct Record {
    string value;
    address owner;
  }

  mapping(string => Record) records;
  Record lastRecord;

  function addRecord(string _recordId, string _value, address _owner) returns (bool) {
    Record r = records[_recordId];
    r.value = _value;
    r.owner = _owner;
    lastRecord = r;
    return true;
  }

  function getLastRecordOwner() returns (addr) {
    return lastRecord.owner;
  }

}

Client code:

  var rs = RecordStore.deployed();
  var account = web3.eth.getAccounts()[0];
  var recordName = "test_name";

  rs.addRecord(recordName, account, recordName, account, {from:account}).then(function(res) {

    rs.getLastRecordOwner.call().then(function(lastRecord) {
      console.log("last record owner: " + lastRecord);
    });

  });

When I run the test on testrpc everything works as expected.  But when I run it on geth lastRecord is null.  Does anyone know why?


texts: How to query Cryptokitties metadata from Etherscan

texts:
I;m trying to query a Cryptokitties token metadata from Etherscan and I need to give two values:
_tokenId (uint256) and _preferredTransport (string).

What are possible value for _preferredTransport?


texts:
Hi i am trying to update a value in a struct and i feel like i have tried everything.

i think there is something important i do not know about using solidity structs.

my contracts is defined as:

pragma solidity ^0.4.17;

contract Profile {
    struct User {
        string displayName;
        string displayIcon;
    }

    mapping(address => User) public users;
    string name;

    function createUser() public {
        users[msg.sender] = User({
            displayName: "pre-set name",
            displayIcon: "pre-set icon"
        });
    }

    function getDisplayName() public view returns (string) {
        return users[msg.sender].displayName;
    }

    function getDisplayIcon() public view returns (string) {
        return users[msg.sender].displayIcon;
    }

    function setDisplayName(string newDisplayName) public {
        users[msg.sender].displayName = newDisplayName;
    }

    function setDisplayIcon(string newDisplayIcon) public {
        users[msg.sender].displayIcon = newDisplayIcon;
    }

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

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

i am calling the setters and getters with:

export const createUser = () => ({
    type: PROFILE_CREATE_NEW_USER,
    promise: ({ contracts, coinbase }) => contracts.Profile.createUser({ from: coinbase })
});

export const getDisplayName = () => ({
    type: PROFILE_GET_DISPLAY_NAME,
    promise: ({ contracts }) => contracts.Profile.getDisplayName()
});

export const setDisplayName = payload => ({
    type: PROFILE_SET_DISPLAY_NAME,
    promise: ({ contracts, coinbase }) => contracts.Profile.setDisplayName(payload, { from: coinbase })
});

export const getName = () => ({
    type: 'PROFILE_GET_NAME',
    promise: ({ contracts, coinbase }) => contracts.Profile.getName({ from: coinbase })
});

export const setName = newName => ({
    type: 'PROFILE_SET_NAME',
    promise: ({ contracts, coinbase }) => contracts.Profile.setName(newName, { from: coinbase })
});

but when i call these functions, it seems it seems name can be get get and  set correctly, but the value of the struct property (displayName) is always an empty string if i try to get it.

i added the createUser method to see if that would fix the issue, but it still does not work.

i have tried this on Remix and it seems to work.

i'm new to solidity so i think i must be trying to debug this wrong. any help is appreciated.

thanks.

SOLVED

i have updated my code as suggested by a user below... and SUCCESS! the issue was you ALWAYS have to pass in { from: coinbase } when interacting with structs. the method getName() works with and without { from: coinbase }.


texts: Trying to understand balanceOf.call function

texts:
I am playing around with my ERC20 token. I created token on Rinkeby test network. I can't understand where I did a mistake. I am interacting with my token in truffle console.

After command

Token.deployed().then(function(instance){app = instance;})

I check my balance with command:

app.balanceOf.call("0xb9ac6f47A43d24F9D0d37049b7dbdC4EA0083d37")

And it works fine, I am getting the right answer.

Then I am trying to check my balance with commands:

app.balanceOf.call(accounts[0], {from: accounts[0]})

or

app.balanceOf.call(app.accounts[0], {from: app.accounts[0]})

or

app.balanceOf.call(address)

Where I did a mistake? How to call a function balanceOf ?

Information after command app:

 balanceOf:
  { [Function: bound ]
    request: [Function: bound ],
    call: [Function: bound ],
    sendTransaction: [Function: bound ],
    estimateGas: [Function: bound ],
    getData: [Function: bound ],
    address: [Circular] },

....

 balanceOf:
  { [Function]
    call: [Function],
    sendTransaction: [Function],
    request: [Function: bound ],
    estimateGas: [Function] },


texts:
After an ICO, the circulating supply (like you can see on https://coinmarketcap.com/currencies/bancor/) is what was sold in crowdsale?

I assume founder, reserve, bounty tokens are not included in the circulating supply?
Once a founder sells his tokens are they then added to the circulating supply?

Related to this are those founder & reserve tokens also created during ICO or afterwards when they decide to use them?


texts: Please help to detect ETHEREUM JSON key file

texts:
Time: 2014 year.
I have next key:
{"public_key":"02f6197ef15d989898b11c6c0axxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "data":"8aba0051ff23fe95a13d2747a19261690ed80b4d5cf54xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","salt": "9a7995ca9a714b80b6xxxxxxxxxxxxxxxxxxxxxxxx","iv": "f06e8fe76f3xxxxxxxxxxxxxxxxxxxxx"}
I have public address, i remember password, but i do not remember which software use this key.   I copied this and save into evernote. Help please, may be this json familiar to you?
Also may be found some solution on python to decode and extracy my private key?


texts:
I have a contract in Remix which runs perfectly on the Ethereum Ropsten Test net.

I now want to deploy the contractin the main ethereum net using parity. When I click to deploy the contract in parity and copy-paste the code from remix to parity I get the attached error.

I have some questions:

1) If I continue the deployment of the contract Oraclize functions will work fine at the main net?
2) If not how can I import the oraclize file in parity?


texts:
I know that indexed arguments index the values for those arguments so that filtering will be faster.

But what are topics? And what are they used for?

I know that signature of an event is a topic. And also very index argument is a topic.

And here https://github.com/ethereum/wiki/wiki/JavaScript-API#web3ethfilter what do they mean when they say "An array of values which must each appear in the log entries. The order is important, if you want to leave topics out use null, e.g. [null, '0x00...']. You can also pass another array for each topic with options for that topic e.g. [null, ['option1', 'option2']]"


texts: How to cancel pending formation of wallet contract in Mist?

texts:
I have an (empty) account with no Ether in it yet. In Mist, I created a wallet contract since I thought I needed it to receive Ether. However, I know now that this is not the case.

The wallet contract creation process however is still pending. It is greyed out and states "Creating..."

I am about to receive some ETH on the account sometime soon.

Now, I read that starting a wallet contract actually requires gas. I am guessing this is also the reason why, thus far, my wallet contract has failed to get created.

Since however I do not need any wallet contract, how can I cancel it while it is still pending creation?

Also, do I need to fear that as soon as I transfer some Ether to my account it will be used as gas to finalize the creation process of my Wallet Contract? Or could I somehow prevent that from happening?


texts: Minted Crowdsale vs Non Minted Crowdsale

texts:
I am exploring openzeppelinr-solidity smart contracts for Initial Coin Offering(ICO). There are two options available for a token smart contract one is to have hardcoded total supply tokens or mint a new token every time investor purchases a token.

Is it necessary that token must be mintable for a minted crowd sale?

What if my token is mintable but my crowd sale is non-minted?


texts: Cannot send transactions with MetaMask Chrome plugin

texts: I am trying to send an ETH transaction with the MetaMask Chrome addon, and have done so successfully in the past. However now, there is no "Send" button visible in the window, as shown in the image. I have restarted Chrome, my computer (chromebook), and reinstalled the MetaMask addon........How can I fix this? Thank you.


texts: How can I convert my Enjin coin to Ethereum

texts:
My question is about how can I convert my Enjin coin to Ethereum in my MyEtherwallet? Thanks!

Genevieve


texts:
Do you know what should be the result of dividing suppose:

11wei by 2(integer value) = ?

Thank you.


texts:
I'm just starting coding in solidarity. I want my syntax highlighter Vim Solidity to make my code look pretty.

What filename extension should I use for my source code?

For example, Javascript uses .js.

What does Solidity use?


texts: I mistakenly sent ETH from online wallet to ETC hardware wallet address

texts:
I mistakenly sent ETH from my online wallet to my ETC hardware (Ledger Nano S) wallet address. Is there any possibility of recovery? And if yes, how?

Thanks and kindest regards


texts: Getting 0 holder on Etherscan testnet despite having token transactions through DAPP

texts:
Recently, I've created a token and it is pure ERC-20 Compliant...I've sent some token to another address but when I see it on rinkeby testnet etherscan web page it shows 0 holder despite having  the transaction in transaction section below...Moreover, when I try to view token in metamask, Metamask also showed, we had trouble loading your token balance...What I'm missing here ??
Here's my code:
contract myToken {
  address payable owner;
  string public name = "Test TOKEN";
  string public symbol = "TT";
  uint public totalSupply_;
  uint public tokenSold;
  uint8 public decimals = 0;
  uint256 public token_price = 300000000000000;
  uint256 public token_incremental_price = 0;
  uint256 public currentPrice;

  event Transfer(address indexed _from, address indexed _to, uint tokens);
  event Approval(address indexed _tokenOwner, address indexed _spender, uint tokens);

  constructor(uint initialSupply) public  {
    owner = msg.sender;
    totalSupply_ = initialSupply * 10**uint256(decimals);
    totalSupply_ = initialSupply;
    tokenLedger[owner] = totalSupply_;
    currentPrice = token_price + token_incremental_price;
}

mapping(address => uint) internal tokenLedger;
mapping(address => mapping(address => uint256)) public allowed;

function myTokens() public view returns(uint256) {
    return balanceOf(msg.sender);
}

function balanceOf(address _customerAddress) public
    view
    returns(uint)
{
    return tokenLedger[_customerAddress];
}

function totalSupply() public view returns (uint256) {
      return totalSupply_;
}

 function transfer(address _toAddress, uint256 _amountOfTokens)
    public
    returns(bool success)
   {
    address _customerAddress = msg.sender;
    require(_amountOfTokens <= tokenLedger[_customerAddress] && _amountOfTokens > 0);

    tokenLedger[_customerAddress] = SafeMath.sub(tokenLedger[_customerAddress], _amountOfTokens);
    tokenLedger[_toAddress] = SafeMath.add(tokenLedger[_toAddress], _amountOfTokens);
    emit Transfer(_customerAddress, _toAddress, _amountOfTokens);
    return true;
}

function transferFrom(address _from, address _to, uint256 tokens) public returns(bool success)  {
    require(tokens <= tokenLedger[_from]);
    require(tokens > 0);
    require(tokens <= allowed[_from][msg.sender]);
    tokenLedger[_from] = SafeMath.sub(tokenLedger[_from], tokens);
    tokenLedger[_to] = SafeMath.add(tokenLedger[_to], tokens);
    allowed[_from][msg.sender] = SafeMath.sub(allowed[_from][msg.sender], tokens);
    emit Transfer(_from, _to, tokens);
    return true;
}

function approve(address _spender, uint256 _tokens) public returns(bool success) {
    allowed[msg.sender][_spender] = _tokens;
    emit Approval(msg.sender, _spender, _tokens);
    return true;
}

function allowance(address _owner, address _spender) public view returns(uint256 remaining)
{
    return allowed[_owner][_spender];
}


texts: Best way to conver ETH to a layer 2 ETH or Wrapped ETH to convert to USDC or USDT?

texts: I have a small amount of ETH ($100) and I want to use uniswap to convert it to USDC or USDT, but the fees of $20-$50 is a bit ridiculous. Is there a layer 2 solution that is WORKING that can convert to USDC easily without all the crazy fees? Or even a wrapped ETH token on another platform that can convert to USDC or USDT?


texts: Can't call coinFlip() function the second time

texts:
The first time when i run this it runs fine but the second time  when i call the coinFlip() function it shows gas estimation failed can someone tell me why it is happening.

pragma solidity ^0.6.0;

import 'https://github.com/provable-things/ethereum-api/blob/master/provableAPI_0.6.sol';

contract CoinFlipOracle is usingProvable {

string public result;
bytes32 public oraclizeId;

function coinFlip() public payable returns(string memory) {
    oraclizeId = provable_query('WolframAlpha', 'flip a coin');
    return result;
}

function __callback(bytes32 _oraclizeId, string memory _result) public override(usingProvable) {
    // this function should be only call from oracalize service
    require(msg.sender == provable_cbAddress());
    result = _result;
}

}


texts: im getting an error when trying to deploy my contract in rinkeby network..?

texts: i want to deploy my contract in rinkeby network with metamak mnemonic but iam unable to do it.icant understand whata i did wrongin the error message is there any way out...?


texts:
I followed the below links

http://y-nakajo.hatenablog.com/entry/2018/01/15/174743

Truffle post-deployment actions

and tried to create a migrations file as below.

const string_lib = artifacts.require('strings.sol');
const safemath_lib = artificats.require('safemath.sol');
const PublishService_contract = artifacts.require('PublishService.sol');

module.exports = function(deployer) {
    deployer.then(async () => {
        await deployer.deploy(string_lib);
        await deployer.deploy(safemath_lib);
    });
    deployer.deploy(PublishService_contract);
    deployer.link(string_lib, PublishService_contract);
    deployer.link(safemath_lib, PublishService_contract);
};

The publish service file here is dependent on strings and safemath libraries. But it gives the below error:

  deployer.then(async () => {
                      ^

  SyntaxError: Unexpected token (

can someone help me with this?

Even I tried to do it this way, without async calls

const string_lib = artifacts.require('strings.sol');
const safemath_lib = artifacts.require('SafeMath.sol');
const PublishService_contract = artifacts.require('PublishService.sol');

module.exports = function(deployer) {
        deployer.deploy(string_lib).then(() => {
        deployer.deploy(safemath_lib).then(() => {
                deployer.deploy(PublishService_contract);
        });
    });
    deployer.link(string_lib, PublishService_contract);
    deployer.link(safemath_lib, PublishService_contract);
};

But this also resulted in an error.

  Error encountered, bailing. Network state unknown. Review successful
  transactions manually. Error: Cannot link library: SafeMath has no
  address. Has it been deployed?

Here is the complete console output.

Running migration: 1_initial_migration.js
  Replacing Migrations...
  ... 0xb60508071fa5b0ba282da1c1b8bce5ed2157fff096292e73550bf357f7468f5b
  Migrations: 0xf633f429e089a049cd29189c0505336e69e88173
Saving successful migration to network...
  ... 0x3ad495b3643e84b769a79cdeafe88c158d9f13653f773f6dc074b99bf1a688ee
Saving artifacts...
Running migration: 2_deploy_contracts.js
  Replacing strings...
  ... 0x314516c05d9733925df2832cd8a411af8d0694f89b1050e3c0b2403f4af5c48a
  strings: 0x13e9875bb07843af3f360e4fd274626ba2ba66ef
Error encountered, bailing. Network state unknown. Review successful transactions manually.
Error: Cannot link library: SafeMath has no address. Has it been deployed?
    at Object.link (/usr/lib/node_modules/truffle/build/webpack:/~/truffle-deployer/src/linker.js:25:1)
    at /usr/lib/node_modules/truffle/build/webpack:/~/truffle-deployer/src/actions/link.js:5:1
    at /usr/lib/node_modules/truffle/build/webpack:/~/truffle-deployer/src/deferredchain.js:20:1
    at process._tickCallback (internal/process/next_tick.js:109:7)


texts:
I have a function in my contract loops through the current user base (an address[]), within each loop, it performs some logic and writes some data into state user variables.

The function starts to fail when the user base gets larger then 30 due to gas cost exceed block gas limit.

I wonder if this is a good solution here -

I can offload the loops to front end js, just call the function to write results onchain after each loop, in this way although I need to make more calls to write data onchain, at least each call will not exceed block gas limit. Then it is more scalable.

Is this a good way for gas optimization?


texts: Geth, how to revert back to certain EVM state/block

texts:
I am trying to fuzz a smart contract on Geth, which involves contract state exploration. In order to explore a contract state S1, different contract functions with different inputs will be executed on the given state.
E.g., executing function F1 on S1 produces new state S2. How can I revert the contract state back to S1? In Ganache CLI, there are two custom management API, evm_snapshop() and evm_revert(), evm_snapshot() stores the evm snapshot and returns an ID, when evm_revert() is executed with the ID, the evm goes back to the snapshot state.
Is there anything similar to this in Geth? Or do I just have to start all over again by re-executing all the previous transactions to reproduce a contract state?


texts: I want to know if it is possible to use the web3 API with the flask framework instead of meteor or nodejs. if so how do I add it to my flask project?


texts: Where are local variables of Primitive (Elementary) data types stored in Solidity

texts:
Though in the latest solidity compiler versions, it has been made clear that for reference variables local to a function, one needs to now explicitly mention its location modifier (memory, storage), thereby removing the whole confusion about its default  nature.

But it is still unclear where are all the local variables defined as uint, uint8, bool, address, enum etc. of a function stored ? is it stored in storage, memory or stack ?


texts: How can I retrieve my account's Augur (REP) token balance via JSON-RPC?

texts: How can I check the contract balance, like Augur (REP), on an address with JSON-RPC? There doesn't seem to be alot of documentation about this.


texts: Solidity: Best practices - Which compiler version should I use? Advantages / Disadvantages

texts:
Where is the main difference between:

pragma solidity ^0.4.24; and
pragma solidity 0.4.24;

Why would I use one or the other? Advantages / Disadvantages?

What effect will it have in the future when I deploy the smart contract to the blockchain?


texts: Function returns true for call, but variables show no change

texts:
Hey I think this may be a problem with the javascript side or Truffle, but the following function is returning true when I call it, but when I send a transaction to it, the test ether seems to disappear.

 uint public amountRaised;
 mapping (address => uint) contributionLedger;
 address[] public contributors;

 function fund() payable returns (bool) {
        if (msg.value == 0) { throw; }
        if (block.timestamp > deadline) { throw; }
        if (amountRaised > amountToBeRaised) { throw; }
        if (contributionLedger[msg.sender] == 0) {
            contributors.push(msg.sender);
        }
        amountRaised += msg.value;
        contributionLedger[msg.sender] += msg.value;
        return true;
    }


texts: EIP-820 deployed contracts address on new chains

texts:
From the description from https://github.com/ethereum/EIPs/issues/820 I understood that "Special registry deployment account" address can be reverse engineered from the crafted transaction using Nick's method. What I do not understand is that how is the deployed contract address going to guaranteed to be deterministic on any new chain? As far as my understanding:

Contract address is a result of 3 factors (deployer's address, hash of byte code of the contract, and nonce)
Because of the nonce, if any "naughty" actor using the similar method and deployed an entirely different contract, wouldn't it ruin the deterministic EIP820 contract address on that new chain?

I know it maybe just a very theoretical case, I am just being curious and want to know if I have any gaps in my understanding of Ethereum blockchain.


texts: web3.personal.signAndSendTransaction as a Contract method?

texts:
As web3.personal.signAndSendTransaction method, Is there any such method available for Contract functions?
for example:

MyContract.storeName.signAndSendTransaction("name",
    {from:web3.eth.accounts[0]},"passphrase");


texts: Getting the wrong address back from ecrecover

texts:
When I sign a string using the following code I get back a different address to the one I signed with. The address returned is different for different strings.

const util = require('ethereumjs-util')
const msg = web3.sha3('hello!');
const sig = web3.eth.sign(web3.eth.accounts[0], msg);
const {v, r, s} = util.fromRpcSig(sig);

const pubKey  = util.ecrecover(util.toBuffer(msg), v, r, s);
const addrBuf = util.pubToAddress(pubKey);
const addr    = util.bufferToHex(addrBuf);

I took the code from the answer to a question I asked previously here Getting an address from ethereumjs-utils erecover.

I asked a question here: Secp256k1 bindings are not compiled. Pure JS implementation will be used about a possibly relevant error. The comments suggested that it should be harmless though.


texts:
I am busy practicing writing contracts on the test network and I have a quesiton about how to empty a wallet.

This is what I have done:

I created a new test wallet
I sent it ETH 100
I now want to send the ETH100 back to the original wallet

There is an option called: "Send Everything", however, how do I pay for GAS using this method?

If GAS should be included in the transaction, should mist not take this into account?


texts:
Does every nodes(including non-mining nodes) execute smart contracts? I thought only mining nodes should execute all of contracts, but i heard that even non-mining nodes should execute smart contracts.
Then why should we run non-mining full node if i should run those works without any incentive?


texts: Scope Issue: Not successfully storing accounts after using web3.eth.getAccounts()

texts:
I am having trouble with the following code:

var accounts = []

let accounts = await web3.eth.getAccounts((error, result) => {
    accounts = result;
    console.log(accounts);
});
console.log(accounts);

The first time I console.log(accounts), the accounts are successfully retrieved, but when I console.log(accounts) in the final line of code, I still get an empty array.

Any suggestions?


texts: How to register your token in the user wallet

texts: I have created a token. How can I make it my token appear inside the user wallet and the wallet to show the token balance?


texts:
I am developing a code that verify if a period of time has passed. I do not need precision. Just to check if aproximately 1hour has passed.
I am using block.number. But, I noticed that it is not working as expected in a simulated blockchain (development). In other words, it is not incremented at each 15seconds. I think it increments when a transaction is sent to the network.
Does it make sense? Does anyone has experience with that?

Thank you


texts:
I have cloned the cpp-ethereum in Linux (centOS) from git as follows as suggested in cpp-ethereum-develop cmake error

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

cd cpp-ethereum

git checkout -b develop

git submodule update --init --recursive

mkdir -p build
cd build
cmake ..

When I run the cmake command

    -- The C compiler identification is GNU 4.8.5
    -- The CXX compiler identification is GNU 4.8.5
    -- Check for working C compiler: /usr/bin/cc
    -- Check for working C compiler: /usr/bin/cc -- works
    -- Detecting C compiler ABI info
    -- Detecting C compiler ABI info - done
    -- Check for working CXX compiler: /usr/bin/c++
    -- Check for working CXX compiler: /usr/bin/c++ -- works
    -- Detecting CXX compiler ABI info
    -- Detecting CXX compiler ABI info - done
    CMake Error at /usr/local/share/cmake-3.0/Modules/ExternalProject.cmake:1402 (message):

  URL_HASH is set to

    SHA256=087640ebcf7fbcfe8e2717a0b9528fff89c52fcf69fa2a18cc2b538008098f97;DOWNLOAD_NO_PROGRESS;True

  but must be ALGO=value where ALGO is

    MD5|SHA1|SHA224|SHA256|SHA384|SHA512

  and value is a hex string.
Call Stack (most recent call first):
  /usr/local/share/cmake-3.0/Modules/ExternalProject.cmake:1846 (_ep_add_download_command)
  cmake/jsoncpp.cmake:3 (ExternalProject_Add)
  CMakeLists.txt:45 (include)

-- Configuring incomplete, errors occurred!
See also "/home/user/cpp-ethereum/build/CMakeFiles/CMakeOutput.log".

How to solve this problem? Even the log file does not have the proper details about the error.


texts: blockchain update will take another 104 hours

texts:
I'm running Linux Mint 17.3 and I'm trying to update my ethereumwallet. I'm around 1.4 million blocks behind, so I started the ethereumwallet last night before going to be and I see that after 8-9 hours up updating it's moved from 2.6million to 2.7million of 4million blocks. so by my math it's going to take somewhere between 104-208 hours to finish updating my node. so googling took me to "How can I get a geth node to download the blockchain quickly?"

where they said to use "geth --fast --cache=1024 --jitvm"
well "geth" did nothing for me so I tracked down the ethereumwallet executable in the "opt" folder and launched with those flags only I increased the cache to "10240" (10GB) of system ram alloted. Sadly it doesn't seem to make any difference. my internet connection is not the problem I have 175mb/s and routinely download steam games at 23MB/s.  Also my system is not the problem as I have 16 threads of 4.1ghz Ryzen rockin! Also Hard Drive is not the problem as I have around .5TB of 2.3GB/s NVME available lol...
Please help, I can't let it sit here for the next week grinding.


texts: Error parsing ... ParsedContract.sol:33:18: ParserError: Expected token Semicolon got 'LParen'

texts:
When compiling my contract code in truffle I receive this error:

  Error parsing
  zeppelin-solidity/contracts/token/ERC20/StandardToken.sol:
  ParsedContract.sol:33:18: ParserError: Expected token Semicolon got
  'LParen'
      emit Transfer(_from, _to, _value);

I am running through this guide: https://maksimivanov.com/posts/ethereum-react-dapp-tutorial

I download zeppelin-solidity's files, and copied and paste the code. I don't understand why this wouldn't be working. I tried changing the pragma to 4.21 because that is what the standardToken's solidity code is written in. How do I fix this problem?


texts: Is there ethereum wallet with many addresses

texts:
More like electrum for bitcoin or LTC

Something like this

I have jaxx wallet but it seems that it can only hold 1 addresses. Say I want to know how much money I make from thgis and how much money I make from that? I need to label those addresses right?


texts: SSL Support for Communication Between Geth Nodes

texts:
We are using private Ethereum network for a multi entity use-case. The problem is that all these entities geth nodes sits behind a firewall which only allows TLS traffic.

The node that's broadcasting transactions has to use TLS otherwise the firewalls are blocking the packets. The receiving node's firewall acts as a reverse proxy therefore it doesn't need to have SSL. But how do I make geth use TLS while broadcasting transactions.

Is there a way in ubuntu which will automatically encrypt the unencrypted connections or any sort of proxy based solution?


texts:
I am newbie at smart contracts and their deploying and I am pretty confused.
I am following this example https://github.com/bellaj/Ballot-Dapp
Someone could explain me well what these lines do, please?

var abiArray =[{"constant":false,"inputs":[{"name":"proposal","type":"uint256"}],"name":"vote","outputs":[],"type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"proposals","outputs":[{"name":"name","type":"bytes32"},{"name":"voteCount","type":"uint256"}],"type":"function"},{"constant":true,"inputs":[],"name":"chairperson","outputs":[{"name":"","type":"address"}],"type":"function"},{"constant":false,"inputs":[{"name":"to","type":"address"}],"name":"delegate","outputs":[],"type":"function"},{"constant":true,"inputs":[],"name":"winningProposal","outputs":[{"name":"winningProposal","type":"uint256"}],"type":"function"},{"constant":false,"inputs":[{"name":"voter","type":"address"}],"name":"giveRightToVote","outputs":[],"type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"voters","outputs":[{"name":"weight","type":"uint256"},{"name":"voted","type":"bool"},{"name":"delegate","type":"address"},{"name":"vote","type":"uint256"}],"type":"function"},{"inputs":[{"name":"proposalNames","type":"bytes32[]"}],"type":"constructor"}]

var MyContract = web3.eth.contract(abiArray);

var contractInstance = MyContract.at('0xd9107d1f3c52bb440256a5f3ad9d6c2c3f38e1ee');// Instantiate from an existing address:


texts:
What do you guys think the simplest way to connect Mist to geth running on another machine?

I'm running geth 1.8.23 on another machine using ./geth --rpc --rpccorsdomain "*" --rpcapi "db,eth,net,web3,personal" and it has completed a full sync.

I'm currently using an ssh tunnel to connect to that node and running mist with --rpc http://127.0.0.1:8545. The tunnel appears to be working and it looks like mist is connecting to it, but it's always reporting my local node state as "sync starting" and mist never switches over to it from the remote node. There's nothing jumping out at me here as to what or if there's a problem.

I do get some messages in the shell when I launch mist:
[2019-03-10T13:04:58.359] [ERROR] ClientBinaryManager - Sanity check failed for Geth Error: Unable to find "1.8.21" in Geth output
    at Promise.resolve.then.then.then (C:\CCW\Mist-win64-0-11-1\resources\app.asar\node_modules\ethereum-client-binaries\src\index.js:632:17)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)

and: [2019-03-10T13:05:14.218] [ERROR] ipcProviderBackend - Send request failed { code: -32000, message: 'notifications not supported' }


texts: In Quorum, is it possible to replicate a private smart contract to a new node after the contract is deployed?

texts:
This question is about Quorum. I noticed that the quorum tag is present on this site hence adding the question here. If this question should rather be asked elsewhere, please let me know.

I am exploring Quorum for a business use case. I have this peculiar situation where there is a private contract Contract X shared between Node A and Node B. A new node Node C joins the network. Node C needs to have access to the private contract Contract X which is already deployed on Node A and Node B.

Is there any way to get Contract X along with its current state on Node C?

I know that if I have access to the source code or ABI of Contract X, I can just deploy Contract X on Node C. However, as per my understanding, this will give Contract X on Node C a different address than what it has on the other nodes. So any transaction I send to all three nodes targeting Contract X with fail on Node C.


texts: Possible cause for the number of pending transactions decreases around every 3 hours

texts:
Curious, around every 3 hours, there is a drop in pending transactions.
What could be the reason behind this?
https://etherscan.io/chart/pendingtx


texts: Difference between CALL on external contract address function and creating contract object with external address then calling function?

texts:
What's the difference between these two forms of calling methods on external contracts?

contract A {
    function foo() {
    }
}

contract B {

  function createFoo (address _contractAddress){
    Contract A = A(_contractAddress);
    A.foo();
  }

  function callFoo (address _contractAddress) {
    address newAddress = _contractAddress;
    newAddress.call(bytes4(sha3("foo()")));
  }
}

createFoo and callFoo seem to do the same thing. How are they different?


texts:
I was reading an old post: How to get the actual Gas price?
If the gas price currently is, for instance, 14 gwei and I have a transaction cost of 80000, does it mean the price of my transaction is 14*80000 = 1120000 gwei?
And last question, do I gotta add my execution cost to transaction cost in order to know the total cost of my operation (I'm using Remix IDE)?

Thanks in advance!


texts: How to migrate my old token to new contract?

texts: The contract for my token is migrated to a new contract. How can I migrate my old token to the new contract?


texts: ERC20 Token holder balances not showing up

texts:
I have implemented an ERC20 token using the official standard and am trying to check the token holders on Ropsten Etherscan. It shows the total supply but not the holders. The source can be found here.

What am I missing to make this token a full fledged ERC20?


texts:
I'm using remix ether to make a smart contract

However, I have no idea how to store information about contract.

If I turn off a computer or want to connect with other things, do i have to rewrite contract codes and deploy it?

There's other way how to save these things with .sol file with my computer?

As you know, If I deploy a contract there's menu on the right side at the conner. Here

BUT NOW i missed everything with turn off the browser. please let me know to store it


texts: Customer token amount not shown in Metamask

texts:
I deploy standard ERC20 test token called BEERS ( by copy and paste the standard ERC20 code ) onto Rinkeby network.

Then I transferred some BEERS token to my Metamask account[0] through Remix. I can confirm the result in Remix that my Metamask account[0] now has some BEERS.

Then I tried to claim the custom token in Metamask, it recognised the Token Contract Address with Token Symbol and Decimal automatically, but it shows I have 0 BEERS.

I can't figure out why... any suggestions are greatly appreciated.


texts: ParserError: Expected '{' but got reserved keyword 'override'

texts:
Can someone explain to me about this error? I just tried override feature in Solidity v0.6, but I got error Expected '{' but got reserved keyword 'override' function totalSupply()  public override  view returns (uint256) when compile contract.

pragma solidity >=0.4.21 <0.7.0;

import "./IERC20.sol";

    contract ERC20 is IERC20 {

    mapping (address => uint256) private _balances;

    mapping (address => mapping (address => uint256)) private _allowances;

    uint256 private _totalSupply;

    /**
    * @dev See `IERC20.totalSupply`.
    */
    function totalSupply()  public override  view returns (uint256) {
        return _totalSupply;
    }
}

Interface contract

pragma solidity >=0.4.21 <0.7.0;

interface IERC20 {
        /**
         * @dev Returns the amount of tokens in existence.
         */
        function totalSupply() external view returns (uint256);
}