虚拟账户可以根据助记词生成钱包,最近我使用bitcoinj生成钱包,最开始使用的随机生成钱包,类似如下代码
ECKey key = new ECKey();
logger.info("We created a new key:\n" + key);
Address addressFromKey = key.toAddress(params);
logger.info("Public Address generated: " + addressFromKey);
String privateKey = key.getPrivateKeyEncoded(params).toString();
logger.info("Private key is: " + privateKey);
logger.info("Private Hex key is: " + key.getPrivateKeyAsHex());
Wallet wallet = new Wallet(TestNet3Params.get());
File walletFile = new File(result.get("addressFromKey")+".test.wallet");
wallet.importKey(key);
wallet.saveToFile(walletFile);
这样生成钱包没有规律性,使用时必须记住私钥,如果私钥丢失,账户中的钱将永远找不回来,为了方便大家使用,使用助记词的方式生成钱包安全性和通用性都更高
下面代码是通过BIP44规则生成账户(我使用的是bitcoinj这个框架)
String wordsList = "one misery space industry hen mistake typical prison plunge yellow disagree arm";
DeterministicSeed deterministicSeed = new DeterministicSeed(wordsList, null, "", 0L);
DeterministicKeyChain deterministicKeyChain = DeterministicKeyChain.builder().seed(deterministicSeed).build();
BigInteger privKey = deterministicKeyChain.getKeyByPath(HDUtils.parsePath("44H / 1H / 0H / 0 / 2"), true).getPrivKey();
ECKey ecKey = ECKey.fromPrivate(privKey);
Address address = ecKey.toAddress(params);
System.out.println(address.toBase58());
#引入的包
import org.bitcoinj.core.Address;
import org.bitcoinj.core.ECKey;
import org.bitcoinj.core.NetworkParameters;
import org.bitcoinj.crypto.HDUtils;
import org.bitcoinj.params.TestNet3Params;
import org.bitcoinj.wallet.DeterministicKeyChain;
import org.bitcoinj.wallet.DeterministicSeed;
import org.bitcoinj.wallet.UnreadableWalletException;
生成规则如下
m / purpose' / coin_type' / account' / change / address_index
| coin | account | chain | address | path |
|---|---|---|---|---|
| Bitcoin | first | external | first | m / 44' / 0' / 0' / 0 / 0 |
| Bitcoin | first | external | second | m / 44' / 0' / 0' / 0 / 1 |
| Bitcoin | first | change | first | m / 44' / 0' / 0' / 1 / 0 |
| Bitcoin | first | change | second | m / 44' / 0' / 0' / 1 / 1 |
| Bitcoin | second | external | first | m / 44' / 0' / 1' / 0 / 0 |
| Bitcoin | second | external | second | m / 44' / 0' / 1' / 0 / 1 |
| Bitcoin | second | change | first | m / 44' / 0' / 1' / 1 / 0 |
| Bitcoin | second | change | second | m / 44' / 0' / 1' / 1 / 1 |
| Bitcoin Testnet | first | external | first | m / 44' / 1' / 0' / 0 / 0 |
| Bitcoin Testnet | first | external | second | m / 44' / 1' / 0' / 0 / 1 |
| Bitcoin Testnet | first | change | first | m / 44' / 1' / 0' / 1 / 0 |
| Bitcoin Testnet | first | change | second | m / 44' / 1' / 0' / 1 / 1 |
| Bitcoin Testnet | second | external | first | m / 44' / 1' / 1' / 0 / 0 |
| Bitcoin Testnet | second | external | second | m / 44' / 1' / 1' / 0 / 1 |
| Bitcoin Testnet | second | change | first | m / 44' / 1' / 1' / 1 / 0 |
| Bitcoin Testnet | second | change | second | m / 44' / 1' / 1' / 1 / 1 |
不同币类型
| index | hexa | symbol | coin |
|---|---|---|---|
| 0 | 0x80000000 | BTC | Bitcoin |
| 1 | 0x80000001 | Testnet (all coins) | |
| 2 | 0x80000002 | LTC | Litecoin |
| 3 | 0x80000003 | DOGE | Dogecoin |
| 4 | 0x80000004 | RDD | Reddcoin |
| 5 | 0x80000005 | DSH | Dash (ex Darkcoin) |
| 6 | 0x80000006 | PPC | Peercoin |
| 7 | 0x80000007 | NMC | Namecoin |
| 8 | 0x80000008 | FTC | Feathercoin |
| 9 | 0x80000009 | XCP | Counterparty |
| 10 | 0x8000000a | BLK | Blackcoin |
| 11 | 0x8000000b | NSR | NuShares |
| 12 | 0x8000000c | NBT | NuBits |
| 13 | 0x8000000d | MZC | Mazacoin |
| 14 | 0x8000000e | VIA | Viacoin |
| 15 | 0x8000000f | XCH | ClearingHouse |
| 16 | 0x80000010 | RBY | Rubycoin |
| 17 | 0x80000011 | GRS | Groestlcoin |
| 18 | 0x80000012 | DGC | Digitalcoin |
| 19 | 0x80000013 | CCN | Cannacoin |
| 20 | 0x80000014 | DGB | DigiByte |
| 21 | 0x80000015 | Open Assets | |
| 22 | 0x80000016 | MONA | Monacoin |
| 23 | 0x80000017 | CLAM | Clams |
| 24 | 0x80000018 | XPM | Primecoin |
| 25 | 0x80000019 | NEOS | Neoscoin |
| 26 | 0x8000001a | JBS | Jumbucks |
| 27 | 0x8000001b | ZRC | ziftrCOIN |
| 28 | 0x8000001c | VTC | Vertcoin |
| 29 | 0x8000001d | NXT | NXT |
| 30 | 0x8000001e | BURST | Burst |
| 31 | 0x8000001f | MUE | MonetaryUnit |
| 32 | 0x80000020 | ZOOM | Zoom |
| 33 | 0x80000021 | VASH | Virtual Cash Also known as VPNcoin |
| 34 | 0x80000022 | CDN | Canada eCoin |
| 35 | 0x80000023 | SDC | ShadowCash |
| 36 | 0x80000024 | PKB | ParkByte |
| 37 | 0x80000025 | PND | Pandacoin |
| 38 | 0x80000026 | START | StartCOIN |
| 39 | 0x80000027 | MOIN | MOIN |
| 40 | 0x80000028 | EXP | Expanse |
| 41 | 0x80000029 | EMC2 | Einsteinium |
| 42 | 0x8000002a | DCR | Decred |
| 43 | 0x8000002b | XEM | NEM |
| 44 | 0x8000002c | PART | Particl |
| 45 | 0x8000002d | ARG | Argentum |
| 46 | 0x8000002e | Libertas | |
| 47 | 0x8000002f | Posw coin | |
| 48 | 0x80000030 | SHR | Shreeji |
| 49 | 0x80000031 | GCR | Global Currency Reserve (GCRcoin) |
| 50 | 0x80000032 | NVC | Novacoin |
| 51 | 0x80000033 | AC | Asiacoin |
| 52 | 0x80000034 | BTCD | Bitcoindark |
| 53 | 0x80000035 | DOPE | Dopecoin |
| 54 | 0x80000036 | TPC | Templecoin |
| 55 | 0x80000037 | AIB | AIB |
| 56 | 0x80000038 | EDRC | EDRCoin |
| 57 | 0x80000039 | SYS | Syscoin |
| 58 | 0x8000003a | SLR | Solarcoin |
| 59 | 0x8000003b | SMLY | Smileycoin |
| 60 | 0x8000003c | ETH | Ether |
| 61 | 0x8000003d | ETC | Ether Classic |
| 62 | 0x8000003e | PSB | Pesobit |
| 63 | 0x8000003f | LDCN | Landcoin |
| 64 | 0x80000040 | Open Chain | |
| 65 | 0x80000041 | XBC | Bitcoinplus |
| 66 | 0x80000042 | IOP | Internet of People |
| 67 | 0x80000043 | NXS | Nexus |
| 68 | 0x80000044 | INSN | InsaneCoin |
| 69 | 0x80000045 | OK | OKCash |
| 70 | 0x80000046 | BRIT | BritCoin |
| 71 | 0x80000047 | CMP | Compcoin |
| 72 | 0x80000048 | CRW | Crown |
| 73 | 0x80000049 | BELA | BelaCoin |
| 74 | 0x8000004a | ||
| 75 | 0x8000004b | FJC | FujiCoin |
| 76 | 0x8000004c | MIX | MIX |
| 77 | 0x8000004d | XVG | Verge |
| 78 | 0x8000004e | EFL | Electronic Gulden |
| 79 | 0x8000004f | CLUB | ClubCoin |
| 80 | 0x80000050 | RICHX | RichCoin |
| 81 | 0x80000051 | POT | Potcoin |
| 82 | 0x80000052 | QRK | Quarkcoin |
| 83 | 0x80000053 | TRC | Terracoin |
| 84 | 0x80000054 | GRC | Gridcoin |
| 85 | 0x80000055 | AUR | Auroracoin |
| 86 | 0x80000056 | IXC | IXCoin |
| 87 | 0x80000057 | NLG | Gulden |
| 88 | 0x80000058 | BITB | BitBean |
| 89 | 0x80000059 | BTA | Bata |
| 90 | 0x8000005a | XMY | Myriadcoin |
| 91 | 0x8000005b | BSD | BitSend |
| 92 | 0x8000005c | UNO | Unobtanium |
| 93 | 0x8000005d | MTR | MasterTrader |
| 94 | 0x8000005e | GB | GoldBlocks |
| 95 | 0x8000005f | SHM | Saham |
| 96 | 0x80000060 | CRX | Chronos |
| 97 | 0x80000061 | BIQ | Ubiquoin |
| 98 | 0x80000062 | EVO | Evotion |
| 99 | 0x80000063 | STO | SaveTheOcean |
| 100 | 0x80000064 | BIGUP | BigUp |
| 101 | 0x80000065 | GAME | GameCredits |
| 102 | 0x80000066 | DLC | Dollarcoins |
| 103 | 0x80000067 | ZYD | Zayedcoin |
| 104 | 0x80000068 | DBIC | Dubaicoin |
| 105 | 0x80000069 | STRAT | Stratis |
| 106 | 0x8000006a | SH | Shilling |
| 107 | 0x8000006b | MARS | MarsCoin |
| 108 | 0x8000006c | UBQ | Ubiq |
| 109 | 0x8000006d | PTC | Pesetacoin |
| 110 | 0x8000006e | NRO | Neurocoin |
| 111 | 0x8000006f | ARK | ARK |
| 112 | 0x80000070 | USC | UltimateSecureCashMain |
| 113 | 0x80000071 | THC | Hempcoin |
| 114 | 0x80000072 | LINX | Linx |
| 115 | 0x80000073 | ECN | Ecoin |
| 116 | 0x80000074 | DNR | Denarius |
| 117 | 0x80000075 | PINK | Pinkcoin |
| 118 | 0x80000076 | PIGGY | PiggyCoin |
| 119 | 0x80000077 | PIVX | Pivx |
| 120 | 0x80000078 | FLASH | Flashcoin |
| 121 | 0x80000079 | ZEN | Zencash |
| 122 | 0x8000007a | PUT | Putincoin |
| 123 | 0x8000007b | ZNY | BitZeny |
| 124 | 0x8000007c | UNIFY | Unify |
| 125 | 0x8000007d | XST | StealthCoin |
| 126 | 0x8000007e | BRK | Breakout Coin |
| 127 | 0x8000007f | VC | Vcash |
| 128 | 0x80000080 | XMR | Monero |
| 129 | 0x80000081 | VOX | Voxels |
| 130 | 0x80000082 | NAV | NavCoin |
| 131 | 0x80000083 | FCT | Factom Factoids |
| 132 | 0x80000084 | EC | Factom Entry Credits |
| 133 | 0x80000085 | ZEC | Zcash |
| 134 | 0x80000086 | LSK | Lisk |
| 135 | 0x80000087 | STEEM | Steem |
| 136 | 0x80000088 | XZC | ZCoin |
| 137 | 0x80000089 | SBTC | RSK |
| 138 | 0x8000008a | Giftblock | |
| 139 | 0x8000008b | RPT | RealPointCoin |
| 140 | 0x8000008c | LBC | LBRY Credits |
| 141 | 0x8000008d | KMD | Komodo |
| 142 | 0x8000008e | BSQ | bisq Token |
| 143 | 0x8000008f | RIC | Riecoin |
| 144 | 0x80000090 | XRP | Ripple |
| 145 | 0x80000091 | BCH | Bitcoin Cash |
| 146 | 0x80000092 | NEBL | Neblio |
| 147 | 0x80000093 | ZCL | ZClassic |
| 148 | 0x80000094 | XLM | Stellar Lumens |
| 149 | 0x80000095 | NLC2 | NoLimitCoin2 |
| 150 | 0x80000096 | WHL | WhaleCoin |
| 151 | 0x80000097 | ERC | EuropeCoin |
| 152 | 0x80000098 | DMD | Diamond |
| 153 | 0x80000099 | BTM | Bytom |
| 154 | 0x8000009a | BIO | Biocoin |
| 155 | 0x8000009b | XWC | Whitecoin |
| 156 | 0x8000009c | BTG | Bitcoin Gold |
| 157 | 0x8000009d | BTC2X | Bitcoin 2x |
| 158 | 0x8000009e | SSN | SuperSkynet |
| 159 | 0x8000009f | TOA | TOACoin |
| 160 | 0x800000a0 | BTX | Bitcore |
| 161 | 0x800000a1 | ACC | Adcoin |
| 162 | 0x800000a2 | BCO | Bridgecoin |
| 163 | 0x800000a3 | ELLA | Ellaism |
| 164 | 0x800000a4 | PIRL | Pirl |
| 165 | 0x800000a5 | XRB | RaiBlocks |
| 166 | 0x800000a6 | VIVO | Vivo |
| 167 | 0x800000a7 | FRST | Firstcoin |
| 168 | 0x800000a8 | HNC | Helleniccoin |
| 169 | 0x800000a9 | BUZZ | BUZZ |
| 170 | 0x800000aa | MBRS | Ember |
| 171 | 0x800000ab | HSR | Hcash |
| 172 | 0x800000ac | HTML | HTMLCOIN |
| 173 | 0x800000ad | ODN | Obsidian |
| 174 | 0x800000ae | ONX | OnixCoin |
| 175 | 0x800000af | RVN | Ravencoin |
| 176 | 0x800000b0 | GBX | GoByte |
| 177 | 0x800000b1 | BTCZ | BitcoinZ |
| 178 | 0x800000b2 | POA | Poa |
| 179 | 0x800000b3 | NYC | NewYorkCoin |
| 180 | 0x800000b4 | MXT | MarteXcoin |
| 181 | 0x800000b5 | WC | Wincoin |
| 182 | 0x800000b6 | MNX | Minexcoin |
| 183 | 0x800000b7 | BTCP | Bitcoin Private |
| 184 | 0x800000b8 | MUSIC | Musicoin |
| 185 | 0x800000b9 | BCA | Bitcoin Atom |
| 186 | 0x800000ba | CRAVE | Crave |
| 187 | 0x800000bb | STAK | STRAKS |
| 188 | 0x800000bc | WBTC | World Bitcoin |
| 189 | 0x800000bd | LCH | LiteCash |
| 190 | 0x800000be | EXCL | ExclusiveCoin |
| 191 | 0x800000bf | Lynx | |
| 192 | 0x800000c0 | LCC | LitecoinCash |
| 193 | 0x800000c1 | XFE | Feirm |
| 194 | 0x800000c2 | EOS | EOS |
| 195 | 0x800000c3 | TRX | Tron |
| 196 | 0x800000c4 | KOBO | Kobocoin |
| 197 | 0x800000c5 | HUSH | HUSH |
| 198 | 0x800000c6 | BANANO | Bananos |
| 199 | 0x800000c7 | ETF | ETF |
| 200 | 0x800000c8 | OMNI | Omni |
| 201 | 0x800000c9 | BIFI | BitcoinFile |
| 202 | 0x800000ca | UFO | Uniform Fiscal Object |
| 203 | 0x800000cb | CNMC | Cryptonodes |
| 204 | 0x800000cc | NRG | Energi |
| 205 | 0x800000cd | RIN | Ringo |
| 206 | 0x800000ce | ATP | PlatON |
| 207 | 0x800000cf | EVT | everiToken |
| 208 | 0x800000d0 | ATN | ATN |
| 209 | 0x800000d1 | BIS | Bismuth |
| 210 | 0x800000d2 | NEET | NEETCOIN |
| 211 | 0x800000d3 | BOPO | BopoChain |
| 215 | 0x800000d7 | BOXY | BoxyCoin |
| 216 | 0x800000d8 | FLO | Flo |
| 222 | 0x800000de | BITG | Bitcoin Green |
| 223 | 0x800000df | ASK | AskCoin |
| 224 | 0x800000e0 | SMART | Smartcash |
| 225 | 0x800000e1 | XUEZ | XUEZ |
| 226 | 0x800000e2 | HLM | Helium |
| 233 | 0x800000e9 | VAR | Varda |
| 242 | 0x800000f2 | NIM | Nimiq |
| 247 | 0x800000f7 | UC | Ulord |
| 253 | 0x800000fd | NPW | NewPowerCoin |
| 255 | 0x800000ff | SmartHoldem | |
| 256 | 0x80000100 | NANO | Bitcoin Nano |
| 257 | 0x80000101 | BTCC | Bitcoin Core |
| 258 | 0x80000102 | Zen Protocol | |
| 259 | 0x80000103 | ZEST | Zest |
| 270 | 0x8000010e | ONE | ONE |
| 271 | 0x8000010f | SBC | SBC |
| 299 | 0x8000012b | NUKO | Nekonium |
| 300 | 0x8000012c | GNX | Genaro Network |
| 312 | 0x80000138 | ARA | Aura |
| 321 | 0x80000141 | RAP | Rapture |
| 328 | 0x80000148 | BLOCK | Blocknet |
| 333 | 0x8000014d | MEM | MemCoin |
| 425 | 0x800001a9 | AION | Aion |
| 444 | 0x800001bc | PHR | Phore |
| 510 | 0x800001fe | KOTO | Koto |
| 512 | 0x80000200 | XRD | Radiant |
| 528 | 0x80000210 | YAP | Yapstone |
| 555 | 0x8000022b | BCS | Bitcoin Smart |
| 625 | 0x80000271 | EAST | Eastcoin |
| 666 | 0x8000029a | ACT | Achain |
| 668 | 0x8000029c | SSC | SelfSell |
| 777 | 0x80000309 | BTW | Bitcoin World |
| 800 | 0x80000320 | BEET | Beetle Coin |
| 801 | 0x80000321 | DST | DSTRA |
| 808 | 0x80000328 | QVT | Qvolta |
| 818 | 0x80000332 | VET | VeChain Token |
| 820 | 0x80000334 | CLO | Callisto |
| 886 | 0x80000376 | ADF | AD Token |
| 888 | 0x80000378 | NEO | NEO |
| 890 | 0x8000037a | XSEL | Seln |
| 998 | 0x800003e6 | LBTC | Lightning Bitcoin |
| 999 | 0x800003e7 | BCD | Bitcoin Diamond |
| 1000 | 0x800003e8 | BTN | Bitcoin New |
| 1002 | 0x800003ea | BKT | BanKitt |
| 1024 | 0x80000400 | ONT | Ontology |
| 1111 | 0x80000457 | BBC | Big Bitcoin |
| 1122 | 0x80000462 | CMT | CyberMiles Token |
| 1128 | 0x80000468 | ETSC | Ethereum Social |
| 1145 | 0x80000479 | CDY | Bitcoin Candy |
| 1337 | 0x80000539 | DFC | Defcoin |
| 1397 | 0x80000575 | HYC | Hycon |
| 1524 | 0x800005f4 | Taler | |
| 1620 | 0x80000654 | ATH | Atheios |
| 1688 | 0x80000698 | BCX | BitcoinX |
| 1729 | 0x800006c1 | XTZ | Tezos |
| 1815 | 0x80000717 | ADA | Cardano |
| 1856 | 0x80000743 | TES | Teslacoin |
| 1901 | 0x8000076d | CLC | Classica |
| 1919 | 0x8000077f | VIPS | VIPSTARCOIN |
| 1977 | 0x800007b9 | XMX | Xuma |
| 1987 | 0x800007c3 | EGEM | EtherGem |
| 1989 | 0x800007c5 | HODL | HOdlcoin |
| 1997 | 0x800007cd | POLIS | Polis |
| 2018 | 0x800007e2 | EOSC | EOSClassic |
| 2301 | 0x800008fd | QTUM | QTUM |
| 2302 | 0x800008fe | ETP | Metaverse |
| 2303 | 0x800008ff | GXC | GXChain |
| 2304 | 0x80000900 | SSC | SelfSell |
| 2305 | 0x80000901 | ELA | Elastos |
| 3552 | 0x80000de0 | DEO | Destocoin |
| 2718 | 0x80000a9e | NAS | Nebulas |
| 3377 | 0x80000d31 | ROI | ROIcoin |
| 4218 | 0x8000107a | IOTA | IOTA |
| 4242 | 0x80001092 | AXE | Axe |
| 5248 | 0x00001480 | FIC | FIC |
| 5757 | 0x8000167d | Stacks | |
| 6060 | 0x800017ac | GO | GoChain GO |
| 6666 | 0x80001a0a | BPA | Bitcoin Pizza |
| 6688 | 0x80001a20 | SAFE | SAFE |
| 6969 | 0x80001b39 | ROGER | TheHolyrogerCoin |
| 7777 | 0x80001e61 | BTV | Bitvote |
| 8339 | 0x80002093 | BTQ | BitcoinQuark |
| 8888 | 0x800022b8 | SBTC | Super Bitcoin |
| 8999 | 0x80002327 | BTP | Bitcoin Pay |
| 9888 | 0x800026a0 | BTF | Bitcoin Faith |
| 9999 | 0x8000270f | GOD | Bitcoin God |
| 10291 | 0x80002833 | BTR | Bitcoin Rhodium |
| 22504 | 0x800057e8 | PWR | PWRcoin |
| 31102 | 0x8000797e | ESN | EtherSocial Network |
| 31337 | 0x80007a69 | ThePower.io | |
| 33878 | 0x80008456 | BTCS | Bitcoin Stake |
| 37310 | 0x800091be | RSK Testnet | |
| 65536 | 0x80010000 | KETH | Krypton World |
| 99999 | 0x8001869f | WICC | Waykichain |
| 200625 | 0x80030fb1 | AKA | Akroma |
| 424242 | 0x80067932 | X42 | x42 |
| 1313114 | 0x8014095a | ETHO | Ether-1 |
| 1712144 | 0x801a2010 | LAX | LAPO |
| 5249353 | 0x80501949 | BCO | BitcoinOre |
| 5249354 | 0x8050194a | BHD | BitcoinHD |
| 5718350 | 0x8057414e | WAN | Wanchain |
| 5741564 | 0x80579bfc | WAVES | Waves |
| 91927009 | 0x857ab1e1 | kUSD | kUSD |
如上