I am trying to implement the Proof of Existence using below code.
NetworkParameters params = TestNet3Params.get();
WalletAppKit kit = new WalletAppKit(params, new File("."), "wallettest");
kit.startAsync();
kit.awaitRunning();
System.out.println("Wallet Balance :" + kit.wallet().getBalance());
System.out.println("Wallet :" + kit.wallet().toString());
Coin amount = Coin.parseCoin("0");
Sha256Hash hash3 = Sha256Hash.of(doc);
System.out.println("Before sending hash doc"+hash3.toString());
// Create a tx with an OP_RETURN output
Transaction tx = new Transaction(params);
tx.addOutput(amount,
ScriptBuilder.createOpReturnScript(hash3.getBytes()));
Wallet.SendResult result =
kit.wallet().sendCoins(kit.peerGroup(),SendRequest.forTx(tx));
System.out.println("coins sent. transaction hash: " +
result.tx.getHashAsString());
I am able to execute the code and transaction get posted in testnet and
below is the URL where we can see my transaction.
https://testnet.blockexplorer.com/tx/346f5aab325efe0bb54f6f7e9fc36816129d08027c2815851cf64a111c67cdfc
In this transaction, the transaction is got completed by deducting the
mining fee from one address in the wallet(which is selected by bitcoinj API
by default) and the remaining value is getting transferred to different
address within the same wallet. Can i know why it is transferring the
remaining amount to the different address and can we restrict so that only
the mining fee will get deducted.
--
You received this message because you are subscribed to the Google Groups
"bitcoinj" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.