Mainnet and testnet
CubWallet currently ships two networks. The current network is chosen by the user in the wallet. A dApp can only read it; it cannot switch.
| Network | network | chain id | Address prefix | Core asset | Default nodes |
|---|---|---|---|---|---|
| BitShares mainnet | mainnet | 4018d7844c78f6a6c41c6a552b898022310fc5dec06da467ee7905a8dad512c8 | BTS | BTS (1.3.0) | wss://api.bitshares.dev<br>wss://api.bts.mobi/ws<br>wss://dex.iobanker.com/ws<br>wss://node.xbts.io/ws<br>wss://api.dex.trading/ |
| BitShares testnet | testnet | 39f5e2ede1f8bc1a3a54a7914414e3779e33193f1f5693510e73cb7a87617447 | TEST | TEST (1.3.0) | wss://testnet.dex.trading/<br>wss://testnet.xbts.io/ws |
Public-key and address prefixes follow the network: mainnet keys start with BTS, testnet keys with TEST. Account ids look the same (1.2.x) but the two networks do not share accounts. Call bts_chainId first, then use account and asset ids that belong to that network.
The core asset is 1.3.0 on both: BTS on mainnet, TEST on testnet, both with precision 5.
After a network switch
When the user switches networks, the page receives chainChanged with the new { chainId, network }. You should then:
- update the network indicator on the page;
- call
bts_accountsagain (permissions are stored per network, so the list usually changes); - drop asset caches, open orders and other state from the previous network.
If this origin has no permission on the new network, bts_accounts returns [] and you need to call bts_requestAccounts again.
Nodes
The wallet uses the node the user selected in Settings (there is a built-in default list). The test dApp also connects to a public read-only node so it can resolve account names and asset symbols, and it checks that node's get_chain_id. Those queries are only for filling forms. Signing uses the wallet's node, and the approval window is authoritative.
Do not assume the node you opened from the page is the same one the wallet uses. Prefer account ids and asset ids when you build operations. If you resolve names yourself, check the chain id first.
CubWallet