Skip to content

Java Example

Gabriel Cardona edited this page Jun 21, 2019 · 1 revision

HdPrivateKey myPriv = KeyGenerator.generate(); System.out.println("Your seed is " + myPriv.getSeedString());

WalletBackendSession session = new WalletBackendSession();

session.registerPubkey(myPriv.getPublicKey());

Address receiveAddress = session.getNewAddress();

System.out.println("Send BCH to " + receiveAddress.toCashAddr());

System.out.println("You have " + session.getBalace().toString() + " BCH in your wallet");

TransactionProposal proposal = session.initiatePayment(address, amount);

myPriv.signTransactionProposal(proposal);

BroadcastResult result = session.sendSignedTransaction(proposal);

if (result.isSuccessful()) { System.out.println("Bitcoin cash was sent as tx " + result.getTxId()); }

session.close();

Clone this wiki locally