protected function setBitcoinLibMagicBytes($network, $testnet, $regtest) {

        if ($network === "bitcoin") {
            if ($regtest) {
                $useNetwork = NetworkFactory::bitcoinRegtest();
            } else if ($testnet) {
                $useNetwork = NetworkFactory::bitcoinTestnet();
            } else {
                $useNetwork = NetworkFactory::bitcoin();
            }
        } else if ($network === "bitcoincash") {
            if ($regtest) {
                $useNetwork = new BitcoinCashRegtest();
            } else if ($testnet) {
                $useNetwork = new BitcoinCashTestnet();
            } else {
                $useNetwork = new BitcoinCash();
            }
        }

        Bitcoin::setNetwork($useNetwork);
    }