【区块链】以太坊RLP解码工具

 

Transaction类型RLP解码工具
//0xf864808502540be400825208949953974128a116a79bed4836e571a77090d098fa808025a0b00d97f985010034e96d924da2477a9ad237b5d407e172cee66f5e7afc70fc03a01f7154072b29b4fc77f8704457aa0039255338b13c9dfe4d5fff2242d03bf3e6
func TestDecodeBytes(t *testing.T) {
	str := "0xf864808502540be400825208949953974128a116a79bed4836e571a77090d098fa808025a0b00d97f985010034e96d924da2477a9ad237b5d407e172cee66f5e7afc70fc03a01f7154072b29b4fc77f8704457aa0039255338b13c9dfe4d5fff2242d03bf3e6"
	txbytes := common.HexToBytes(str)
	tx := new(types.Transaction)
	if err := DecodeBytes(txbytes, tx); err != nil {
		fmt.Println("decode err, err: ", err)
	}
}
$ ./rlpdump -hex 0xF88A01847735940083030D40AA307861363663336465383037366532333164353761353738643136336131323664633937353637306637880429993E8548A000884249545F434F52453DA04BB291FCCEBD9AA65C833AA82F99219CA92AF81BF0BDA5276E7DBE27979FB4E5A049D6FE7D3B7585906043FFC5EE245D366383CD751B19ACAAD9B0BECD815083DB
[
  01,
  77359400,
  030d40,
  "0xa66c3de8076e231d57a578d163a126dc975670f7",
  0429993e8548a000,
  "BIT_CORE",
  "=",
  4bb291fccebd9aa65c833aa82f99219ca92af81bf0bda5276e7dbe27979fb4e5,
  49d6fe7d3b7585906043ffc5ee245d366383cd751b19acaad9b0becd815083db,
]

go-ethereum/cmd/rlpdump/

参考链接:

https://github.com/ethereum/go-ethereum/issues/16290

 

你可能感兴趣的:(区块链)