ChainId

Enum representing the chain ID, an unsigned 32-bit integer used so transactions can't be replayed on other chains. Similar in purpose to TransactionVersion.


Usage

import { ChainId } from '@stacks/network';

if (network.chainId === ChainId.Mainnet) {
  console.log('This is a mainnet network');
}

Reference Linkarrow-up-right


Definition

enum ChainId {
  Mainnet = 0x00000001,
  Testnet = 0x80000000,
}

Values

Value
Number
Description

Mainnet

0x00000001

Stacks mainnet chain ID

Testnet

0x80000000

Stacks testnet chain ID (also used by devnet and mocknet)

Last updated

Was this helpful?