Skip to content

Instantly share code, notes, and snippets.

@loon3
Last active January 4, 2024 21:44
Show Gist options
  • Save loon3/0685ddd8fe57c7e8178ed85c4566a496 to your computer and use it in GitHub Desktop.
Save loon3/0685ddd8fe57c7e8178ed85c4566a496 to your computer and use it in GitHub Desktop.
Counterparty Asset PSBTs for BTC market

Counterparty Asset PSBT Structure

Note: Uses Counterparty send message type ID = 0

Party A (Seller)

  1. Inputs:

    • Input 1: 546 satoshis (from Party A's address).
  2. Outputs:

    • Output 1: 546 satoshis intended for Party B's address which becomes asset recipient (address is alterable).
    • Output 2: OP_RETURN output with send message data including only asset name and quantity (immutable).
    • Output 3: Purchase price (ex. 100,000 satoshis) sent back to Party A's address (immutable).

Party B (Buyer)

  1. Inputs:

    • Multiple Inputs: Totaling enough satoshis to cover the purchase price (ex. 100,000 satoshis) plus the transaction fee. The exact number of inputs and their values depend on Party B's available funds and the network fee rates at the time of transaction completion.
  2. Outputs:

    • Output 1: Party B completes this by adding their address. This output is meant to receive 546 satoshis.
    • Output 4: Change output for Party B (if necessary)

After Party B adds their inputs and completes Output 1, the PSBT can be finalized and broadcasted to the Bitcoin network.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment