bitpay / insight

A bitcoin blockchain explorer and API
https://insight.bitpay.com/
MIT License
1.19k stars 1.11k forks source link

Display transaction malleability clones #430

Open ryanxcharles opened 10 years ago

ryanxcharles commented 10 years ago

A recent issue affecting the bitcoin network is transaction malleability. Two transactions with the same inputs and outputs can have different txids. This can confuse many applications that assume the txid of a transaction is unchangeable. It would be great if insight could display information about transaction clones. The way this could work is that on the transaction page, any clones are also displayed. That way anybody investigating a transaction will immediately see that it has clones.

Matias already has code that does this, but there are some complications to incorporating this in bitcore. One of the complications is that in order to have a thorough ability to detect clones, insight will need to connect to independent bitcoind nodes. That is because a bitcoind node will detect clones as double spends and not resend them. The only way bitcoind will broadcast a clone is if it is included in a block. So by connecting to one bitcoind node, you will see only the first clone, and then a possible subsequent clone after it is included in a block. But by connecting to multiple nodes, you will see all (or most) broadcasted clones.

I think it makes a lot of sense to have insight connect to multiple independent bitcoind nodes. One would be the local bitcoind node, and others would just be other nodes on the network that insight directly connects to. It should be different nodes than the one that the local bitcoind node is connected to. This would give insight a greater ability to detect both clones and double spends.

matiu commented 10 years ago

Yes!

Just to keep it mind: https://github.com/matiu/stupid-clones

we can grab parts from it.

On Wed, Mar 12, 2014 at 11:54 AM, Ryan X. Charles notifications@github.comwrote:

A recent issue affecting the bitcoin network is transaction malleability. Two transactions with the same inputs and outputs can have different txids. This can confuse many applications that assume the txid of a transaction is unchangeable. It would be great if insight could display information about transaction clones. The way this could work is that on the transaction page, any clones are also displayed. That way anybody investigating a transaction will immediately see that it has clones.

Matias already has code that does this, but there are some complications to incorporating this in bitcore. One of the complications is that in order to have a thorough ability to detect clones, insight will need to connect to independent bitcoind nodes. That is because a bitcoind node will detect clones as double spends and not resend them. The only way bitcoind will broadcast a clone is if it is included in a block. So by connecting to one bitcoind node, you will see only the first clone, and then a possible subsequent clone after it is included in a block. But by connecting to multiple nodes, you will see all (or most) broadcasted clones.

I think it makes a lot of sense to have insight connect to multiple independent bitcoind nodes. One would be the local bitcoind node, and others would just be other nodes on the network that insight directly connects to. It should be different nodes than the one that the local bitcoind node is connected to. This would give insight a greater ability to detect both clones and double spends.

— Reply to this email directly or view it on GitHubhttps://github.com/bitpay/insight/issues/430 .

Matías Alejo Garcia Skype/Twitter: @ematiu Roads? Where we're going, we don't need roads!

maraoz commented 10 years ago

The difficult part of connecting insight/bitcore to multiple nodes, is that you cannot rely anymore on the bitcoind gateway filtering some network events which may bring inconsistencies. The extra checks that would be needed, if I understand correctly, include:

Maybe @jgarzik can give us more hints here