A tool that further encapsulates ethereumJs-abi (github.com/ethereumjs/ethereumjs-abi) to encode and decode the EVM smart contract invocation data.
cd ./abi-encoder
npm install -g
Encode function and input parameters. Note that for the Address type, the prefix is also "0x".
encode 'func(uint,uint32[],string,address)' '0x123, [0x456, 0x789], "Hello, world!", "0x8d731f3fed1536a57412239d750a2becb5cb24be"'
efd3b4250000000000000000000000000000000000000000000000000000000000000123000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000008d731f3fed1536a57412239d750a2becb5cb24be000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000004560000000000000000000000000000000000000000000000000000000000000789000000000000000000000000000000000000000000000000000000000000000d48656c6c6f2c20776f726c642100000000000000000000000000000000000000
Encode input parameters. Note that for the Address type, the prefix is also "0x".
encode 'uint,uint32[],string,address' '0x123, [0x456, 0x789], "Hello, world!", "0x8d731f3fed1536a57412239d750a2becb5cb24be"'
0000000000000000000000000000000000000000000000000000000000000123000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000008d731f3fed1536a57412239d750a2becb5cb24be000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000004560000000000000000000000000000000000000000000000000000000000000789000000000000000000000000000000000000000000000000000000000000000d48656c6c6f2c20776f726c642100000000000000000000000000000000000000
Decode the returned data.
decode 'uint,uint32[],string,address' '0000000000000000000000000000000000000000000000000000000000000123000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000008d731f3fed1536a57412239d750a2becb5cb24be000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000004560000000000000000000000000000000000000000000000000000000000000789000000000000000000000000000000000000000000000000000000000000000d48656c6c6f2c20776f726c642100000000000000000000000000000000000000'
[291, [1110, 1929], "Hello, world!", "8d731f3fed1536a57412239d750a2becb5cb24be"]