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
);
- 使用springboot框架
- 语言为java,kotlin
- 使用rabbitmq消息队列
- mysql云数据库
- xxl-job分布式定时任务框架
任何使用本源码从事商业活动,对别人和自己造成损失的,本人概不负责!