Ultimate Replay Protection BIP
==============================
I've just read the article by Jimmy Song "How to Protect Against Replay Attacks".
Link:
https://bitcointechtalk.com/how-to-protect-against-replay-attacks-7a00bd2fe52f.
He explains possible replay protection approaches in case the hard fork does not
implement replay protection at all.
Jimmy Song suggested the below approaches:- Replay-protected UTXO (RePro-UTXO):
Use coinbase-derived output (aka replay-protected UTXO) as one of the inputs
of replay-protected transaction. - Simultaneous Submission
Submit two transactions simultaneously, each for its own blockchain. - Utilizing locktime
Helps in case one blockchain is longer that the other by (preferably)
at leaset 6 blocks.
Unfortunately, all the above approaches are far from being ideal.
Why? Here's why...
Problems with replay protection approaches:- Replay-protected UTXO (RePro-UTXO):
Privacy killer! All your own UTXO-s become tightly coupled with one RePro-UTXO
or a (small) number of RePro-UTXO-s. - Simultaneous Submission
May not work under heavy replay attack or needs to be repeated a number
of times (headache!). - Utilizing locktime
Does not help in case hard-forked blockchains grow at the same pace.
While, RePro-UTXO may be relatively easy implemented for exchanges,
it cannot be easily done by personal wallets, unless a market emerges
that trades RePro-UTXO-s for a low price.
So, I propose this BIP for ultimate replay-protection technique that can
be relatively easy implemented in Bitcoin Core and other projects.
A new script opcode is introduced "OP_BLOCKHASHEXIST" that makes
a transaction spendable only if the specific block hash exists
in the blockchain.
Let's assume that Bitcoin is hard-forked to blockchain1x and blockchain2x
and first mined blocks on both chains are block1x and block2x.
Then, to consume pre-hard fork P2PKH output on blockchain1x, the scriptPubKey
of the new consuming transaction will be:
scriptPubKey =
OP_BLOCKHASHEXIST
and for blockchain2x, apparently:
scriptPubKey = OP_BLOCKHASHEXIST
The byte-cost for this replay-protection is 21 bytes (1-byte opcode and
20-byte hash) and this cost has to be paid only once per hard-fork (for every
pre-hard fork UTXO or a group of pre-hard fork UTXO-s).
This approach does not contaminate memory pool as the newly incoming transction
with non-existing may be dropped immediately.
Also, this approach does not increase the chance of DoS attack as block header
hashes take a small amount of memory (about 1MB per year: 6 * 24 * 365 / 1024).
I believe this BIP may be relatively easy implemented and, hopefully, will
be accepted by development community.