Closed salahzsh closed 4 years ago
Looks like you're printing the .String() value of rv.Elem()?
How are you printing rv -> ...
?
What is rv.Type? See if there is a .String() method implemented there.
This is using bech32 to encode the 20 bytes starting with [210, 70, ...] using the bech32 prefix of "bnb". Good luck, sorry for the late reply.
This was the key
This is using bech32 to encode the 20 bytes
Could solve it, thanks for replying anyway!
https://github.com/tendermint/go-amino/blob/dc14acf9ef15f85828bfbc561ed9dd9d2a284885/binary-decode.go#L547
Hi, I'm trying to decode an StdTx obtained from a node using the go-sdk for the Binance Chain. The StdTx is encoded so using codec.UnmarshalBinaryLengthPrefixed I'm able to decode it to an str json (following this example: https://github.com/binance-chain/node-binary/issues/53). Now I'm trying to code my own function to decode the tx (to read the outputs of a transaction on a system where I can't use UnmarshalBinaryLengthPrefixed or any library). The Output struct looks like this:
I have managed to decode the Amount (int64) and the Denom (string) but I have difficulty understanding how the Address ([]byte) is decoded.
Looking into the function that is called to decode it I can see the following steps: Initially I have:
Then is called DecodeByteSlice(bz) and returns:
Then is called rv.Set(reflect.ValueOf(byteslice)) and I got in rv the Address decoded:
I don't understand how from byteslice I can obtain the final value of rv.
Can someone help me or guide me? I appreciate any response. Thanks in advance