Most Popular

1500 questions
46
votes
2 answers

How to initialize an empty array and push items into it?

Here's my function: function Test() constant returns (uint[]) { var myArray = uint[]; myArray.push(123); return myArray; } Here's an error I get in the solidity online compiler: ballot.sol:25:9: Error: Member "push" not found or not…
manidos
  • 4,298
  • 3
  • 31
  • 55
46
votes
3 answers

Is there a table of EVM instructions and their gas costs?

The EVM instructions are in the yellow paper, or they are summed up in this answer. But their gas costs are not there. Where can I find a list of all instructions with their associated gas costs?
comodoro
  • 1,202
  • 1
  • 12
  • 16
45
votes
3 answers

What's the Solidity statement to print data to the console?

Sometimes it would be really helpful to be able to see string representations of variable values in the Geth console, like of argument values in functions. Can I somehow print them to the Geth console?
TMOTTM
  • 1,953
  • 2
  • 14
  • 23
45
votes
3 answers

How can I create a multisignature address on Ethereum?

I want to store my ether in a form that requires more than one digital signature in order to authorise spends. How do I do on that on Ethereum?
Jeff Coleman
  • 22,059
  • 17
  • 77
  • 91
45
votes
3 answers

How to loop through mapping in solidity?

I have a mapping in my contract like below: mapping (address => uint) public voterCount; To calculate the total votes, I would like to loop through the mapping and sum the uint values. How do I do this in solidity? One solution is to use another…
maheshmurthy
  • 1,237
  • 2
  • 14
  • 17
44
votes
3 answers

How to backup mist wallets?

I know I can backup the keystore files from my running ethereum client which holds my accounts. But how can I backup wallets created with mist? Is it enough to write down the public address where the wallet contract is stored?
q9f
  • 32,913
  • 47
  • 156
  • 395
44
votes
2 answers

What are the steps to compile and deploy a library in Solidity?

I have several pieces of documentation about libraries, but I am not yet able to infer what steps are needed to compile and deploy a library and then a contract that uses it. The behavior of the library within solidity is quite clear, but compiling…
Raine Revere
  • 3,600
  • 2
  • 23
  • 34
44
votes
3 answers

What is the difference between transaction cost and execution cost in remix?

What is the difference between transaction cost and execution cost as seen after contract instantiation in remix? I don't think it matters, but here is my contract: contract DepositCounter { uint deposits = 0; function() { …
Raine Revere
  • 3,600
  • 2
  • 23
  • 34
44
votes
3 answers

Concurrency patterns for account nonce

The account nonce is the only element in the transaction structure that prevents replay attack (as explained in this very good answer). It essentially forces sequentialisation of an account's tranctions. This usually doesn't cause problems when…
Linmao Song
  • 2,357
  • 1
  • 13
  • 35
44
votes
1 answer

Is it possible to get the transaction hash from within a Solidity function call?

Within a Solidity function, is the transaction hash available as a global variable from within the contract? I would have thought it would be something like tx.hash in the same way you can do tx.origin etc. My thinking is that the transaction hash…
billett
  • 1,255
  • 1
  • 12
  • 18
44
votes
5 answers

How to detect if on mainnet or testnet?

Is it possible to figure out whether the network is mainnet or testnet (Ropsten) from web3.js? Or through MetaMask?
Hector
  • 443
  • 1
  • 4
  • 5
44
votes
2 answers

Solidity, create contract from contract

Based on documentation it should be possible to create new contract from contract contractAddress = new OwnedToken(name); When I invoke this method from contract, the address I receive seems to be normal address and not contract. Is this even…
Ales
  • 915
  • 1
  • 7
  • 10
44
votes
1 answer

What are ipc and rpc?

The question is quite simple , I have only basic Idea of RPC but none of IPC. AFAIK, if I connect to ethereum node via ipc then the my geth should be running on same machine. and If I connect via RPC then my geth could run on any remote machine.Is…
Prashant Prabhakar Singh
  • 8,026
  • 5
  • 40
  • 79
43
votes
8 answers

Error while compiling: Stack too deep

When trying to compile, I am getting the following error: "Internal compiler error: Stack too deep, try removing local variables." Is there any way around this? I'm not sure if I'll be able to remove enough variables to fix this. Thanks!
Amer Ameen
  • 825
  • 2
  • 8
  • 8
43
votes
3 answers

how to unlock the account with geth?

when I use the web3 interface to sign on msgs, it tell me that the account should be unlocked, how can I manage this with geth and what exactly does unlocking mean?
Wang
  • 2,416
  • 4
  • 19
  • 28