I have been working on my project where I use web3j. I work with ledger over contract wrappers where the actual call to the ledger is encapsulated over variety of layers.

The issue is I need to get a hash of tx when it has been put into the pool, not after it has been mined.

Current implementation of the contract wrappers gives me txReceipt only after it has been mined. I have not found yet any way to get it before it has been mined.

Do you know a solution?

A wider context is after the call to the chain from a mobile client, I need to verify does tx succeed or not. I plan to do it via call web3.ethGetTransactionByHash(txHash).

1 Answer 1


You can subscribe to PendingTransactionFlowable API of the Web3J to get txHash as soon as it is submitted to mempool. But thing to note here is that this transaction MAY BE rejected due to any error..... So make sure you write another logic where you compare the transactionHash when it has received at least 1 confirmation.

web3j.pendingTransactionFlowable().subscribe(x-> {

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.