355 votes
Accepted

What is meant by the term "gas"?

"Gas" is the name for a special unit used in Ethereum. It measures how much "work" an action or set of actions takes to perform: for example, to calculate one Keccak256 cryptographic hash it will ...
user avatar
227 votes
Accepted

What is the difference between a transaction and a call?

Call A call is a local invocation of a contract function that does not broadcast or publish anything on the blockchain. It is a read-only operation and will not consume any Ether. It simulates what ...
user avatar
  • 78.8k
105 votes
Accepted

What's the difference between 'msg.sender' and 'tx.origin'?

With msg.sender the owner can be a contract. With tx.origin the owner can never be a contract. In a simple call chain A->B->C->D, inside D msg.sender will be C, and tx.origin will be A. msg.sender ...
user avatar
  • 78.8k
100 votes
Accepted

What happens when a transaction nonce is too high?

Summary Transactions with too low a nonce get immediately rejected. Transactions with too high a nonce get placed in the transaction pool queue. If transactions with nonces that fill the gap between ...
user avatar
78 votes

When to use "View" and "Pure" in place of "Constant"

In earlier versions, we would apply the constant modifier to indicate that a function doesn't change the storage state in any way. For example: pragma solidity 0.4.16; contract UseConstant { ...
user avatar
  • 51.8k
77 votes
Accepted

How to get contract internal transactions

There's not currently any way to do this using the web3 API. Internal transactions, despite the name (which isn't part of the yellowpaper; it's a convention people have settled on) aren't actual ...
user avatar
  • 7,649
73 votes
Accepted

Is there a limit for transaction size?

Wow this is such an interesting question! TL;DR: the transaction size limit, at the time of writing, is about 780kB (about 3 million gas). But read on. There is no direct or fixed limit, neither for ...
user avatar
  • 31.5k
65 votes

Transaction Status

Update Oct 21 2017 There are some changes with the Byzantium fork - getTransactionReceipt(...).status now returns 0 for a failed transaction and 1 for a successful transaction. EtherScan.io displays ...
user avatar
63 votes
Accepted

What are the limitations to estimateGas and when would its estimate be considerably wrong?

estimateGas works by pretending the transaction was actually being included in the blockchain, and then returning the exact gas amount that would have been charged if that pretend operation was real. ...
user avatar
59 votes
Accepted

What is nonce in Ethereum? How does it prevent double spending?

What is nonce in Ethereum? If you refer to the Glossary at Github Wiki, there are two types of nonce used in Ethereum. Account nonce - It's simply the transaction count of an account Account nonce: ...
user avatar
48 votes

What is meant by the term "gas"?

The following response is taken from Ethereum, Gas, Fuel & Fees What is Gas? Gas is the metering unit for use of the Ethereum "World Computer". As an analogy, electricity is metered by kilowatt ...
user avatar
  • 78.8k
46 votes
Accepted

What number of confirmations is considered secure in Ethereum?

From George Hallam: 12 confirmations; however, exchanges and entities handling very large amounts of Ether frequently are still encouraged to run two different Ethereum implementations and only ...
user avatar
  • 15.2k
46 votes
Accepted

How do I detect a failed transaction after the Byzantium fork as the REVERT opcode does not consume all gas?

Summary After the Byzantium fork, eth.getTransactionReceipt(...) will return a status field. The status field has a value of 0 when a transaction has failed with the REVERT opcode and 1 when the ...
user avatar
45 votes
Accepted

Do contracts also have a nonce?

Yes, contracts have nonces. EIP 161 made the contract nonce start at 1, and before EIP 161 the nonce would start at 0. A nonce of a contract is only incremented when that contract creates another ...
user avatar
  • 78.8k
45 votes

What is the difference between a transaction and a call?

The difference between in a call and a transaction is the following: transactions are created by your client, signed and broadcasted to the network. They will eventually alter the state of the ...
user avatar
  • 31.5k
45 votes
Accepted

What is the difference between `now` and `block.timestamp`?

What is the difference between now and block.timestamp? Nothing. They're aliases. From the documentation: now (uint): current block timestamp (alias for block.timestamp) Update: (Thanks @...
user avatar
45 votes
Accepted

error: replacement transaction underpriced

I have been running into this issue as well. The network thinks you are trying to replace an existing unmined transaction. There are two ways to avoid this: Adding a gas price %10 higher than the ...
user avatar
  • 590
42 votes
Accepted

What does v, r, s in eth_getTransactionByHash mean?

v, r, s are the values for the transaction's signature. They can be used as in Get public key of any ethereum account A little more information, r and s are outputs of an ECDSA signature, and v is ...
user avatar
  • 78.8k
41 votes
Accepted

Where is the private key for a contract stored?

Contracts do not possess private keys in the same way that your ether wallet does. Instead, they have programming code written in the language of the Ethereum Virtual Machine. To determine what a ...
user avatar
40 votes

What are the pros and cons of Ethereum balances vs. UTXOs?

The main validation constraints in a Bitcoin UTXO system are: every referenced input must be valid and not yet spent the transaction must have a signature matching the owner of the input for every ...
user avatar
38 votes

Can contracts pay the gas instead of the message sender?

At present the user initiating the transaction must pay the fee. However Serenity is likely to enable 'contract pays' schemes. (See Vitalik's blog post here) A possible work around is a contract which ...
user avatar
  • 3,282
36 votes
Accepted

What is the ethereum transaction data structure?

An Ethereum transaction - as in, what you pass to sendRawTransaction() - consists of the following fields, in order and RLP-encoded (note that the field names are not part of the encoded data): nonce ...
user avatar
  • 1,166
35 votes
Accepted

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

Here you have all the global variables in Solidity: Global Variables block.coinbase (address): current block miner’s address block.difficulty (uint): current block difficulty block.gaslimit (uint): ...
user avatar
35 votes
Accepted

Is it possible to cancel a transaction?

It can't be canceled, but it can be "out-gassed". You can grab the nonce (can be found on the pending tx on etherscan) and send another transaction with a higher gas price with the same nonce. If you ...
user avatar
  • 10.8k
34 votes

How to get contract internal transactions

In the Ethereum protocol there's only transactions and message calls. A transaction is a type of message call. A transaction may perform other message calls, but these are not transactions (even ...
user avatar
  • 78.8k
32 votes
Accepted

What is and how to calculate 'cumulative gas used'?

First of all, let's understand what is the cumulative gas used. cumulativeGasUsed: Number - The total amount of gas used when this transaction was executed in the block. As suggested by JavaScript ...
user avatar
32 votes
Accepted

What are Ethereum transaction receipts and what are they used for?

Relationship between Transaction Trie and Receipts Trie provides a good summary: Transaction Receipts record the transaction outcome Here is the Structure of a transaction receipt blockHash: ...
user avatar
  • 78.8k
29 votes

Gas price in ETH unit

There is no fixed gas price that transactions must have. You can specify the gas price, and if you set a gas price within certain bounds, the transaction will be accepted by miners using their ...
user avatar
  • 78.8k
29 votes
Accepted

Is it a good practice to log an event every time I throw in Solidity?

With an exception, as with throw, all effects (including events) of a transaction are reverted, except for the payment to the miner. So there would be no benefit in firing an event before a throw. ...
user avatar
  • 78.8k

Only top scored, non community-wiki answers of a minimum length are eligible