-
Notifications
You must be signed in to change notification settings - Fork 750
Expose chain ID in Clarity #2982
Copy link
Copy link
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:
0x00000001or1for mainnet0x80000000or2147483648for testnet
My suggestion is to expose it as chain-id with a type of either uint or (buff 4).
Reactions are currently unavailable