2

I'm currently learning about RLP (ethereum-under-the-hood-part-ii, wiki-eth-rlp) and Ethereum transaction structure, my goal is to create an unsigned raw tx and then sign it.

Right now I'm playing around with code snipped which I assume are working such as raw_tx_demo which produces:

  • RLP-Encoded Tx: 0xe6808609184e72a0008303000094b0920c523d582040f2bcb1bd7fb1c7c1ecebdb3480801c8080
  • Tx Hash: 0x3a2fd1a5ea9ffee477f449be53a49398533d2c006a5815023920d1c397298df3

Given ethereum tx structure, below what I extract from the RLP-Encoded Tx:

0x {e6} {80} {86 09 18 4e 72 a0 00} {83 03 00 00} {94 b0 92 0c 52 3d 58 20 40 f2 bc b1 bd 7f b1 c7 c1 ec eb db 34} {80} {80} {1c} {80} {80}

{e6} - ?: 230
{80} - nonce: 0
gasPrice: 10000000000000
gasLimit: 196608
to: "0xb0920c523d582040f2bcb1bd7fb1c7c1ecebdb34"
{80} - value: 0
{80} - data: 0
{1c} - v: 28
{80} - r: 0
{80} - s: 0 

From here, I got some questions:

  • What the first byte 0xe6 or 230 is for ? How is it computed ?
  • Why does the ChainId is 0x1c or 28 ? Given this list it don't understand.
3

Partial answer.

Why does the ChainId is 0x1c or 28 ? Given this list it don't understand.

The link you point to shows network ID, which isn't the same as chain ID.

Further, 28 isn't the chain ID, it's the v value. See EIP-155 for details of expected v values, and this answer for a definition of v, r, and s.

2

The byte 0xe6 was simply following the 3rd rule describing an rlp list serialized.

tx = new ethTx({});
console.log('RLP-Encoded Tx: 0x' + tx.serialize().toString('hex'))

Gives: 0x c9 808080808080808080 and as the payload 808080808080808080 is 9 bytes or 0x09 so below 55 bytes, serializing a rlp list is just 0xc0 + 0x09 -> 0xc9.

In my exemple, the payload was 38 bytes or 0x26 and 0xc0 + 0x26 -> 0xe6

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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