Find Transaction By Transaction Hash
Ideally you would have saved the transaction hash, and then you can query for the transaction using this transaction hash. Here is an example:
> eth.sendTransaction({from: eth.accounts[0], to: eth.accounts[1], value: web3.toWei(1.23456, "ether")})
"0x4a950bc3651c991aa2ff50fc49601e69960f1f75823df3d4a5dfc7d3c5e3c190"
Use eth.getTransaction(txHash)
to get the transaction details. The transaction has not been mined into a block yet:
> eth.getTransaction("0x4a950bc3651c991aa2ff50fc49601e69960f1f75823df3d4a5dfc7d3c5e3c190")
{
blockHash: null,
blockNumber: null,
from: "0xa485ab3ad17cd9aca6fd5343a53a513685c7e0ed",
gas: 90000,
gasPrice: 20000000000,
hash: "0x4a950bc3651c991aa2ff50fc49601e69960f1f75823df3d4a5dfc7d3c5e3c190",
input: "0x",
nonce: 201,
to: "0xcf358622d70f62f212aef64e7e26e4746dc84eb3",
transactionIndex: null,
value: 1234560000000000000
}
The transaction has just been mined:
I0430 21:20:39.493822 14719 worker.go:569] commit new work on block 10543 with 1 txs & 0 uncles. Took 1.257998ms
> eth.getTransaction("0x4a950bc3651c991aa2ff50fc49601e69960f1f75823df3d4a5dfc7d3c5e3c190")
{
blockHash: "0xeb71b38f6301c570a46d864a0159ddd2b352dec8409a64f210778d8826e4fda0",
blockNumber: 10543,
from: "0xa485ab3ad17cd9aca6fd5343a53a513685c7e0ed",
gas: 90000,
gasPrice: 20000000000,
hash: "0x4a950bc3651c991aa2ff50fc49601e69960f1f75823df3d4a5dfc7d3c5e3c190",
input: "0x",
nonce: 201,
to: "0xcf358622d70f62f212aef64e7e26e4746dc84eb3",
transactionIndex: 0,
value: 1234560000000000000
}
Find Transaction Using A Script To Search For Transaction To/From Account
Otherwise see the answer Script To Find Transactions To/From An Account to the question Common useful JavaScript snippets for geth for a scripts to search the blockchain for your transaction.
Unfortunately, there is no filter provided to parse the confirmed transactions without going through a block first i.e., you can trigger a filter (and execute call_async_method()) whenever there is a latest block: eth.getBlock("latest")
, but there is no such function for a transaction.
That said, if you're operating on a private blockchain (you trust all the nodes) and believe that all the initiated transactions will successfully be added to the blockchain, you can create filters to react upon eth.pendingTransactions
so that the actions like call_async_method() will be performed immediately without waiting for the transactions to get confirmed and added to the blockchain. However, at a later time, you should always check if these transactions are indeed confirmed.
This is not an ideal or recommended solution and contradicts with the fundamental principles of blockchain, but you can test and check if it's suitable for your use case.
Edit:
Fast way to scan blocks for transactions on an account. This is an asynchronous scanner with 200 threads: https://ethereum.stackexchange.com/a/7184/2460
Source code here.
Best Answer
The answer is no.
Quoted answer: https://ethereum.stackexchange.com/a/10894/36613