Skip to content

Latest commit

 

History

History
30 lines (30 loc) · 2.31 KB

dynamicDataExplain.md

File metadata and controls

30 lines (30 loc) · 2.31 KB
函数方法
  • function analysisHex(bytes name,bool b,uint[] data,address addr,bytes32[] testData) {}
构建交易的参数
  • "Alice",true,[9,8,7,6],"0x26d59ca6798626bf3bcee3a61be57b7bf157290e",["张三","Bob","老王"]
函数签名
  • 0x4b6112f8
32字节64位(方法签名索引从0开始,第0位位置是bytes动态数组,则先占位,值应该从第5个位置开始存储,32*5=160,160转成16进制a0,左补齐0至64位)
  • 00000000000000000000000000000000000000000000000000000000000000a0
bool 在16进制中 0:false,1:true 静态类型,左补齐0至64位
  • 0000000000000000000000000000000000000000000000000000000000000001
uint256[]是动态数组,它的占位由前面的参数决定,共5个参数,其中bytes动态类型值占了2个32字节长度,5+(1+1)=7从第7个位置开始uint256[]数组值存储的位置。32*7=224转换成16进制为e0,左补齐0至64位
  • 00000000000000000000000000000000000000000000000000000000000000e0
address 类型是静态类型,去掉0x直接写入值,静态类型左补齐0至64位
  • 00000000000000000000000026d59ca6798626bf3bcee3a61be57b7bf157290e
bytes32[]动态类型数组,需要由前面的参数决定值的位置,7+(1+4)=12,1个32位是确定uint数组的长度是4,然后是4个32位存放uint数组的值。32*12=384 转换成16进制是180,左补齐0至64位
  • 0000000000000000000000000000000000000000000000000000000000000180
Alice的长度5,uint基础类型左补齐0至64位,Alice经过ASCII编码后值:416c696365,是动态类型,右补齐0至64位
  • 0000000000000000000000000000000000000000000000000000000000000005
  • 416c696365000000000000000000000000000000000000000000000000000000
uint256[] 数组[9,8,7,6],长度是4,基础类型uint左补齐0至64位)
  • 0000000000000000000000000000000000000000000000000000000000000004
  • 0000000000000000000000000000000000000000000000000000000000000009
  • 0000000000000000000000000000000000000000000000000000000000000008
  • 0000000000000000000000000000000000000000000000000000000000000007
  • 0000000000000000000000000000000000000000000000000000000000000006
bytes32[] 数组的长度3,uint是基础类型左补齐0至64位,"张三" ASCII编码后值:e5bca0e4b889,"Bob" ASCII编码后值:426f62,"老王" ASCII编码后值:e88081e78e8b,动态数组bytes32[]值统统右补齐0至64位
  • 0000000000000000000000000000000000000000000000000000000000000003
  • e5bca0e4b8890000000000000000000000000000000000000000000000000000
  • 426f620000000000000000000000000000000000000000000000000000000000
  • e88081e78e8b0000000000000000000000000000000000000000000000000000