Adding callback hooks to the satoshi client [combined summary]



Individual post summaries: Click here to read the original discussion on the bitcoin-dev mailing list

Published on: 2012-03-24T08:41:25+00:00


Summary:

Eric Lombrozo, a Bitcoin developer, is interested in obtaining detailed information about message format errors that occur when nodes connect to bitcoind for debugging purposes. He wants to know if a transaction gets rejected due to various reasons such as an invalid signature, being out of range, or if the output couldn't be connected. Additionally, he wants to know if a transaction is claiming an output that has already been claimed by another transaction.To address this issue, Lombrozo has inserted tracers and stubs into bitcoind. However, he would prefer to write an error log and inform the connecting node about what went wrong using callbacks, which could be configured in a similar way to the RPC in the bitcoin.conf file. Lombrozo suggests having a separate channel for this type of data rather than including it in the Bitcoin protocol itself to avoid potential attacks.The author suggests implementing a callback architecture in applications to handle events related to Bitcoin transactions without requiring access to the wallet space. This can be done by using HTTP POST requests to subscribe to specific events such as new transactions or blocks being seen, which is supported by libcoin. Other types of events, including node connections and disconnections, potential attacks, and alerts related to the status of bitcoind, could also be useful.The proposed system would allow for all I/O to be done via IPC or over network sockets, ensuring that other code never needs to enter into the wallet-handling process/memory space. This approach makes it easier to handle events without requiring direct access to the underlying Bitcoin process.In a discussion on March 22, 2012, Eric Lombrozo proposed adding callback hooks to the main branch of code in the Satoshi client to improve apps that require real-time event notifications. He offered to assist in reorganizing the code and contributing source code to implement this proposal. However, there were concerns about allowing other code into the main wallet-handling process/memory space. Instead, it was suggested to design a Wallet Protocol for general use between the wallet and GUIs/applications.In a forum post from 2012, Lombrozo expressed his need for real-time event notifications and proposed adding callback hooks to the main Bitcoin branch. He explained that his previous approaches of writing his own library or making custom builds of the Satoshi client were not ideal due to code duplication and the risk of breaking patches. Lombrozo offered to help locate key points in the source code, reorganize it, define a callback mechanism, and contribute source code.Another forum member, Matt, replied to Lombrozo's proposal, stating that he had worked on changing the internal Bitcoin code to use callback hooks but it was still incomplete and usable only within the Satoshi client itself. Matt also mentioned that the stability of the blockstore API might be uncertain in the future and provided a link to his work on Github.Overall, these discussions highlight the challenges faced by developers who require real-time event notifications and their efforts to find effective solutions within the Bitcoin ecosystem. Lombrozo's proposal of adding callback hooks to the main branch and designing a Wallet Protocol shows potential for improving the handling of events related to Bitcoin transactions.


Updated on: 2023-08-01T03:24:30.186076+00:00