Network Configuration
Overview
Basic network setup
import { STACKS_MAINNET, STACKS_TESTNET, STACKS_DEVNET } from '@stacks/network'
console.log(STACKS_MAINNET)
{
chainId: 1,
transactionVersion: 0,
peerNetworkId: 385875968,
magicBytes: 'X2',
bootAddress: 'SP000000000000000000002Q6VF78',
addressVersion: { singleSig: 22, multiSig: 20 },
client: { baseUrl: 'https://api.mainnet.hiro.so' }
}
console.log(STACKS_TESTNET)
{
chainId: 2147483648,
transactionVersion: 128,
peerNetworkId: 4278190080,
magicBytes: 'T2',
bootAddress: 'ST000000000000000000002AMW42H',
addressVersion: { singleSig: 26, multiSig: 21 },
client: { baseUrl: 'https://api.testnet.hiro.so' }
}
console.log(STACKS_DEVNET)
{
chainId: 2147483648,
transactionVersion: 128,
peerNetworkId: 4278190080,
magicBytes: 'id',
bootAddress: 'ST000000000000000000002AMW42H',
addressVersion: { singleSig: 26, multiSig: 21 },
client: { baseUrl: 'http://localhost:3999' }
}Custom network configuration
Environment-based configuration
Network detection and validation
Advanced network features
Custom headers and authentication
Request retry and timeout
Network-specific configurations
Configure by chain ID
Best practices
Common issues
Last updated
Was this helpful?