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 community
web3.eth.getTransaction has an
input property, which is the /payload for a given transaction.
The cost of a transaction is
gasUsed multiplied by
web3.eth.getTransactionReceipt has the
gasPrice. Since the unit for
gasPrice is wei, divide by 1e18 to get the Ether cost of a transaction.