Using web3, how can you get the Tx cost
and data/payload
for a given transaction?
getTransaction(tx#)
returns everything but those 2 values. This information seems to be available via blockchain explorers such as etherchain.org
Ethereum Stack Exchange is a question and answer site for users of Ethereum, the decentralized application platform and smart contract enabled blockchain. It only takes a minute to sign up.
Sign up to join this communityweb3.eth.getTransaction
has an input
property, which is the /payload for a given transaction.
The cost of a transaction is gasUsed
multiplied by gasPrice
.
web3.eth.getTransactionReceipt
has the gasUsed
property. web3.eth.getTransaction
has gasPrice
. Since the unit for gasPrice
is wei, divide by 1e18 to get the Ether cost of a transaction.