current position:Home>Can I get the hash of the transaction in the solidity function?

Can I get the hash of the transaction in the solidity function?

2022-02-03 20:47:12 Q & A of Denglian community

Whether there are global functions ( Such as tx.hash) To get the deal Hash? At present, my idea is that the transaction is before it is dug out ,hash It should not exist , I don't know the right time ?

Take the answer 1:

Solidity Global variables and functions

Through this file ( see English document ) We can find About the tradable properties of the block Of Interface with :

  • blockhash(uint blockNumber) returns (bytes32): Specifies the block hash of the block —— Only for the latest 256 Blocks and does not include the current block

  • block.coinbase ( address ): The current address of the miner

  • block.difficulty ( uint ): Current block difficulty

  • block.gaslimit ( uint ): The current block gas limit

  • block.number ( uint ): Current block number

  • block.timestamp ( uint): since unix epoch Start the timestamp in seconds of the current block

  • gasleft() returns (uint256) : remainder gas

  • ( bytes ): complete calldata

  • msg.sender ( address ): Message sender ( The current call )

  • msg.sig ( bytes4 ): calldata Before 4 byte ( That's the function identifier )

  • msg.value ( uint ): Sent with a message wei The number of

  • now (uint): Current block timestamp ( block.timestamp Another name for )

  • tx.gasprice (uint): Traded gas Price

  • tx.origin (address payable): Transaction originator ( Complete call chain )

All as described in the problem , Before the deal is dug up ,hash It doesn't exist .

Original question and answer link

Block chain in depth - Build a high-quality blockchain technology blog , All the school district chains come here , Focus on You know Microblogging .

copyright notice
author[Q & A of Denglian community],Please bring the original link to reprint, thank you.

Random recommended