Published on: 2016-02-27T09:08:22+00:00
One idea to reduce the size of transaction hashes is to use a 4 to 6 byte shorthash, which would have a low chance of resulting in collision with another transaction in a large mempool. To protect against potential attacks, different salt values can be set up for each connection and a salted hash can be used instead of the full thing. This technique could potentially reduce INV traffic by 5-8x in the asymptotic case, or maybe 2-3x for a realistic case. The additional memory overhead per peer per tx would be about 12 bytes, but it would save up to 28 bytes per peer*tx of network bandwidth.In an email exchange on Feb 25, 2016, Gregory Maxwell reported that the batching feature in versions 0.10 and 0.12 of a certain software was temporarily affected, but has since been fully functional again. This feature enables the ability to batch many transactions per INV effectively. The response was prompted by examination of 0.11-series versions which rarely send out INV batches. In this examination, it was noted that about 85% of the packets had a single hash.Jonathan Toomim, a Bitcoin developer, suggested implementing an option for batched INV (inventory) on the Bitcoin network that would increase efficiency by including the hashes for two transactions in one IP packet. This would increase the INV size to 229 bytes for 64 bytes of payload, resulting in an 88.8% marginal efficiency increase for each hash after the first.He believed waiting and accumulating several hashes together before sending as a batched INV could reduce Bitcoin node traffic by a factor of 2. However, this suggestion was found to have already been implemented since the early days of Bitcoin. The batching feature was temporarily affected between the 0.10 and 0.12 versions but has been fully functional again, with one INV now managing to batch many transactions effectively. The average batching size is about 5 seconds long and usually contains around 10 transactions per INV, as seen from debug measurements. While tweaking the system may improve efficiency, it is not expected to change the asymptotic efficiency of the network.The INV scheme used by Bitcoin is very inefficient due to the overheads of TCP, IP, ethernet and ACKs. Each INV takes up to 193 bytes, with only 16.5% efficiency for each of the payloads. An improvement could be the implementation of batched INVs where the hashes for two transactions per IP packet instead of one can be included. This would increase the INV size to 229 bytes for 64 bytes of payload (88.8% efficiency) after the first hash. Waiting a short period of time to accumulate several hashes together and send them could reduce the traffic of running bitcoin nodes by a factor of 2 or more. However, if too many people used it, it could slow down the propagation of transactions across the bitcoin network slightly. This could be mitigated by choosing a different batch size for each peer based on their preferences.
Updated on: 2023-08-01T17:53:01.494130+00:00