1
I wanna understand how can a user find a certain transaction he created on the blockchain without him knowing on which block it belongs ? does he have to go over all the blocks using bloom filters to find his transaction ? narrow the search to an interval of timestamps ? there must be a special mechanism ...
I searched on google but all i found were websites to find them for u, i want to understand the actual mechanism used in the bitcoin protocol?
Block Explorers seems to be storing those transactions in special databases and they use their own approach to find transactions ... My question is about how full nodes find those transactions ? do they go over the whole chain trying to find them ?
1Are you asking about how to search for a transaction using Bitcoin Core? There is an RPC for that, assuming you enabled indexing. Or are you asking how Bitcoin Core does it? Bitcoin and Ethereum will be different, but you can visit ethereum.stackexchange.com – JBaczuk – 2019-07-01T17:41:12.847
About how Bitcoin core does it – rachid chami – 2019-07-01T19:16:43.367
Bitcoin Core does not do this. It has a database of unspent outputs, and adds/removes outputs from that database. It (generally) does not have an index into the blockchain, or even the entire blockchain at all available. – Pieter Wuille – 2019-07-01T19:43:24.370
Then my question is, how websites like block explorer works. – rachid chami – 2019-07-01T20:18:36.500
Seems like it was covered in here https://bitcoin.stackexchange.com/questions/58844/how-block-explorer-technology-works but without great details or how exactly it works, just the general idea behind. But apparently, there isnt any native mechanism to the protocol that lets u search in blocks, u just need to go over all the blocks and search for transactions (in Eth, using bloom filters to know if a certain transaction belongs) in a way or another.
– rachid chami – 2019-07-01T20:27:45.870@rachidchami Bitcoin Core is a full node and hence maintains the entire database of the blockchain. If you are using a lightweight nodes that use SPV, those use bloom filters to query full nodes for transaction. These lightweight clients are then sent the merkle path by the full nodes that shows that the transaction is in the blockchain – Ugam Kamat – 2019-07-02T07:38:33.307
@UgamKamat. How does the full nodes find such transactions ? do they go over the whole chain ? – rachid chami – 2019-07-02T15:47:46.510
@rachidchami The answer to your question is too broad for it to be posted as a comment. Here is an answer link: https://bitcoin.stackexchange.com/questions/81188/spv-clients-querying-the-full-node.
– Ugam Kamat – 2019-07-02T16:26:48.133@UgamKamat thank you so much for your help. – rachid chami – 2019-07-02T16:37:18.760