I was working with ethereum wallet which is connected to my private blockchain. I performed a transaction which included transfer of ether from one account to another. Using the hash of this transaction, I called the eth.getTransactionReceipt(<tx hash>) method. It returns a transaction object which has its contractAddress: null. I know there is a single wallet contract Wallet.sol which does not have a transfer method. So how is this transfer done by the wallet application? Ain't there any contract for this purpose?

enter image description here


Transferring funds from an account to another is a base function of Ethereum, you don't need a specific contract to do that.

About the contractAddress in the receipt, it is set when the effect of the transaction is the creation of a contract. In any other case it's null.

From the official documentation, web3.eth.getTransactionReceipt returns:

Object - A transaction receipt object, or null when no receipt was found:

  • blockHash: String, 32 Bytes - hash of the block where this transaction was in.
  • blockNumber: Number - block number where this transaction was in.
  • transactionHash: String, 32 Bytes - hash of the transaction.
  • transactionIndex: Number - integer of the transactions index position in the block.
  • from: String, 20 Bytes - address of the sender.
  • to: String, 20 Bytes - address of the receiver. null when its a contract creation transaction.
  • cumulativeGasUsed: Number - The total amount of gas used when this transaction was executed in the block.
  • gasUsed: Number - The amount of gas used by this specific transaction alone.
  • contractAddress: String - 20 Bytes - The contract address created, if the transaction was a contract creation, otherwise null.
  • logs: Array - Array of log objects, which this transaction generated.
| improve this answer | |
  • I get it that transferring funds is a base function of Ethereum. If ethereum doesn't use a contract for this purpose, then how does it perform this function? – Anchit Seth Sep 5 '17 at 8:09
  • 1
    You can attach value (ether) to any type of TX. Here you can see the parameters you can set for a TX: github.com/ethereum/wiki/wiki/JavaScript-API#parameters-25 In particular, with to field you specify the address that will receive the funds you attached to the TX, so that its balance will be increased by that value and your will be decreased. In a very specific tx, a contract creation, to is null but the effect is the same: value is assigned to the balance of the contract if it is correctly created. – Giuseppe Bertone Sep 5 '17 at 8:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.