git / moonbite-network / mobile/lib/wallet/moonbite_network.dart · raw
import 'package:coinslib/coinslib.dart';/// MoonBite (MBITE) network parameters.////// Values mirror the production C++ chain's `src/chainparams.cpp` (the/// 2026-09-21 relaunch; the earlier "big"/"tbig" HRPs belonged to the retired/// beta chain) and agree with the web wallet mirrors `wallet.py`/// (`_MOONBITE_HRP = "moon"`) and `static/moonbite-address.js`:/// mainnet: PUBKEY_ADDRESS=50 ('M…'), SCRIPT_ADDRESS=5 ('3…'), SECRET_KEY=176,/// EXT_PUBLIC_KEY=0x0488B21E, EXT_SECRET_KEY=0x0488ADE4, bech32 "moon"/// testnet: PUBKEY_ADDRESS=111, SCRIPT_ADDRESS=196, SECRET_KEY=239,/// EXT_PUBLIC_KEY=0x043587CF, EXT_SECRET_KEY=0x04358394, bech32 "tmoon"/// regtest: testnet version bytes, bech32 "rmoon"////// These make the wallet's derived addresses and WIFs recognisable by/// `moonbited` (validateaddress / importprivkey) on the respective network.class MoonBiteNetwork { final String id; // "mainnet" | "testnet" final NetworkType coins; // coinslib NetworkType final String addressPrefixHint; // human hint, e.g. "moon1…" / "tmoon1…" const MoonBiteNetwork({ required this.id, required this.coins, required this.addressPrefixHint, }); bool get isTestnet => id == 'testnet'; static final NetworkType _mainnetCoins = NetworkType( messagePrefix: 'MoonBite Signed Message:\n', bech32: 'moon', bip32: Bip32Type(public: 0x0488b21e, private: 0x0488ade4), pubKeyHash: 50, scriptHash: 5, wif: 176, opreturnSize: 80, ); static final NetworkType _testnetCoins = NetworkType( messagePrefix: 'MoonBite Signed Message:\n', bech32: 'tmoon', bip32: Bip32Type(public: 0x043587cf, private: 0x04358394), pubKeyHash: 111, scriptHash: 196, wif: 239, opreturnSize: 80, ); // Regtest shares testnet's version/bip32 bytes but uses the "rmoon" HRP // (see the C++ chain's CRegTestParams). Used only for local dev/testing. static final NetworkType _regtestCoins = NetworkType( messagePrefix: 'MoonBite Signed Message:\n', bech32: 'rmoon', bip32: Bip32Type(public: 0x043587cf, private: 0x04358394), pubKeyHash: 111, scriptHash: 196, wif: 239, opreturnSize: 80, ); static final MoonBiteNetwork mainnet = MoonBiteNetwork( id: 'mainnet', coins: _mainnetCoins, addressPrefixHint: 'moon1…', ); static final MoonBiteNetwork testnet = MoonBiteNetwork( id: 'testnet', coins: _testnetCoins, addressPrefixHint: 'tmoon1…', ); static final MoonBiteNetwork regtest = MoonBiteNetwork( id: 'regtest', coins: _regtestCoins, addressPrefixHint: 'rmoon1…', ); static MoonBiteNetwork byId(String id) { switch (id) { case 'testnet': return testnet; case 'regtest': return regtest; default: return mainnet; } }}