Closed
Description
Having a native constant for the chain ID in Clarity is very useful for various reasons. One can build triggers based on mainnet/testnet, etc., but it is specifically useful for signed message verification. A common way to prevent replay protection across forks is to add a chain ID to the message somewhere. Right now that means you have to hardcode the chain ID.
The chain ID is expressed as 4 bytes in a transaction and as a u32
in Rust:
0x00000001
or1
for mainnet0x80000000
or2147483648
for testnet
My suggestion is to expose it as chain-id
with a type of either uint
or (buff 4)
.