nomic-io / bitcoin-peg

Bitcoin sidechain module for Lotion and Coins (A Cosmos Bitcoin peg zone implementation)
MIT License
72 stars 14 forks source link

Split Bitcoin transactions #3

Open mappum opened 5 years ago

mappum commented 5 years ago

Bitcoin transactions signed by signatories use all spendable UTXOs as inputs (which come from deposits and change), and pay to all pending withdrawal outputs. The current implementation does this all in one big transaction.

Since transactions aren't Merkleized, clients that want to SPV-verify the transaction have to fetch the whole big tx. When this gets too big, we'll have to split this up into 3 transactions as in the design document: one with deposit UTXOs as inputs and 1 output, one that spends this and the previous change output, and another which pays the withdrawals. This way, clients can look at just the chain of the 2nd kind of transaction to follow the reserves of coins without needing the deposits/withdrawals.