Ethereum 在smartcontract内部是否有我可以调用的API可以通过txid获取事务详细信息?

Ethereum 在smartcontract内部是否有我可以调用的API可以通过txid获取事务详细信息?,ethereum,smartcontracts,Ethereum,Smartcontracts,我正在学习以太坊开发,希望通过智能合约中的txid检查事务细节,但我没有找到任何接口可以帮助我做到这一点,有人有任何线索吗?我想你想调用getTransaction-就像智能合约中的RPC调用一样。然而,这是不可能的 所有可用于实体的全局变量如下所示 Global Variables block.coinbase (address): current block miner’s address block.difficulty (uint): current block difficulty

我正在学习以太坊开发,希望通过智能合约中的txid检查事务细节,但我没有找到任何接口可以帮助我做到这一点,有人有任何线索吗?

我想你想调用
getTransaction
-就像智能合约中的RPC调用一样。然而,这是不可能的

所有可用于实体的全局变量如下所示

Global Variables

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)
sha3(...) returns (bytes32): compute the Ethereum-SHA3 hash of the (tightly packed) arguments
sha256(...) returns (bytes32): compute the SHA256 hash of the (tightly packed) arguments
ripemd160(...) returns (bytes20): compute RIPEMD of 256 the (tightly packed) arguments
ecrecover(bytes32, uint8, bytes32, bytes32) returns (address): recover public key from elliptic curve signature
addmod(uint x, uint y, uint k) returns (uint): compute (x + y) % k where the addition is performed with arbitrary precision and does not wrap around at 2**256.
mulmod(uint x, uint y, uint k) returns (uint): compute (x * y) % k where the multiplication is performed with arbitrary precision and does not wrap around at 2**256.
this (current contract’s type): the current contract, explicitly convertible to address
super: the contract one level higher in the inheritance hierarchy
selfdestruct(address): destroy the current contract, sending its funds to the given address
.balance: balance of the address in Wei
.send(uint256) returns (bool): send given amount of Wei to address, returns false on failure.
当然,有一些棘手的解决方案是使用Oraclize。 我建议你看看这个网站:)


总之,对于您的问题,从solidity获取交易细节在本地是不可能的,您应该使用Oraclize之类的非链解决方案。:)

我认为您希望调用
getTransaction
——就像智能合约中的RPC调用一样。然而,这是不可能的

所有可用于实体的全局变量如下所示

Global Variables

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)
sha3(...) returns (bytes32): compute the Ethereum-SHA3 hash of the (tightly packed) arguments
sha256(...) returns (bytes32): compute the SHA256 hash of the (tightly packed) arguments
ripemd160(...) returns (bytes20): compute RIPEMD of 256 the (tightly packed) arguments
ecrecover(bytes32, uint8, bytes32, bytes32) returns (address): recover public key from elliptic curve signature
addmod(uint x, uint y, uint k) returns (uint): compute (x + y) % k where the addition is performed with arbitrary precision and does not wrap around at 2**256.
mulmod(uint x, uint y, uint k) returns (uint): compute (x * y) % k where the multiplication is performed with arbitrary precision and does not wrap around at 2**256.
this (current contract’s type): the current contract, explicitly convertible to address
super: the contract one level higher in the inheritance hierarchy
selfdestruct(address): destroy the current contract, sending its funds to the given address
.balance: balance of the address in Wei
.send(uint256) returns (bool): send given amount of Wei to address, returns false on failure.
当然,有一些棘手的解决方案是使用Oraclize。 我建议你看看这个网站:)


总之,对于您的问题,从solidity获取交易细节在本地是不可能的,您应该使用Oraclize之类的非链解决方案。:)

智能合约只能访问区块链的当前状态。Solidity仅用于创建事务规则和更新变量状态。要获得交易,您必须使用web3 Librarray。

智能合约只能访问区块链的当前状态。Solidity仅用于创建事务规则和更新变量状态。要获取事务,您必须使用web3 libraray