0

I have the following raw transaction string.

0x02f901d4018201ad8459682f008520b1298f878301be0a94a7b6cb932eecacd956454317d59c49aa317e3c5780b90164ec9b1d600000000000000000000000000000000000000000000000000000000000000060010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000007ffd99995d591bb5131970bbb0659a1560e008a9cc468cf8d17fa2f180f819b1e5b167f17db9a3ee0e84d298e8b46418ac0ce8c12990f24d85b6f6425490bcb4e288bcd72afb37d4515f6fd0d7c1d05e420dcc9680e367f026b15bcd74c2ca6b610478214c998e663ab1670337cf349161ef9b01bc68ae7edf33bf947ffaf678288c886aeab8682c3bd3a079884a68fc57449bb19bb80efb8dfa7a0e2f8f5025400a78c632c2903f7870c797cf5f14a145251d77bf6f16a600734278a8b2305d3179bf94271c4b92233d9634c9ba5c134f6f0c630d83c7b8bba39af97398fb886c001a0cca7c55c810b62cfb0033ddf84122d0624c3ad1cc5d8a27acc280773d5065c08a045778ce52c22bf68d98f2cdd0dc86e9821a4903f2ac777785714d3700c065b0c

Trying to decode like so:

var tx *types.Transaction
rawtx, err := hex.DecodeString(rawString[2:])
if err != nil {
    log.Fatal(err)
}
rlp.DecodeBytes(rawtx, &tx)
fmt.Println(tx)

However this fails:

rlp: expected List

I've noticed this only seems to happen for non legacy transactions.

Would someone be able to point me in the correct direction?

1 Answer 1

0

I have copied your rawTx data and tried to decode it, here you have the playground link https://go.dev/play/p/w9ToKZPjm9-
It produces panic: runtime error: invalid memory address or nil pointer dereference I think your raw data is wrong or corrupted (there is a part with a lot of zeroes, maybe you have copied a zero array over the raw data); anyway as you have not provided the code that produces this raw tx I can not help so much.

You say that it only happens to you with non legacy transactions, just to say that I also have problems when broadcasting a DynamicFeeTx, here you have the link to my question, there you can see the code I used to compose the transaction (my raw tx when I use DecodeBytes is fine but broadcast returns "rlp: expected input list for types.LegacyTx").

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.