EIP-155 defined a list of chain IDs, e.g. main net is 1 Ropsten is 2. I don't seem to be able to find a definition about its supposed value range and data size.

Quoting the yellow paper rule (287)

It is assumed that v is either the ‘recovery identifier’ or ‘chain identifier doubled plus 35 or 36’. The recovery identifier is a 1 byte value

The text says if it's recovery identifier, then it's encoded in one byte. It doesn't mention about the size for chain identifier doubled plus.

It seems for the chain identifier doubled plus case, one byte won't be sufficient: EIP-155 lists 1337 as the value for Geth private chains. So it seems safe to say this field (i.e. Tw) can be longer than one byte. If that's the case, shouldn't it be encoded with a length prefix?

Apart from the value 1337, is it possible for other networks to have even larger, longer chainId settings?

2 Answers 2


From various places in the Geth code, it looks like it's defined (and handled) as a BigInt. (The actual upper limit will be architecture dependent.)

For example, in config.go:

// MainnetChainConfig is the chain parameters to run a node on the main network.
MainnetChainConfig = &ChainConfig{
    ChainId:        big.NewInt(1),

I'd assume that the other clients implement it to a similar size and precision.


Richard Horrocks' answer is correct. The field doesn't have a size or value limit (part from non-negative, see geth code). I have also done a test transaction on a private network with an arbitrary network_id of 4901. The experiment goes as follows.

> eth.sendTransaction({from: '0x90f8bf6a479f320ead074411a4b0e7944ea8c9c1', to: '0xad322de69695859fc84f32d0f42c3802fe101843', value: 8000000000})

The output transaction hash is


Next we get the raw transaction bytes


The result is


Parsing the string manually: f8 6e (Length) 82 0678 (Nonce) 85 0430e23400 (gasPrice) 83 015f90 (gasLimit) 94 ad322de69695859fc84f32d0f42c3802fe101843 (To address) 85 01dcd65000 (value) 80 (Message call or contract creation data, which is zero length here) 82 266e (V with chain ID, 0x266e = 9838 = 4901 * 2 + 36, 82 is the length prefix) a0 27caed8171ad1857ff259554614152cda78949adda001e24472f84840bca5cd6 (R) a0 4a5f557baae23ce45c97b71363ea8da6740ac2652bd02b7f94b18cae62d7905a (S)

From the above example

  • Yes, length and value are both unlimited
  • Yes, the field is prefixed with length, rather than a fixed one-byte.

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.