区块链钱包之QTUM量子链地址生成
这篇文章我们就来讲讲QTUM钱包地址生成方式吧
前面说了一些关于区块链生成钱包地址的方法说了一下, 那么该如何用代码去生成钱包地址呢? 之前我在做钱包的时候, 搜了很多资料, 很少有写如何去生成钱包地址, 当然英文资料也不多. 最后还是去gayhub里面看了开源钱包, 才搞清楚了一些方法. 我们这里使用的是bitcoinj来生成. 一般都是分几个步骤: 生成助记词, 根据助记词生成地址
配置环境
【区块链钱包之QTUM量子链地址生成】首先我们这里使用的Android studio 3.0, 直接在app/build.gradle里面添加依赖
implementation group: 'org.bitcoinj', name: 'bitcoinj-core', version: '0.14.6'
复制代码
先填坑, 生成助记词需要使用到MnemonicUtils这个类, 但是有坑, 加载助记词列表文件的方式在Android上面根本不行, 会导致Crash
private static List populateWordList() {
URL url = Thread.currentThread().getContextClassLoader()
.getResource("en-mnemonic-word-list.txt");
try {
return readAllLines(url.toURI().getSchemeSpecificPart());
} catch (Exception e) {
return Collections.emptyList();
}
}
复制代码
懂的人都看出来了吧, 这是java的加载资源方式, 但是安卓需要做平台适配. 我们把en-mnemonic-word-list.txt这个文件放到assets之下, 然后用符合安卓的姿势加载. Good, 没问题了
private fun populateWordList(): List {
try {
val fis = App.instance.assets?.open("en-mnemonic-word-list.txt")
return readAllLines(fis!!)
} catch (e: IOException) {
e.printStackTrace()
}return emptyList()
}
复制代码
生成助记词
生成助记词需要使用到MnemonicUtils这个类, 要生成助记词很简单, 需要如下代码生成助记词, 助记词的格式就是12个单词
//average green proud remember advance trick estate oblige trouble when cube person
private val secureRandom = MySecureRandomUtils.secureRandom()
fun makeMnemonic(): String {
val initialEntropy = ByteArray(16)
secureRandom.nextBytes(initialEntropy)
return MyMnemonicUtils.generateMnemonic(initialEntropy)
}
复制代码
生成QTUM地址
先根据生成的助记词, 生成一些列的种, 运用了 BIP32确定性钱包算法(deterministic wallet algorithm), QTUM的地址是Q开头的, 比如:
QiozLhNSHWi8f6NGxvgK6iJkZjCkoyJKvX
复制代码
看看创建地址的方法
private fun createQtumWalletFromWords(words: String): TianWallet {
val wordsList = Arrays.asList(*words.split("\\s+".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray())
val deterministicSeed = DeterministicSeed(wordsList, null, "", 0)
val deterministicKeyChain = DeterministicKeyChain.builder().seed(deterministicSeed).build()
TUM_PATH = "m/88'/0'/0'"
val privKeyQtum isticKistiisiiiisticKeyChain.getKeyByPath(parsePath(QTUM_PATH), true).privKey
val ecKey = ECKey.fromPrivate(privKeyQtum)val publickey = Numeric.toHexStringNoPrefixZeroPadded(BigInteger(ecKey.pubKey), 66)
var privateKey = ecKey.getPrivateKeyEncoded(QtumMainNetParams.get()).toString()
if (BuildConfig.DEBUG) {
privateKey = ecKey.getPrivateKeyEncoded(QtumTestNetParams.get()).toString()
return TianWallet(ecKey.toAddress(QtumMainNetParams.get()).toString(), publickey, privateKey, words)
}
return TianWallet(ecKey.toAddress(QtumMainNetParams.get()).toString(), publickey, privateKey, words)
}
复制代码
这里面生成QTUM地址的方式和BTC地址生成方式都不一样, 需要用到QtumMainNetParams和QtumTestNetParams
class QtumMainNetParams : AbstractBitcoinNetParams() {
init {
interval =NetworkParameters.INTERVAL
targetTimespan = NetworkParammeters.TARGET_TIMESPAN
maxTarget = Utils.decodeCompactBits(0x1d00ffffL)
dumpedPrivateKeyHeader = 128
addressHeader = 58
p2shHeader = 50
acceptableAddressCodes = intArrayOf(addressHeader, p2shHeader)
port = 8333
packetMagic = 0xf9beb4d9L
bip32HeaderPub = 0x0488B21E //The 4 byte header that serializes in base58 to "xpub".
bipmajorityEnforceBlockUpat seriaat serat at at serializes in base58 to "xprv"majorityEnforceBlockUpgrade = MAINNET_MAJORITY_ENFORCE_BLOCK_UPGRADE
majorityRejectBlockOutdated = MAINNET_MAJORITY_REJECT_BLOCK_OUTDATED
majorityWindow = MAINNET_MAJORITY_WINDOWgenesisBlock.difficultyTt = 0x1d00ffffL
genesisBlock.setTime(1231006505L)
genesisBlock.nonce = 2083236893
id = ID_QTUM_MAINNET
subsidyDecreaseBlockCount = 210000
spendableCoinbaseDepth = 100
val genesisHash = genesisBlock.hashAsString
checkState(genesisHash == "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f",
genesisHash)// This contains (at a minimum) the blocks which are not BIP30 compliant. BIP30 changed how duplicate
// transactions are handled. Duplicated transactions could occur in the case where a coinbase had the same
// extraNonce and the same outputs but appeared at different heights, and greatly complicated re-org handling.
// Having these here simplifies block connection logic considerably.
checkpoints[91722] = Sha256Hash.wrap("00000000000271a2dc26e7667f8419f2e15416dc6955e5a6c6cdf3f2574dd08e")
checkpoints[91812] = Sha256Hash.wrap("00000000000af0aed4792b1acee3d966af36cf5def14935db8de83d6f9306f2f")
checkpoints[91842] = Sha256Hash.wrap("00000000000a4d0a398161ffc163c503763b1f4360639393e0e4c8e300e0caec")
checkpoints[91880] = Sha256Hash.wrap("0000000743f190a18c5200000] = Sha256Hash.wrap("000000000000034a7dedefcheckpoints[200000] = Sha256Hash.wrap("000000000000034a7dedef4a161fa058a2d67a173a90155f3a2fe6fc132e0ebf")dnsSeeds = arrayOf("seed.bitcoin.sipa.be", // Pieter Wuille
"dnsseed.bluematt.me", // Matt Corallo
"dnsseed.bitcoin.dashjr.org", // Luke Dashjr
"seed.bitcoinstats.com", // Chris Decker
"seed.bitnodes.io", // Addy Yeow
"bitseed.xf2.org", // Jeff Garzik
"seed.bitcoin.jonasschnelli.ch" // Jonas Schnelli
)
httpSeeds = arrayOf(
// Andreas Schildbach
HttpDiscovery.Details(
ECKey.fromPublicOnly(Utils.HEX.decode("0238746c59d46d5408bf8b1d0af5740fe1a6e1703fcb56b2953f0b965c740d256f")),
URI.create("http://httpseed.bitcoin.schildbach.de/peers")
))addrSeeds = intArrayOf(0x1ddb1032, 0x6242ce40, 0x52d6a445, 0x2dd7a445, -0x75ac32b9, 0x73263750, -0x25dc3da9, -0x132b12a9, 0x0a40ec59, 0x75dce160, 0x7df76791, -0x76c8f453, -0x5b0deb53, 0x767700ae, 0x638b0418, -0x7975efe8, -0x3260ccd2, 0x0129653e, -0x336d23c2, -0x6998e9c0, 0x56487e40, 0x5b66f440, -0x4e2fe0bf, -0xe239fbf, -0x3e2ed4be, -0x7945edbd, 0x6be4df43, 0x6d4cef43, -0x2e71f9bc, 0x1ab0b344, 0x6584a345, -0x183e5bbb, 0x58cea445, -0x3a255bbb, 0x21dda445, 0x3d3b5346, 0x13e55347, 0x1080d24a, -0x719ee1b5, -0x7eae71b5, 0x6c839e4b, -0x1d52f5b4, -0x443f5b4, 0x7f5b6e4c, 0x7244224e, 0x1300554e, 0x20690652, 0x5a48b652, 0x75c5c752, 0x4335cc54, 0x340fd154, -0x783f8bab, 0x087b2b56, -0x75ecc5a9, -0x53dc3da9, 0x70374959, -0x49c2ba5, -0x4c, 0x674f645d, 0x04d3495e, 0x1de44b5e,5e, 0x4ee8a362, 0362362362362, 0x0ded1b63, -0x3e4fb493, -0x726dea7f, -0x6848157e, 0x1cf83a8e, -0x6eb6f453, 0x09dc75ae, -0x65928652, -0x5d928652, 0x0fd08fae, 0x0f3e3fb2, 0x4f944fb2, -0x335bb748, 0x3ecd6ab8, -0x562a5a44, -0x72fee63f, 0x045997d5, -0x35fe6227, 0x0d526c4d, -0x540e45bc, 0x66b1ab55, 0x1165f462, 0x3ed7cbad, -0x5c705192, 0x3bd2cbad, -0x2c90fab9, 0x20df7840, 0x7a337742, 0x549f8e4b, -0x6f9dc9a4, -0x2c660a9e, 0x2b5274a1, -0x71205ead, 0x3bffb347, 0x7074bf58, -0x48b03453, 0x5b5a795b, 0x02fa29ce, 0x5a6738d4, -0x175e2dc2, -0x10673bbb, 0x4b0f494c, -0x5d43e1aa, 0x7694ad63, -0x5b57ff3d, 0x05fda6cd, -0x60dde8a2, 0x364a795b, 0x536285d5, -0x53bb362c, 0x0b06254d, 0x150c2fd4, 0x32a50dcc, -0x28631b8, -0xea305ad, 0x66c01e60, 0x6bc26661, -0x3fc4b852, 0x4dda1b81, 0x3285a4c1, -0x77c35693, 0x35d60a4c, -0x251f68bc, 0x2e314d61, -0x7b1db831, 0x6c814552, 0x3a1cc658, -0x67270c7e, -0x1a7b34a5, 0x15e86057, 0x7b01504e, -0x27ad22b8, 0x56382f56, 0x0a5df454, -0x5f2e72e8, 0x2e89b148, -0x5863eeb4, -0x34232fac, 0x5523bc43, -0x567cd9c0, -0x75f99ebc, 0x3894c3bc, -0x548940a8, 0x6a018ac1, -0x140b0bd, 0x2f26c658, 0x31102f4e, -0x7a16d62b, 0x2a1c175e, -0x393d32f, 0x27b04b6d, -0x20fdb9b0, 0x1617e6580, 0x57be6580, 0x1cee677a, -0x559448be444444448be, -0x65ac69b5, 0x0a5a2d4d, 0x2434c658, -0x65b6b0a9, 0x1ebb0e48, -0x9ef47a3, 0x077ecf44, 0x085128bc, 0x5ba17a18, 0x27ca1b42, -0x75ff4aa, -0x32b3da9, -0x30d03ea2, -0x27681fae, 0x4cada04f, 0x2f35f6d5, 0x382ce8c9, -0x1adc67b5, 0x3f946846, 0x60c8be43, 0x41da6257, -0x21f41ebe, -0x5175abb5, -0x100f3dac, 0x1e0f795b, -0x514d7770, -0x35e95327, 0x1e47ddd8, -0x7373b7d7, -0x2d8238b9, -0x2ac4e99d, 0x4096b163, -0x637226a8, -0x34ed07a0, -0x6186cfa4, 0x40c1a445, 0x4a90c2bc, 0x2c3a464d, 0x2727f23c, 0x30b04b6d, 0x59024cb8, -0x5f6e1953, 0x31b04b6d, -0x3d62b95a, 0x63934fb2, -0x26ddb242, -0x60a6ef28, 0x7f530a6b, 0x752e9c95, 0x65453548, -0x5b7b41ba, -0x31a5e4a7, 0x710e0718, 0x46a13d18, -0x2550ace8, -0x3b5700ad, -0x785455ae, -0x489b30af, -0x4dfda2b6, 0x6d351e41, -0x3fca3cc2, -0x5bcd3e9e, 0x61ef34ae, -0x2e902244, 0x0870e8c1, 0x3070e8c1, -0x638e173f, -0x5b66dc9d, -0x7a5e099d, 0x4184e559, 0x18d96ed8, 0x17b8dbd5, 0x60e7cd18, -0x1a11efb4, -0x54e8539e, 0x1e786e1b, 0x5d23b762, -0xdc77052, -0x77d8fca0, -0x61a4c280, 0x7da518b2, -0x4a9ec4bb, 0x1ad41f3e, -0x2aaf7ab6, -0x79e81657, -0x6da4dd64, -0xd16dabe, 0x47af0544, 0x73b5a843, -0x46485f53, 0x03a748d0, 0x0a6ff862, 0x6694df62, 0x3bfac948, -0x71f670b1, 0x746916c3, 0x02f38e4f, 0x40bb1243, 0x6a54d162, 0x6008414b, -0x5aec86b4, 0x514aa343, 0x63781747, -0x244986a5, -0x12f9afa8, 0x42d24b46, 0x1518794c, -0x64d8e97f, 0x73e4ffad, 0x0654784f, 0x438dc945, 0x641846a6, 0x2d1b0944, -0x6b4a6eb8, -0x72c96aa8, -0x5a56899e, -0x748fa4be, -0x316dfb52, -0x72a7bbb0, 0x2df61555, -0x114006bd, 0x2e75fb4d, 0x3ef8fc57, -0x66deeca2, -0x71cefbd2, -0x4a5052bd, -0x7613122f, -0x63033fb9, -0x7032f0b4, -0x41b60a53, 0x146a8d45, -0x67996548, -0x6726e8a2, -0x2e571b93, -0x7c65c548, 0x40a0016c, 0x6d27c257, -0x68800053, 0x7baa5d5d, 0x1213be43, -0x4e981a57, 0x640fe8ca, -0x436159ab, 0x0f820a4c, 0x0f097059, 0x69ac957c, 0x366d8453, -0x4e45d7bc, -0x77a80f7f, 0x70b5be63, -0x3ababab5, -0x50c9212f, -0x4a5b4fae, 0x21f062d1, 0x72ab89b2, 0x74a45318, -0x7ced1944, -0x46e969a1, -0x755837a8, -0x1810053)
}override fun getPaymentProtocolId(): String {
return NetworkParameters.PAYMENT_PROTOCOL_ID_MAINNET
}companitum_mainnet"const val MAINNET_MAJORITY_WINDOW = 1000
const val MAINNET_MAJORITY_REJECT_BLOCK_OUTDATED = 950
const val MAINNET_MAJORITY_ENFORCE_BLOCK_UPGRADE = 750private var instance: QtumMainNetParams? = null@Synchronized
fun get(): QtumMainNetParams {
if (instance == null) {
instance = QtumMainNetParams()
}
return instance as QtumMainNetParams
}
}
}
复制代码
class QtumTestNetParams : AbstractBitcoinNetParams() {
init {
interval = NetworkParameters.INTERVAL
targetTimespan = NetworkParameters.TARGET_TIMESPAN
maxTarget = Utils.decodeCompactBits(0x1d00ffffL)
dumpedPrivateKeyHeader = 239
addressHeader = 120
p2shHeader = 110
acceptableAddressCodes = intArrayOf(addressHeader, p2shHeader)
port = 8333
packetMagic = 0xf9beb4d9L
bip32HeaderPub = 0x0488B21E //The 4 byte header that serializes in base58 to "xpub".
bip32HeaderPriv = 0x0488ADE4 //The 4 byte header thto "xprv"majorityEnforceBlockUpat seriaat serat at at at serializes in base58 to "xprv"majorityEnforceBlockUpgrade = MAINNET_MAJORITY_ENFORCE_BLOCK_UPGRADE
majorityRejectBlockOutdated = MAINNET_MAJORITY_REJECT_BLOCK_OUTDATED
majorityWindow = MAINNET_MAJORITY_WINDOWgenesisBlock.difficultyTarget = 0x1d00ffffL
genesisBlock.setTime(1231006505L)
genesisBlock.nonce = 2083236893
idspendableCoinbaseDepth = 100
val genesisHash = genesisBlock.hashAsString
checkState(genesisHash == "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f",
genesisHash)// This contains (at a minimum) the blocks which are not BIP30 compliant. BIP30 changed how duplicate
// transactions are handled. Duplicated transactions could occur in the case where a coinbase had the same
// extraNonce and the same outputs but appeared at different heights, and greatly complicated re-org handling.
// Having these here simplifies block connection logic considerably.
checkpoints[91722] = Sha256Hash.wrap("00000000000271a2dc26e7667f8419f2e15416dc6955e5a6c6cdf3f2574dd08e")
checkpoints[91812] = Sha256Hash.wrap("00000000000af0aed4792b1acee3d966af36cf5def14935db8de83d6f9306f2f")
checkpoints[91842] = Sha256Hash.wrap("00000000000a4d0a398161ffc163c503763b1f4360639393e0e4c8e300e0caec")
checkpoints[91880] = Sha256Hash.wrap("00000000000743f190a18c5577a3c2d2a1f610ae9601ac046a38084ccb7cd721")
heckpoints[200000] = Sha256Hash.wrap("000000000000034a7dedefcheckpoints[200000] = Sha256Hash.wrap("000000000000034a7dedef4a161fa058a2d67a173a90155f3a2fe6fc132e0ebf")dnsSeeds = arrayOf("seed.bitcoin.sipa.be", // Pieter Wuille
"dnsseed.bluematt.me", // Matt Corallo
"dnsseed.bitcoin.dashjr.org", // Luke Dashjr
"seed.bitcoinstats.com", // Chris Decker
"seed.bitnodes.io", // Addy Yeow
"bitseed.xf2.org", // Jeff Garzik
"seed.bitcoin.jonasschnelli.ch" // Jonas Schnelli
)
httpSeeds = arrayOf(
// Andreas Schildbach
HttpDiscovery.Details(
ECKey.fromPublicOnly(Utils.HEX.decode("0238746c59d46d5408bf8b1d0af5740fe1a6e1703fcb56b2953f0b965c740d256f")),
URI.create("http://httpseed.bitcoin.schildbach.de/peers")
))addrSeeds = intArrayOf(0x1ddb1032, 0x6242ce40, 0x52d6a445, 0x2dd7a445, -0x75ac32b9, 0x73263750, -0x25dc3da9, -0x132b12a9, 0x0a40ec59, 0x75dce160, 0x7df76791, -0x76c8f453, -0x5b0deb53, 0x767700ae, 0x638b0418, -0x7975efe8, -0x3260ccd2, 0x0129653e, -0x336d23c2, -0x6998e9c0, 0x56487e40, 0x5b66f440, -0x4e2fe0bf, -0xe239fbf, -0x3e2ed4be, -0x7945edbd, 0x6be4df43, 0x6d4cef43, -0x2e71f9bc, 0x1ab0b344, 0x6584a345, -0x183e5bbb, 0x58cea445, -0x3a255bbb, 0x21dda445, 0x3d3b5346, 0x13e55347, 0x1080d24a, -0x719ee1b5, -0x7eae71b5, 0x6c839e4b, -0x1d52f5b4, -0x443f5b4, 0x7f5b6e4c, 0x7244224e, 0x1300554e, 0x20690652, 0x5a48b652, 0x75c5c752, 0x4335cc54, 0x340fd154, -0x783f8bab, 0x087b2b56, -0x75ecc5a9, -0x53dc3da9, 0x70374959, -0x495, -0x465e97a4, 0x180d765c, 0x674f645d, 0x04d3495e, 0x1de44b5e,55e, 0x4ee8a362, 0x0ded1b63, -0x3e4fb493, -0x726dea7f, -0x6848157e, 0x1cf83a8e, -0x6eb6f453, 0x09dc75ae, -0x65928652, -0x5d928652, 0x0fd08fae, 0x0f3e3fb2, 0x4f944fb2, -0x335bb748, 0x3ecd6ab8, -0x562a5a44, -0x72fee63f, 0x045997d5, -0x35fe6227, 0x0d526c4d, -0x540e45bc, 0x66b1ab55, 0x1165f462, 0x3ed7cbad, -0x5c705192, 0x3bd2cbad, -0x2c90fab9, 0x20df7840, 0x7a337742, 0x549f8e4b, -0x6f9dc9a4, -0x2c660a9e, 0x2b5274a1, -0x71205ead, 0x3bffb347, 0x7074bf58, -0x48b03453, 0x5b5a795b, 0x02fa29ce, 0x5a6738d4, -0x175e2dc2, -0x10673bbb, 0x4b0f494c, -0x5d43e1aa, 0x7694ad63, -0x5b57ff3d, 0x05fda6cd, -0x60dde8a2, 0x364a795b, 0x536285d5, -0x53bb362c, 0x0b06254d, 0x150c2fd4, 0x32a50dcc, -0x28631b8, -0xea305ad, 0x66c01e60, 0x6bc26661, -0x3fc4b852, 0x4dda1b81, 0x3285a4c1, -0x77c35693, 0x35d60a4c, -0x251f68bc, 0x2e314d61, -0x7b1db831, 0x6c814552, 0x3a1cc658, -0x67270c7e, -0x1a7b34a5, 0x15e86057, 0x7b01504e, -0x27ad22b8, 0x56382f56, 0x0a5df454, -0x5f2e72e8, 0x2e89b148, -0x5863eeb4, -0x34232fac, 0x5523bc43, -0x567cd9c0, -0x75f99ebc, 0x3894c3bc, -0x548940a8, 0x6a018ac1, -0x140b0bd, 0x2f26c658, 0x31102f4e, -0x7a16d62b, 0x2a1c175e, -0x393d32f, 0x27b04b6d, -0x61748b8, 0x28be6580, 0x57be6580, 0x1cee677a, -0x559448be44444444448be, -0x65ac69b5, 0x0a5a2d4d, 0x2434c658, -0x65b6b0a9, 0x1ebb0e48, -0x9ef47a3, 0x077ecf44, 0x085128bc, 0x5ba17a18, 0x27ca1b42, -0x75ff4aa, -0x32b3da9, -0x30d03ea2, -0x27681fae, 0x4cada04f, 0x2f35f6d5, 0x382ce8c9, -0x1adc67b5, 0x3f946846, 0x60c8be43, 0x41da6257, -0x21f41ebe, -0x5175abb5, -0x100f3dac, 0x1e0f795b, -0x514d7770, -0x35e95327, 0x1e47ddd8, -0x7373b7d7, -0x2d8238b9, -0x2ac4e99d, 0x4096b163, -0x637226a8, -0x34ed07a0, -0x6186cfa4, 0x40c1a445, 0x4a90c2bc, 0x2c3a464d, 0x2727f23c, 0x30b04b6d, 0x59024cb8, -0x5f6e1953, 0x31b04b6d, -0x3d62b95a, 0x63934fb2, -0x26ddb242, -0x60a6ef28, 0x7f530a6b, 0x752e9c95, 0x65453548, -0x5b7b41ba, -0x31a5e4a7, 0x710e0718, 0x46a13d18, -0x2550ace8, -0x3b5700ad, -0x785455ae, -0x489b30af, -0x4dfda2b6, 0x6d351e41, -0x3fca3cc2, -0x5bcd3e9e, 0x61ef34ae, -0x2e902244, 0x0870e8c1, 0x3070e8c1, -0x638e173f, -0x5b66dc9d, -0x7a5e099d, 0x4184e559, 0x18d96ed8, 0x17b8dbd5, 0x60e7cd18, -0x1a11efb4, -0x54e8539e, 0x1e786e1b, 0x5d23b762, -0xdc77052, -0x77d8fca0, -0x61a4c280, 0x7da518b2, -0x4a9ec4bb, 0x1ad41f3e, -0x2aaf7ab6, -0x79e81657, -0x6da4dd64, -0xd16dabe, 0x47af0544, 0x73b5a843, -0x46485f53, 0x03a748d0, 0x0a6ff862, 0x6694df62, 0x3bfac948, -0x71f670b1, 0x746916c3, 0x02f38e4f, 0x40bb1243, 0x6a54d162, 0x6008414b, -0x5aec86b4, 0x514aa343, 0x63781747, -0x244986a5, -0x12f9afa8, 0x42d24b46, 0x1518794c, -0x64d8e97f, 0x73e4ffad, 0x0654784f, 0x438dc945, 0x641846a6, 0x2d1b0944, -0x6b4a6eb8, -0x72c96aa8, -0x5a56899e, -0x748fa4be, -0x316dfb52, -0x72a7bbb0, 0x2df61555, -0x114006bd, 0x2e75fb4d, 0x3ef8fc57, -0x66deeca2, -0x71cefbd2, -0x4a5052bd, -0x7613122f, -0x63033fb9, -0x7032f0b4, -0x41b60a53, 0x146a8d45, -0x67996548, -0x6726e8a2, -0x2e571b93, -0x7c65c548, 0x40a0016c, 0x6d27c257, -0x68800053, 0x7baa5d5d, 0x1213be43, -0x4e981a57, 0x640fe8ca, -0x436159ab, 0x0f820a4c, 0x0f097059, 0x69ac957c, 0x366d8453, -0x4e45d7bc, -0x77a80f7f, 0x70b5be63, -0x3ababab5, -0x50c9212f, -0x4a5b4fae, 0x21f062d1, 0x72ab89b2, 0x74a45318, -0x7ced1944, -0x46e969a1, -0x755837a8, -0x1810053)
}override fun getPaymentProtocolId(): String {
return NetworkParameters.PAYMENT_PROTOCOL_ID_MAINNET
}companion object {
const val MAINNET_MAJORITY_WDATED = 950
const val MAINNET_MAJORITY_ENFORCE_BLOCK_UPGRADE = 750
const val ID_QTUM_TESTNET = "org.bitcoinj.qtum_testnet"private var instance: QtumTestNetParams? = null
@Synchronized
fun get(): QtumTestNetParams {
if (instance == null) {
instance = QtumTestNetParams()
}
return instance as QtumTestNetParams
}
}
}
复制代码
更多教程请访问爱去玩的专栏
推荐阅读
- 画解算法(1.|画解算法:1. 两数之和)
- 标签、语法规范、内联框架、超链接、CSS的编写位置、CSS语法、开发工具、块和内联、常用选择器、后代元素选择器、伪类、伪元素。
- 「#1-颜龙武」区块链的价值是什么()
- leetcode|leetcode 92. 反转链表 II
- BNC公链|BNC公链 | Eth2.0测试网Topaz已质押超100万枚ETH
- 【#2-戴栋】区块链可以提升哪些商业上的效率改进
- Spectrum|Spectrum 区块偶尔停止同步问题排查与解决笔记
- 父母链接八~未了情结
- java|java 常用知识点链接
- cocosbcx白皮书解读(一)|cocosbcx白皮书解读(一)| 区块链如何统一开发者、发行商、用户之间的利益