bitcoinj-cash / bitcoinj

A library for working with Bitcoin
http://bitcoinj.cash
Apache License 2.0
64 stars 35 forks source link

Cannot send transaction #56

Closed sparr0w7 closed 6 years ago

sparr0w7 commented 6 years ago

This is the code that I made. Is there anything to correct?

public void send(String toAddress , String amount) { try { SendRequest request = SendRequest.to(Address.fromBase58(getMainNetNetwork(), toAddress), Coin.parseCoin(amount)); kit.wallet().completeTx(request); kit.wallet().commitTx(request.tx); kit.peerGroup().broadcastTransaction(request.tx).broadcast(); } catch (InsufficientMoneyException e) { e.printStackTrace(); } }

HashEngineering commented 6 years ago

See #4 , first few comments.

sparr0w7 commented 6 years ago

SendRequest.setUseForkId(true) <--- added code???

SendRequest request = SendRequest.to(Address.fromBase58(getMainNetNetwork(), toAddress), Coin.parseCoin(amount)); request.setUseForkId(true);

I speak a very basic level of English. Sorry

HashEngineering commented 6 years ago

Yes, that is the answer.

sparr0w7 commented 6 years ago

Thank you a lot :)

HashEngineering commented 6 years ago

Great, we will count this issue as closed.