forked from mingjingc/abi-decoder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdoc.go
49 lines (38 loc) · 1.76 KB
/
doc.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package decoder
/*
以太坊合约调用 transaction data 格式为:
method id(前4个字节) + 各个参数描述,具体规律还未知
【例】
contract HelloWorld {
string public name;
uint256 public age;
address public addr;
event StudentAdded(string indexed name, uint256 age, address indexed _addr);
function save(string memory _name, uint256 _age, address _addr) external {
name = _name;
age = _age;
addr = _addr;
emit StudentAdded(_name, _age, _addr);
}
function save2(string s1, string s2, string s3) external {
}
}
helloworld.save("a1b", 1, eth.accounts[1], {from: eth.accounts[0]})
0x19e7a966
0000000000000000000000000000000000000000000000000000000000000060 => a1b的开始位置96字节,
0000000000000000000000000000000000000000000000000000000000000001(年龄)
000000000000000000000000839c6f5a014cbfa319e8fdfa01aac186638945a8(地址)
0000000000000000000000000000000000000000000000000000000000000003(a1b 开始,表示字符个数)
6131620000000000000000000000000000000000000000000000000000000000(具体值为a1b)
helloworld.save2("1","4","0", {from: eth.accounts[0]})
0x7f07410e
0000000000000000000000000000000000000000000000000000000000000060(第一个数组开始位置)
00000000000000000000000000000000000000000000000000000000000000a0
00000000000000000000000000000000000000000000000000000000000000e0
0000000000000000000000000000000000000000000000000000000000000001
3100000000000000000000000000000000000000000000000000000000000000(1)
0000000000000000000000000000000000000000000000000000000000000001
3400000000000000000000000000000000000000000000000000000000000000(4)
0000000000000000000000000000000000000000000000000000000000000001
3000000000000000000000000000000000000000000000000000000000000000(0)
*/