eveybcd / BitcoinDiamond

Bitcoin Diamond Official Repo
MIT License
108 stars 61 forks source link

Replay protection? #2

Closed leto closed 6 years ago

leto commented 6 years ago

It seems that y'all forked from BTC 0.14.2 and did not implement something like SIGHASH_FORKID which allows Bitcoin Cash and Bitcoin Gold to have 2 way replay protection.

Did you guys implement replay protection in some other way or are you running a mainnet right now with no replay protection?

Ayms commented 6 years ago

I was about to ask the same question since I am adapting https://github.com/Ayms/bitcoin-transactions for BCD

Unlike what is stated on the official site (with mainnet live too) BCD just looks like a copy and paste of the bitcoin core code with some minor changes (that are not easy to detect since they did not fork the bitcoin repo), no replay protection, same address format and no bip143

Ayms commented 6 years ago

https://github.com/Ayms/bitcoin-transactions/issues/6

leto commented 6 years ago

Further looking into the code, how can block version in the blockheader and not in any transaction prevent replaying transactions? Your website says you have replay protection, but the code is not there, there is only some validation code.

jl777 commented 6 years ago

to get bidirectional replay protection you need to modify the signature method as I have previously described, or maybe some more complex methods are possible too.

However, block version bit is certainly not any replay protection. Until there is replay protection BCD will not be any part of barterDEX and people should be warned of the risks they are taking with their bitcoins

Ayms commented 6 years ago

to get bidirectional replay protection you need to modify the signature method as I have previously described, or maybe some more complex methods are possible too

Then what are you waiting for to implement it? (same for addresses format)

and people should be warned of the risks they are taking with their bitcoins

You can't be serious.... and that's not what your site is advertising

jl777 commented 6 years ago

why do you think this is my site? I have nothing to do with this coin

Ayms commented 6 years ago

Indeed... confused with "007"

jl777 commented 6 years ago

that is james bond, not me :)

buzztiaan commented 6 years ago

people on #bitcoin-forks pointed to https://github.com/eveybcd/BitcoinDiamond/blob/master/src/script/interpreter.cpp#L1207-L1210

Ayms commented 6 years ago

Yes, this is what @jimmysong describes too in https://medium.com/@jimmysong/bitcoin-diamond-super-bitcoin-bitcore-what-you-need-to-know-f49c35688a39

Now "The block hash can be any block hash that has already occurred as far as I can tell" is probably not correct

BCD team has introduced a preblockhash parameter everywhere, I don't know for now what it stands for exactly, neither don't get why the BCD team does not answer

Ayms commented 6 years ago

In fact the preblockhash parameter has probably a misleading name, it can be anything, even if it is set to the latest blockhash in some parts of the code (which looks quite strange, not to say stupid)

See https://github.com/Ayms/bitcoin-transactions/blob/master/tx.js#L127 for a custom 32B preblockhash

Not sure what is the rationale for this but fed up to guess things here

PenTesting commented 6 years ago

Developers, I urge you to provide an answer for this!

Starry9 commented 6 years ago

BitcoinDiamond replay protection as follows:

  1. Transaction version number is 12.
  2. Transaction has a new field is present_block_hash(preblockhash 32B), it's mean that the existed block hash which nearest the transaction created time.
  3. SignatureHash content contains present_block_hash.
Ayms commented 6 years ago

That's not totally true, preblockhash can be any 32B shxt you like, cf my previous link

Starry9 commented 6 years ago

The present_block_hash can be any 32B data and not checked now, it will be used for check in the future

leto commented 6 years ago

Just to be clear, this coin does not have proper 2way replay protection, for those following along at home.