Can a contract view the details of a transaction, given a transaction id?

More generally, what details of the blockchain is a given contract aware of?

1 Answer 1


No, a contract only has access to the current state of the blockchain, and transactions are not part of state.

Specifically, these functions are available in Solidity for examining the current state:

block.coinbase (address): current block miner’s address

block.difficulty (uint): current block difficulty

block.gaslimit (uint): current block gaslimit

block.number (uint): current block number

block.blockhash (function(uint) returns (bytes32)): hash of the given

block - only works for 256 most recent blocks

block.timestamp (uint): current block timestamp

msg.data (bytes): complete calldata

msg.gas (uint): remaining gas

msg.sender (address): sender of the message (current call)

msg.value (uint): number of wei sent with the message

now (uint): current block timestamp (alias for block.timestamp)

tx.gasprice (uint): gas price of the transaction

tx.origin (address): sender of the transaction (full call chain)

<address>.balance: balance of the address in Wei

<address>.send(uint256) returns (bool): send given amount of Wei to address, returns false on failure.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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