-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Minimum required Dart SDK version updated to 3.3. - Implemented an abstract class for chain services. - Unified service provider design to support a single provider architecture across all `MRTNETWORK` packages.
- Loading branch information
1 parent
5a866c1
commit e042b98
Showing
306 changed files
with
3,725 additions
and
2,719 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,43 @@ | ||
void main() {} | ||
// ignore_for_file: unused_local_variable | ||
|
||
import 'package:blockchain_utils/blockchain_utils.dart'; | ||
|
||
void main() { | ||
const String passphrase = 'MRTNETWORK'; | ||
final mnemonic = Bip39MnemonicGenerator(Bip39Languages.japanese) | ||
.fromWordsNumber(Bip39WordsNum.wordsNum24); | ||
final seed = Bip39SeedGenerator(mnemonic).generate(passphrase); | ||
final ethereumWallet = Bip44.fromSeed(seed, Bip44Coins.ethereum); | ||
final defaultEthereumWallet = ethereumWallet.deriveDefaultPath; | ||
final ethereumaddress = defaultEthereumWallet.publicKey.toAddress; | ||
|
||
final tronmWallet = Bip44.fromSeed(seed, Bip44Coins.tron); | ||
final defaultTronWallet = ethereumWallet.deriveDefaultPath; | ||
final tronaddress = defaultEthereumWallet.publicKey.toAddress; | ||
|
||
Bip49.fromSeed(seed, Bip49Coins.litecoin); | ||
Bip84.fromSeed(seed, Bip84Coins.bitcoin); | ||
Bip86.fromSeed(seed, Bip86Coins.bitcoin); | ||
|
||
final bitconWallet = Bip44.fromSeed(seed, Bip44Coins.tron); | ||
final defaultBitcoinWallet = ethereumWallet.deriveDefaultPath; | ||
final bitconP2pkh = defaultEthereumWallet.publicKey.toAddress; | ||
|
||
final cardano = CardanoIcarusSeedGenerator(mnemonic.toStr()); | ||
|
||
final substrate = Substrate.fromSeed( | ||
List<int>.filled(32, 1), SubstrateCoins.polkadotSr25519); | ||
final substrateAddress = substrate.publicKey.toAddress; | ||
|
||
final moneromnemonic = | ||
MoneroMnemonicGenerator().fromWordsNumber(MoneroWordsNum.wordsNum25); | ||
final moneroSeed = MoneroSeedGenerator(moneromnemonic).generate(); | ||
final monero = MoneroAccount.fromSeed(moneroSeed); | ||
final moneroAddress = monero.primaryAddress; | ||
final subAddress = monero.subaddress(1, majorIndex: 0); | ||
|
||
final slip10Ed = Bip32Slip10Ed25519.fromSeed(List<int>.filled(32, 1)); | ||
final edWallet = slip10Ed.derivePath("44'/0'/0'"); | ||
final slipScp = Bip32Slip10Secp256k1.fromSeed(List<int>.filled(32, 1)); | ||
final ecWallet = slipScp.derivePath("44'/0'/0'/1/2"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,221 +1,46 @@ | ||
// // // ignore_for_file: avoid_print | ||
// ignore_for_file: unused_local_variable | ||
|
||
// import 'package:example/test/address/ada_shelly/ada_shelly.dart'; | ||
// import 'package:example/test/address/algo/algo.dart'; | ||
// import 'package:example/test/address/aptos/aptos.dart'; | ||
// import 'package:example/test/address/atom/atom.dart'; | ||
// import 'package:example/test/address/avax/avax.dart'; | ||
// import 'package:example/test/address/bch_p2pkh/bch_p2pkh.dart'; | ||
// import 'package:example/test/address/bch_p2sh/bch_p2sh.dart'; | ||
// import 'package:example/test/address/egld/egld.dart'; | ||
// import 'package:example/test/address/eos/eos.dart'; | ||
// import 'package:example/test/address/ergo/ergo.dart'; | ||
// import 'package:example/test/address/eth/eth.dart'; | ||
// import 'package:example/test/address/fil/fil.dart'; | ||
// import 'package:example/test/address/icx/icx.dart'; | ||
// import 'package:example/test/address/inj/inj.dart'; | ||
// import 'package:example/test/address/nano/nano.dart'; | ||
// import 'package:example/test/address/near/near.dart'; | ||
// import 'package:example/test/address/neo/neo.dart'; | ||
// import 'package:example/test/address/okex/okex.dart'; | ||
// import 'package:example/test/address/one/one.dart'; | ||
// import 'package:example/test/address/p2pkh/p2pkh.dart'; | ||
// import 'package:example/test/address/p2sh/p2sh.dart'; | ||
// import 'package:example/test/address/p2tr/p2tr.dart'; | ||
// import 'package:example/test/address/p2wpkh/p2wpkh.dart'; | ||
// import 'package:example/test/address/sol/sol.dart'; | ||
// import 'package:example/test/address/substrate/substrate.dart'; | ||
// import 'package:example/test/address/trx/trx.dart'; | ||
// import 'package:example/test/address/xlm/xml.dart'; | ||
// import 'package:example/test/address/xmr/xmr.dart'; | ||
// import 'package:example/test/address/xrp/xrp.dart'; | ||
// import 'package:example/test/address/xtz/xtz.dart'; | ||
// import 'package:example/test/address/zil/zil.dart'; | ||
// import 'package:example/test/algorand/mnemonic.dart'; | ||
// import 'package:example/test/base58/base58.dart'; | ||
// import 'package:example/test/base58/base58_xmr.dart'; | ||
// import 'package:example/test/bech32/bch_bech32.dart'; | ||
// import 'package:example/test/bech32/bech32.dart'; | ||
// import 'package:example/test/bech32/segwit_bech32.dart'; | ||
// import 'package:example/test/bip/bip32/ed25519/ed25519.dart'; | ||
// import 'package:example/test/bip/bip32/ed25519_blake2b/ed25519_blake2b.dart'; | ||
// import 'package:example/test/bip/bip32/ed25519_khalow/ed25519_khalow.dart'; | ||
// import 'package:example/test/bip/bip32/nist256p1/nist256p1.dart'; | ||
// import 'package:example/test/bip/bip32/secp256k1/secp256k1.dart'; | ||
// import 'package:example/test/bip/bip38/bip38_addr.dart'; | ||
// import 'package:example/test/bip/bip38/bip38_ec.dart'; | ||
// import 'package:example/test/bip/bip38/bip38_no_ec.dart'; | ||
// import 'package:example/test/bip/bip39/bip39.dart'; | ||
// import 'package:example/test/bip/bip44/bip44.dart'; | ||
// import 'package:example/test/bip/bip49/bip49.dart'; | ||
// import 'package:example/test/bip/bip84/bip84.dart'; | ||
// import 'package:example/test/bip/bip86/bip86.dart'; | ||
// import 'package:example/test/cardano/bip32/icarus.dart'; | ||
// import 'package:example/test/cardano/bip32/legacy.dart'; | ||
// import 'package:example/test/cardano/byron/byron_lagacy.dart'; | ||
// import 'package:example/test/cardano/cip1852/cip1852.dart'; | ||
// import 'package:example/test/cardano/mnemonic/mnemonic.dart'; | ||
// import 'package:example/test/cardano/shelly/shelly.dart'; | ||
// import 'package:example/test/cbor.dart'; | ||
// import 'package:example/test/crypto/aes/aes_ctr.dart'; | ||
// import 'package:example/test/crypto/blake2b/blake2b.dart'; | ||
// import 'package:example/test/crypto/chacha20_poly1305/chacha20_poly1305.dart'; | ||
// import 'package:example/test/crypto/crc32/crc32.dart'; | ||
// import 'package:example/test/crypto/hmac/hmac.dart'; | ||
// import 'package:example/test/crypto/keccack/keccack.dart'; | ||
// import 'package:example/test/crypto/md4/md4.dart'; | ||
// import 'package:example/test/crypto/md5/md5.dart'; | ||
// import 'package:example/test/crypto/pbkdf2/pbkdf2.dart'; | ||
// import 'package:example/test/crypto/ripemd/ripemd.dart'; | ||
// import 'package:example/test/crypto/scrypt/scrypt.dart'; | ||
// import 'package:example/test/crypto/sha1/sha1.dart'; | ||
// import 'package:example/test/crypto/sha256/sha256.dart'; | ||
// import 'package:example/test/crypto/sha3/sha3.dart'; | ||
// import 'package:example/test/crypto/sha512/sha512.dart'; | ||
// import 'package:example/test/crypto/sha512_256/sha512_256.dart'; | ||
// import 'package:example/test/crypto/shake/shake.dart'; | ||
// import 'package:example/test/crypto/x_modem_crc/x_modem_crc.dart'; | ||
// import 'package:example/test/ecdsa/ed.dart'; | ||
// import 'package:example/test/ecdsa/projective.dart'; | ||
// import 'package:example/test/elctrum/mnemonic/mnemonic.dart'; | ||
// import 'package:example/test/elctrum/v1/v1.dart'; | ||
// import 'package:example/test/elctrum/v2/v2.dart'; | ||
// import 'package:example/test/monero/mnemonic/monero_mnemonic.dart'; | ||
// import 'package:example/test/monero/monero.dart'; | ||
// import 'package:example/test/schnorrkel/derive.dart'; | ||
// import 'package:example/test/schnorrkel/schnorrkel_key.dart'; | ||
// import 'package:example/test/schnorrkel/sign.dart'; | ||
// import 'package:example/test/schnorrkel/vrf.dart'; | ||
// import 'package:example/test/secure_storage.dart'; | ||
// import 'package:example/test/ss58/ss58.dart'; | ||
// import 'package:example/test/substrate/scale.dart'; | ||
// import 'package:example/test/substrate/substrate.dart'; | ||
// import 'package:example/test/uuid.dart'; | ||
// import 'package:example/test/wif/wif.dart'; | ||
// import 'package:flutter/foundation.dart'; | ||
import 'package:blockchain_utils/blockchain_utils.dart'; | ||
|
||
// void main() { | ||
// _testAll(); | ||
// } | ||
void main() { | ||
const String passphrase = 'MRTNETWORK'; | ||
final mnemonic = Bip39MnemonicGenerator(Bip39Languages.japanese) | ||
.fromWordsNumber(Bip39WordsNum.wordsNum24); | ||
final seed = Bip39SeedGenerator(mnemonic).generate(passphrase); | ||
final ethereumWallet = Bip44.fromSeed(seed, Bip44Coins.ethereum); | ||
final defaultEthereumWallet = ethereumWallet.deriveDefaultPath; | ||
final ethereumaddress = defaultEthereumWallet.publicKey.toAddress; | ||
|
||
// typedef TestMethod = void Function(); | ||
final tronmWallet = Bip44.fromSeed(seed, Bip44Coins.tron); | ||
final defaultTronWallet = ethereumWallet.deriveDefaultPath; | ||
final tronaddress = defaultEthereumWallet.publicKey.toAddress; | ||
|
||
// /// its very slow in web debugging | ||
// /// if you want to test this method on the web should remove the condition | ||
// void _web() { | ||
// if (kIsWeb) return; | ||
// _test("bip38 No Ecdsa", bip38NoEcdsaTest); | ||
// _test("bip38 ECDSA", bip38ECDSATest); | ||
// _test("scrypt", testScrypt); | ||
// _test("pbkdf2", pbkdf2Test); | ||
// _test("secure storage", testSecureStorage); | ||
// } | ||
Bip49.fromSeed(seed, Bip49Coins.litecoin); | ||
Bip84.fromSeed(seed, Bip84Coins.bitcoin); | ||
Bip86.fromSeed(seed, Bip86Coins.bitcoin); | ||
|
||
// void _test(String name, TestMethod process) { | ||
// try { | ||
// process(); | ||
// print("success $name"); | ||
// } catch (e) { | ||
// print("failed $name $e"); | ||
// throw Exception(); | ||
// } | ||
// } | ||
final bitconWallet = Bip44.fromSeed(seed, Bip44Coins.tron); | ||
final defaultBitcoinWallet = ethereumWallet.deriveDefaultPath; | ||
final bitconP2pkh = defaultEthereumWallet.publicKey.toAddress; | ||
|
||
// void _testAll() async { | ||
// final DateTime start = DateTime.now(); | ||
// _encodeDecodeAddrTest(); | ||
// _test("UUID", testUUID); | ||
// _test("bech32", bech32Test); | ||
// _test("wif", wifTest); | ||
// _test("substrate scale", substrateScaleTest); | ||
// _test("ss58", ss58Test); | ||
// _test("bip38 ", bip38Test); | ||
// _test("segwit Bech32 ", segwitBech32Test); | ||
// _test("bch bech32", bchBech32Test); | ||
// _test("base58 xmr", testBase58XMR); | ||
// _test("base58", testBase58); | ||
// _test("bip49", bip49Test); | ||
// _test("bip44", bip44Test); | ||
// _test("algorandMnemonic and derive address", algorandMnemonicAndAddressTest); | ||
// _test("substrate derive", substrateDeriveTest); | ||
// _test("monero mnemonic", moneroMnemonucTest); | ||
// _test("monero", moneroTest); | ||
// _test("electrum v2", electrumV2Test); | ||
// _test("electrum v1", electrumV1Test); | ||
// _test("electrum mnemonic", electrumMnemonicTest); | ||
// _test("cardano shelly", cardanoShellyTest); | ||
// _test("cardano mnemonic", cardanoMnemonicTest); | ||
// _test("cardano cip1852", cip1852Test); | ||
// _test("byron legacy", byronLegacyTest); | ||
// _test("cardano icarus", cardanoIcarusTest); | ||
// _test("cardano legacy", cardanoLegacyTest); | ||
// _test("bip86", bip86Test); | ||
// _test("bip84", bip84Test); | ||
// _test("bip39", testBip39); | ||
// _test("secp256k1", secpTest); | ||
// _test("nist", nistTest); | ||
// _test("ed25519-blake2b", edBlake2bTest); | ||
// _test("ed25519-khalow", edKhalowTest); | ||
// _test("ed25519", edTest); | ||
// _test("schnorr", schnoorTestDerive); | ||
// _test("vrf sigh", vrfSignTest); | ||
// _test("schnorrkel keys", schnoorKeyTest); | ||
// _test("schnorrkel-sign", testSchnoor); | ||
// _test("ecdsa", testECDSA); | ||
// _test("eddsa", testEDDSa); | ||
// _test("sha1", testSha1); | ||
// _test("ripemd", testRipemd); | ||
// _test("md5", md5Test); | ||
// _test("md4", md4Test); | ||
// _test("keccack", testKecc); | ||
// _test("hmac", testHmac); | ||
// _test("crc", crcTest); | ||
// _test("chacha-poly1305", chachaTest); | ||
// _test("aes", testAes); | ||
// _test("blake2b", blake2bTest); | ||
// _test("sha256", testSha256); | ||
// _test("sha512", testSha512); | ||
// _test("sha3", testSha3); | ||
// _test("sha512/256", testSha512256); | ||
// _test("modemCrc", testModemCrc); | ||
// _test("shake digest", testShakeDigest); | ||
// _test("cbor test", cborTest); | ||
// _web(); | ||
// final DateTime end = DateTime.now(); | ||
// print("end: ${end.difference(start).inMilliseconds}"); | ||
// } | ||
final cardano = CardanoIcarusSeedGenerator(mnemonic.toStr()); | ||
|
||
// void _encodeDecodeAddrTest() { | ||
// _test("zil Address", zilAddressTest); | ||
// _test("xtz Address", xtzAddressTest); | ||
// _test("xrp Address", xrpAddressTest); | ||
// _test("xmr Address", xmrAddressTest); | ||
// _test("xlm Address", xlmAddressTest); | ||
// _test("trx Address", trxAddressTest); | ||
// _test("substrate Address", substrateAddressTest); | ||
// _test("sol Address", solAddressTest); | ||
// _test("p2wpkh Address", p2wpkhAddressTest); | ||
// _test("p2tr Address", p2trAddressTest); | ||
// _test("p2sh Address", p2shAddressTest); | ||
// _test("p2pkh Address", p2pkhAddressTest); | ||
// _test("one Address", oneAddressTest); | ||
// _test("okex Address", okexAddressTest); | ||
// _test("neo Address", neoAddressTest); | ||
// _test("near Address", nearAddressTest); | ||
// _test("nano Address", nanoAddressTest); | ||
// _test("injAddressTest", injAddressTest); | ||
// _test("icx Address", icxAddressTest); | ||
// _test("fil Address", filAddressTest); | ||
// _test("ethereum Address", ethereumAddressTest); | ||
// _test("ergo Address", ergoAddressTest); | ||
// _test("eos Address", eosAddrTest); | ||
// _test("egld Address", egldAddrTest); | ||
// _test("bchP2sh Address", bchP2shAddressTest); | ||
// _test("bchP2pkh Address", bchP2pkhTest); | ||
// _test("avax Address", avaxAddrTest); | ||
// _test("atom Address", atomAddressTest); | ||
// _test("aptos Address", aptosAddressTest); | ||
// _test("algo Address", algoAddressTest); | ||
// _test("ada Shelly Address", adaShellyAddrTest); | ||
// } | ||
void main() {} | ||
// final cardano = CardanoShelley.fromCip1852Object(seed, Bip44Coins.tron); | ||
// final defaultBitcoinWallet = ethereumWallet.deriveDefaultPath; | ||
// final bitconP2pkh = defaultEthereumWallet.publicKey.toAddress; | ||
final substrate = Substrate.fromSeed( | ||
List<int>.filled(32, 1), SubstrateCoins.polkadotSr25519); | ||
final substrateAddress = substrate.publicKey.toAddress; | ||
|
||
final moneromnemonic = | ||
MoneroMnemonicGenerator().fromWordsNumber(MoneroWordsNum.wordsNum25); | ||
final moneroSeed = MoneroSeedGenerator(moneromnemonic).generate(); | ||
final monero = MoneroAccount.fromSeed(moneroSeed); | ||
final moneroAddress = monero.primaryAddress; | ||
final subAddress = monero.subaddress(1, majorIndex: 0); | ||
|
||
final slip10Ed = Bip32Slip10Ed25519.fromSeed(List<int>.filled(32, 1)); | ||
final edWallet = slip10Ed.derivePath("44'/0'/0'"); | ||
final slipScp = Bip32Slip10Secp256k1.fromSeed(List<int>.filled(32, 1)); | ||
final ecWallet = slipScp.derivePath("44'/0'/0'"); | ||
} |
Oops, something went wrong.