What are the main principles and/or patterns programmers must apply to their code in order to make their programs bulletproof towards transaction malleability attacks?
1 Answer
Use two tables for deposits basically.
insert deposits into one table with a unique hash. store sighash and txid with a unique hash and timestamp in the other. when the txid changes, you update the second table, preventing the duplicate deposit.
-
1@DougPeters no problem. its all about spreading awareness in the community. the stronger the developers, the stronger the economy. i've nver had a problem with it because i don't rely on wallet notify to store transactions, instead i dump an array of the last 100 transactions every 30 seconds iterate through it checking against the db(type receive), only crediting once the confirm > 6. this has performance drawbacks of course, and requires an extra script to periodically check already paid deposits(for changes in txhash and # of confirmations.– r3wtApr 4, 2014 at 18:06
-
i will opensource this solution soon, which is written in php/mysql, and it should be easily ported to other languages/configurations.– r3wtApr 4, 2014 at 18:07
-
Will you handle deposits per address or per transaction? When a transaction pays to multiple addresses in your wallet for example. Apr 23, 2014 at 8:42