Networks
Last updated
Was this helpful?
Typically, we speak of mainnet and testnet as the networks of Stacks. Most wallets are configured to mainnet by default—this is the production environment, the actual network that holds real STX tokens.
As the name suggests, testnet is a public network for testing. It's a separate network state that holds test tokens, which have no value.
For completeness we also mention devnet. This isn't "one" network, but how developers refer to ephemeral local networks used for testing via Clarinet. It is the same as testnet, but for local development.
Most Stacks.js functions accept a network parameter as a string or an optional last argument.
The network type is a string, and can be one of:
'mainnet' (default)
'testnet'
'devnet'
'mocknet' (alias of devnet)
Network in transaction signing:
const tx = makeSTXTokenTransfer({
// ...
network: 'testnet',
});Network in address derivation:
For more advanced workflows, pass a custom network configuration object. See the @stacks/network package for details.
Last updated
Was this helpful?
Was this helpful?
const address = privateKeyToAddress(privateKey, 'devnet');
// ST3NBRSFKX28FQ2ZJ1MAKX58HKHSDGNV5N7R21XCP