ethereum input data decoder
ethereum transaction input data decoder
Uses ethereumjs-abi for decoding.
Demo
https://sthnaqvi.github.io/input-data-decoder-ethereum/
Install
npm install input-data-decoder-ethereum
Usage
Pass ABI file path to decoder constructor:
const InputDataDecoder = ;const decoder = `/abi.json`;
Alternatively, you can pass ABI array object to constructor;
const abi = JSON;const decoder = abi;
Then you can decode input data:
const data = `0x67043cae0000000000000000000000005a9dac9315fdd1c3d13ef8af7fdfeb522db08f020000000000000000000000000000000000000000000000000000000058a20230000000000000000000000000000000000000000000000000000000000040293400000000000000000000000000000000000000000000000000000000000000a0f3df64775a2dfb6bc9e09dced96d0816ff5055bf95da13ce5b6c3f53b97071c800000000000000000000000000000000000000000000000000000000000000034254430000000000000000000000000000000000000000000000000000000000`; const result = decoder; console;
{ "name": "registerOffChainDonation", "types": [ "address", "uint256", "uint256", "string", "bytes32" ], "inputs": [ <BN: 5a9dac9315fdd1c3d13ef8af7fdfeb522db08f02>, <BN: 58a20230>, <BN: 402934>, "BTC", <Buffer f3 df ... 71 c8> ]}
Example using input response from web3.getTransaction:
web3eth;
Test
npm test
FAQ
-
Q: How can I retrieve the ABI?
-
A: You can generate the ABI from the solidity source files using the Solidity Compiler.
solc --abi MyContract.sol -o build
-
-
Q: How do I decode contract creation input data?
- A: Currently this isn't supported but happy to merge in a PR if there's a good solution.
License
MIT