Bitcoin Data Availability
Last updated
Last updated
Each trading transaction includes the tokens from the trading wallet and the pool, a sequence number, and Uniswap data. Users can compare the balance change between transaction inputs and outputs with Uniswap data, and compare the Uniswap data with the EVM contract to verify the Bitcoin transaction. Below is the structure of each type of trading transaction:
Inputs:
Input 0: Pool init UTXO
Remaining Inputs: UTXOs from the trading wallet to init the pool
Outputs:
Output 0: New pool init UTXO
Outputs 1-10: New pool liquidity UTXOs
Outputs 11 to m: radFiOP_12
outputs containing pool initialization data
Output m+1: Runestone OP_RETURN
Output m+2: Trading wallet’s rune change
Output m+3: Trading wallet’s Bitcoin change
Example:
Inputs:
Input 0: Pool init UTXO (from the previous pool init transaction)
Input 1: Trading wallet’s UTXOs containing Bitcoin funds to provide liquidity for the new pool and cover the transaction fee
Input 2: Trading wallet’s UTXO containing Rune tokens to provide liquidity for the new pool
Outputs:
Output 0: New pool init UTXO (for use in the next pool init transaction)
Outputs 1-5: New pool liquidity UTXOs containing the liquidity added for the new pool
Outputs 6-10: Additional pool liquidity UTXOs, but containing no liquidity due to the limit on the Runestone OP_RETURN
script size
Outputs 11-12: Pool initialization data, combining two ScriptPubKey
data that follow OP_12
:
Byte 0 (Flag): 1 (indicates providing liquidity)
Bytes 1-4 (UpperTick, big endian int32): 887200
Bytes 5-8 (LowerTick, big endian int32): -887200
Remaining Bytes: Contain 11 uvarint128
values:
Amount0: 10000964745485757151
Amount1: 1000
InitPrice: 792243410400884224932
Token0Decimal: 18
Token1Decimal: 8
SequenceNumber: 57
Fee: 100 (1%)
Token0Id - Block: 885548
Token0Id - Tx: 319
Token1Id - Block: 0
Token1Id - Tx: 0
Output 13: Runestone OP_RETURN
containing data for the liquidity token in the new UTXOs and Rune change for the trading wallet
Output 14: Trading wallet’s Rune change UTXO, containing any remaining Rune tokens
Output 15: Trading wallet’s Bitcoin change UTXO, containing any remaining Bitcoin
Inputs:
n inputs (n <= 10): Pool liquidity UTXOs
Remaining inputs: Trading wallet’s UTXOs to add liquidity
Outputs:
n outputs: New pool liquidity UTXOs containing the added liquidity
Outputs n to m: radFi OP_12
outputs containing added liquidity data
Output m+1: Runestone OP_RETURN
Output m+2: Trading wallet’s rune change
Output m+3: Trading wallet’s Bitcoin change
Inputs:
Inputs 0-3: Pool liquidity UTXOs
Input 4: Trading wallet’s UTXOs containing Bitcoin funds to provide liquidity for the pool and cover the transaction fee
Input 5: Trading wallet’s UTXO containing Rune tokens to provide liquidity for the pool
Outputs:
Outputs 0-3: New pool liquidity UTXOs containing the liquidity added for the pool
Output 4: radFi OP_12
script containing add liquidity data:
Byte 0 (Flag): 1 (Providing liquidity flag)
Bytes 1-4 (UpperTick, big endian int32): 887200
Bytes 5-8 (LowerTick, big endian int32): -887200
Remaining bytes: Contain 11 uvarint128
values:
Amount0: 10000964745485757151
Amount1: 1000
InitPrice: 0
Token0Decimal: 18
Token1Decimal: 8
SequenceNumber: 58
Fee: 100 (1%)
Token0Id - Block: 885548
Token0Id - Tx: 319
Token1Id - Block: 0
Token1Id - Tx: 0
Output 5: Runestone OP_RETURN
containing data for the liquidity token in the new UTXOs and Rune change for the trading wallet
Output 6: Trading wallet’s Rune change UTXO containing any remaining Rune tokens
Output 7: Trading wallet’s Bitcoin change UTXO containing any remaining Bitcoin
Inputs:
n inputs (n <= 10): Pool liquidity UTXOs
Remaining inputs: Trading wallet’s UTXOs to swap
Outputs:
n outputs: New pool liquidity UTXOs
Outputs n to m: radFi OP_12
outputs containing swap data
Output m+1: Runestone OP_RETURN
Output m+2: Trading wallet’s token swap output
Output m+3: Trading wallet’s rune change
Output m+4: Trading wallet’s Bitcoin change
Inputs:
Inputs 0-1: Pool liquidity UTXOs
Input 2: Trading wallet’s UTXOs containing Bitcoin funds to swap and cover the transaction fee
Outputs:
Outputs 0-1: New pool liquidity UTXOs
Output 2: radFi OP_12
script containing swap data:
Byte 0 (Flag): 2 (Swap flag)
Byte 1:
First bit (IsExactIn): true
Remaining 7 bits (PoolsCount, uint8): 1
Remaining bytes: Contain 8 uvarint128
values:
AmountIn: 1000
AmountOut: 7444327141368519190
SequenceNumber: 66
Fee: 100 (1%)
Input TokenId - Block: 0
Input TokenId - Tx: 0
Output TokenId - Block: 885548
Output TokenId - Tx: 319
Output 3: Runestone OP_RETURN
containing data for the liquidity in the new UTXOs and Rune output for the trading wallet
Output 4: Trading wallet’s swap output UTXO
Output 5: Trading wallet’s Rune change UTXO (contains no Rune in this example due to no trading wallet’s Rune input)
Output 6: Trading wallet’s Bitcoin change UTXO containing the remaining Bitcoin for the user
Inputs:
Inputs 0-3: Pool liquidity UTXOs
Input 4: Trading wallet’s UTXOs containing Bitcoin funds to cover the transaction fee
Inputs 5-6: Trading wallet’s UTXOs containing Rune funds to swap
Outputs:
Outputs 0-3: New pool liquidity UTXOs
Output 4: radFi OP_12
script containing swap data:
Byte 0 (Flag): 2 (Swap flag)
Byte 1:
First bit (IsExactIn): true
Remaining 7 bits (PoolsCount, uint8): 1
Remaining bytes: Contain 8 uvarint128
values:
AmountIn: 11000000000000000000
AmountOut: 1299
SequenceNumber: 69
Fee: 100 (1%)
Input TokenId - Block: 885548
Input TokenId - Tx: 319
Output TokenId - Block: 0
Output TokenId - Tx: 0
Output 5: Runestone OP_RETURN
containing data for the liquidity in the new UTXOs and Rune change for the trading wallet
Output 6: Trading wallet’s swap output UTXO
Output 7: Trading wallet’s Rune change UTXO
Output 8: Trading wallet’s Bitcoin change UTXO containing the remaining Bitcoin for the user
Inputs:
n inputs (n <= 10): Pool liquidity UTXOs
Remaining inputs: Trading wallet’s Bitcoin UTXOs to pay the transaction fee
Outputs:
n outputs: New pool liquidity UTXOs
Outputs n to m: radFi OP_12
outputs containing withdraw liquidity data
Output m+1: Runestone OP_RETURN
Output m+2: Trading wallet’s withdrawn Rune liquidity
Output m+3: Trading wallet’s withdrawn Bitcoin liquidity and Bitcoin change
Inputs:
Inputs 0-3: Pool liquidity UTXOs
Input 4: Trading wallet’s UTXOs containing Bitcoin funds to cover the transaction fee
Outputs:
Outputs 0-3: New pool liquidity UTXOs
Output 4: radFi OP_12
script containing withdraw liquidity data:
Byte 0 (Flag): 3 (Withdraw liquidity flag)
Remaining bytes: Contain 10 uvarint128
values:
LiquidityValue: 100004823610
NftId: 8
Amount0: 9621866398363189269
Amount1: 1039
SequenceNumber: 94
Fee: 100 (1%)
Token0Id - Block: 885548
Token0Id - Tx: 319
Token1Id - Block: 0
Token1Id - Tx: 0
Output 5: Runestone OP_RETURN
containing data for the liquidity in the new UTXOs and withdrawn Rune for the trading wallet
Output 6: Trading wallet’s Rune change UTXO
Output 7: Trading wallet’s withdrawn Bitcoin liquidity and Bitcoin change UTXO
Inputs:
n inputs (n <= 10): Pool liquidity UTXOs
Remaining inputs: Trading wallet’s Bitcoin UTXOs to pay the transaction fee
Outputs:
n outputs: New pool liquidity UTXOs
Outputs n to m: radFi OP_12
outputs containing collect fees data
Output m+1: Runestone OP_RETURN
Output m+2: Trading wallet’s collected Rune fees
Output m+3: Trading wallet’s collected Bitcoin fees and Bitcoin change
Inputs:
Input 0: Pool liquidity UTXO
Input 1: Trading wallet’s UTXOs containing Bitcoin funds to cover the transaction fee
Outputs:
Output 0: New pool liquidity UTXO
Output 1: radFi OP_12
script containing collect fees data:
Byte 0 (Flag): 4 (Collect fees flag)
Remaining bytes: Contain 9 uvarint128
values:
NftId: 8
Amount0: 52894105064729815
Amount1: 6
SequenceNumber: 93
Fee: 100 (1%)
Token0Id - Block: 885548
Token0Id - Tx: 319
Token1Id - Block: 0
Token1Id - Tx: 0
Output 2: Runestone OP_RETURN
containing data of liquidity in the new UTXOs and collected Rune fees for the trading wallet
Output 3: Trading wallet’s collected Rune fees UTXO
Output 4: Trading wallet’s collected Bitcoin fees and Bitcoin change UTXO
Inputs:
n inputs (n <= 10): Pool liquidity UTXOs
Remaining inputs: Trading wallet’s UTXOs to increase liquidity
Outputs:
n outputs: New pool liquidity UTXOs
Outputs n to m: radFi OP_12
outputs containing increase liquidity data
Output m+1: Runestone OP_RETURN
Output m+2: Trading wallet’s Rune change
Output m+3: Trading wallet’s Bitcoin change
Inputs:
Inputs 0-3: Pool liquidity UTXOs
Inputs 4-5: Trading wallet’s UTXOs containing Bitcoin funds to increase liquidity for the pool’s position and cover the transaction fee
Input 6: Trading wallet’s UTXO containing Rune token to increase liquidity for the pool’s position
Outputs:
Outputs 0-3: New pool liquidity UTXOs
Output 4: radFi OP_12
script containing increase liquidity data:
Byte 0 (Flag): 5 (Increase liquidity flag)
Remaining bytes: Contain 11 uvarint128
values:
Min0: 0
Min1: 0
NftId: 14
Amount0: 10000964745485757151
Amount1: 1000
SequenceNumber: 64
Fee: 5 (0.05%)
Token0Id - Block: 885548
Token0Id - Tx: 319
Token1Id - Block: 0
Token1Id - Tx: 0
Output 5: Runestone OP_RETURN
containing data of liquidity in the new UTXOs and Rune change for the trading wallet
Output 6: Trading wallet’s Rune change UTXO
Output 7: Trading wallet’s Bitcoin change UTXO
Example:
Example:
Example:
Example:
Example:
Example: