gradle方式 在你的build.gradle里面
repositories {
maven { url 'https://jitpack.io' }
}
dependencies {
compile 'com.github.pai01234:tokencore:1.0.8.3'
}
try {
Files.createDirectories(Paths.get("${keyStoreProperties.dir}/wallets"))
} catch (Throwable ignored) {
}
//KeystoreStorage是接口,实现它的getdir方法
WalletManager.storage = KeystoreStorage();
WalletManager.scanWallets();
String password = "123456";
Identity identity = Identity . getCurrentIdentity ();
if (identity == null) {
Identity.createIdentity(
"token",
password,
"",
Network.MAINNET,
Metadata.P2WPKH
);
}
Identity identity = Identity . getCurrentIdentity ()
String password ="123456";
List<String> chainTypes = new ArrayList();
chainTypes.add(ChainType.BITCOIN);
List<Wallet> wallets = identity . deriveWalletsByMnemonics (
chainTypes,
password,
MnemonicUtil.randomMnemonicCodes()
);
String password ="123456";
String toAddress ="dsadsadsadsa";
int changeIdx =0;
long amount =1000L;
long fee =555L;
//utxos需要去节点或者外部api获取
ArrayList<UTXO> utxos = new ArrayList();
BitcoinTransaction bitcoinTransaction = BitcoinTransaction (
toAddress,
changeIdx,
amount,
fee,
utxos
);
TxSignResult txSignResult = bitcoinTransaction . signTransaction (
ChainId.BITCOIN_MAINNET.toString(),
password,
wallet
);
本人不提供联系方式,有问题提交issue,暂时不合作 本人最近觉得做技术赚的不多还很累,所以打算开源区块链钱包后台的代码,但是最近okex的号被盗了资产清零了,我现在很惆怅。
所以我提供以下数字货币钱包,大家如果觉得软件对您有帮助的话,可以往下面地址转币进行捐赠
比特币
1DVEEbd3JFhM4RCXk7p3nSjyrgDRdfbHpZ
以太坊
0x19788062a1057b2258622b53912d7d6c726bf736
波场
TWfFoVLKTA1LDkGDRW7yCQv8uhPKHrzHk1
捐赠完至少50usdt后可以截图交易,在tokencore库里面提交issue,并且提供自己联系方式,我核实后会联系您,可以考虑提供技术援助