Accepted Bitcoin Transaction Format¶
The Functions: Parser module of BTC-Relay can in theory be used to parse arbitrary Bitcoin transactions. However, the ONEBTC component of the BTC Bridge restricts the format of Bitcoin transactions to ensure consistency and prevent protocol failure due to parsing errors.
As such, Bitcoin transactions for which transaction inclusion proofs are submitted to BTC-Relay as part of the in the ONEBTC Issue, Redeem, and Replace protocols must be P2PKH or P2WPKH transactions and follow the format below.
Case 1: OP_RETURN Transactions¶
The OP_RETURN field can be used to store 40 bytes in a given Bitcoin transaction. The transaction output that includes the OP_RETURN is provably unspendable. We require specific information in the OP_RETURN field to prevent replay attacks in ONEBTC.
Many Bitcoin wallets automatically order UTXOs. We require that the Payment UTXO and the Data UTXO are made within the first three indexes (index 0 - 2). We do not require any specific ordering of those outputs. The reason behind checking for the first three outputs is that wallets like Electrum might insert the UTXOs returning part of the spent input at index 1.
Note
Please refer to the ONEBTC specification for more details on the Refund, Redeem and Replace protocols.
Inputs | Outputs |
---|---|
Arbitrary number of inputs | Index 0 to 2: Payment UTXO: P2PKH / P2WPKH output to Data UTXO: OP_RETURN containing Index 3-31: Any other UTXOs that will not be considered. |
The value and recipient address (btcAddress
) of the Payment UTXO and the identifier
in the Data UTXO (OP_RETURN) depend on the executed ONEBTC protocol:
- In Refund
btcAddress
is the Bitcoin address of the user for the refunding process andidentifier
is therefundId
of theRefundRequest
inRefundRequests
.- In Redeem
btcAddress
is the Bitcoin address of the user who triggered the redeem process andidentifier
is theredeemId
of theRedeemRequest
inRedeemRequests
.- In Replace
btcAddress
is the Bitcoin address of the new vault, which has agreed to replace the vault which triggered the replace protocol andidentifier
is thereplaceId
of theReplaceRequest
inReplaceRequests
.
Case 2: Regular P2PKH / P2WPKH / P2SH / P2WSH Transactions¶
We accept regular P2PKH, P2WPKH, P2SH, and P2WSH transactions. We ensure that the recipient address is unique via the On-Chain Key Derivation Scheme.
Many Bitcoin wallets automatically order UTXOs. We require that the Payment UTXO is included within the first three indexes (index 0 - 2). We do not require any specific ordering of those outputs. The reason behind checking for the first three outputs is that wallets like Electrum might insert the UTXOs returning part of the spent input at index 1.
Note
Please refer to the ONEBTC specification for more details on the Issue protocol.
Inputs | Outputs |
---|---|
Arbitrary number of inputs | Index 0 to 2: Payment UTXO: Output to Index 3-31: Any other UTXOs that will not be considered. |
The recipient address (btcAddress
) of the Payment UTXO is a address derived from the public key the vault submitted to the BTC-Bridge.