Returns transactions that match the specified transaction hash.
transfer:
web3.eth.getTransaction(transactionHash [, callback])
parameter:
transactionHash
: String - The hash of the transaction.callback
: Function - callback function, used to support asynchronous execution 7.
return value:
Object
- a transaction object- hash: String - 32 bytes, the hash of the transaction.
- nonce: Number - The number of transactions the originator of the transaction has made before.
- blockHash: String - 32 bytes. The hash of the block that was exchanged. Returns null when the block is pending.
- blockNumber: Number - The block number of the block the exchange is in. Returns null when the block is pending.
- transactionIndex: Number - Integer. The sequence number of the transaction in the block. Returns null when the block is pending.
- from: String - 20 bytes, the address of the transaction initiator.
- to: String - 20 bytes, the address of the recipient of the transaction. Returns null when the block is pending.
- value: BigNumber - The amount of currency attached to the transaction, in Wei.
- gasPrice: BigNumber - The gas price configured by the transaction initiator, in wei.
- gas: Number - The gas provided by the transaction initiator. .
- input: String - The data accompanying the transaction.
Example:
var blockNumber = 668;
var indexOfTransaction = 0
var transaction = web3.eth.getTransaction(blockNumber, indexOfTransaction);
console.log(transaction);
/*
{
"hash": "0x9fc76417374aa880d4449a1f7f31ec597f00b1f6f3dd2d66f4c9c6c445836d8b",
"nonce": 2,
"blockHash": "0xef95f2f1ed3ca60b048b4bf67cde2195961e0bba6f70bcbea9a2c4e133e34b46",
"blockNumber": 3,
"transactionIndex": 0,
"from": "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
"to": "0x6295ee1b4f6dd65047762f924ecd367c17eabf8f",
"value": BigNumber,
"gas": 314159,
"gasPrice": BigNumber,
"input": "0x57cb2fc4"
}
*/
Amway two tutorials: