I found only one semi-automatic solution to transfer tokens from one wallet to another.
But i want to do that by web3js way on ruby stack. Could you guys explain me, how exatly to get data for eth_sendTransaction data
field with no using web3js (contract.transfer.getData("0xCb...", 10, {from: "0x26..."})
).
UPD.
I got the point about components of data.
For example let's get transaction 0xd21fa94958692c0aa3523ae9e8984067976483ec57642554a1dda0417e3337e2
Input data:
MethodID: 0xa9059cbb [0]: 000000000000000000000000c1816acca0a3a120fc980c58cb485d41f2b30e8e 1: 0000000000000000000000000000000000000000000000000000000000007530
- So, MethodID is encrypted function by
keccak256
. By than i am trying to get this result by same logic:
Digest::SHA3.new(256).digest('transfer(address,uint256)') => "\xA9\x05\x9C\xBB*\xB0\x9E\xB2\x19X?JY\xA5\xD0b:\xDE4m\x96+\xCDNF\xB1\x1D\xA0G\xC9\x04\x9B"
Why do I get different resultsЮ
Second parameter is address (
000000000000000000000000c1816AcCA0a3A120fc980c58CB485D41F2B30E8e
). Original one is0xc1816AcCA0a3A120fc980c58CB485D41F2B30E8e
. Next we trim few hex chars and what we should do next to generate same result?And last param is amount. What should we do to convert 3 tokens to
0000000000000000000000000000000000000000000000000000000000007530
.