transactions

Transactions

Overview

When someone spends their Haircomb, a transaction is created. Transaction is confirmed using 21 on chain commitments.Transaction is a permanent redirect of all past, present and furure funds from the source address to the destination address.

On liquidity graph, transaction from source to destination is represented as an edge from source to destination.

Process and Structure

Transaction Flow

  • Initiation: The sender cuts their Haircomb at 21 positions (the frontier). This yields 21 commitments which are then commited on the bitcoin chain.
  • Processing: The bitcoin chain confirms the transaction commitments using 8 confirmations.
  • Completion: Once 8 on chain confirmations are processed, the sender gives the transaction to the recipient.
  • Validation: The recipient validates the transaction, determining if there is (or isn't) doublespend with certainty.

Transaction Structure

  • Components: Transaction consists of the 21 commitment preimages (the frontier), plus the source and the destination address.
  • Format: Wallet import format
  • Mechanism: The haircomb public key (source address) signs the Txid. Txid is SHA256(source address CAT destination address) on the mainnet.
  • Data Fields: Commitment preimage - commits to an on chain commitment. Source address - the address of the sender (haircomb public key). Destination address - the payable address where the funds go.

Wallet import format - Mainnet

/tx/recv/{21 x uppercase hex commitment preimages}{uppercase hex source address}{uppercase hex destination address}\r\n

Wallet import format - Testnet

\tx\recv\{21 x uppercase hex commitment preimages}{uppercase hex source address}{uppercase hex destination address}\r\n

Example Use Cases

Use Case 1: Merging of wallets

  • Description: The sender having multiple Haircomb keypairs wishes to merge the wallets into one keypair.
  • Process: The sender initiates a transaction from one of his keypair to the main keypair.
  • Outcome: The funds are merged into the main keypair.

Use Case 2: Payment for goods or services

  • Description: Alice wants to purchase goods or services from Bob using her Haircomb wallet. She will initiate a transaction to send funds from her Haircomb address to Bob's address.
  • Process:
  • Selection of Addresses: Alice selects her source address (her Haircomb public key) and a change address where any unspent funds will be returned.
    • 2. Recipient Details: Alice enters Bob's destination address and the amount she wishes to send. She can specify unlimited recipients and amounts if needed.
    • 3. Transaction Completion: Alice finalizes the payment by making 21 commitments, which involves tipping 21 different addresses with 330 sats each. These commitments are broadcast to the Bitcoin blockchain.
    • 4. Validation: Once the 21 commitments are confirmed with 8 blockchain confirmations, the transaction is considered complete. Bob receives the transaction and validates it to ensure there are no double-spends.
  • Outcome:
    • Alice's funds are successfully transferred to Bob's address.
    • The transaction is permanently recorded on the blockchain, ensuring transparency and immutability.
    • The Haircomb system's liquidity graph is updated with a new edge from Alice's source address to Bob's destination address, reflecting the transaction.
    • Alice's change address holds any remaining funds from the transaction.

Summary

Summarize the key points about transactions, including their process, structure, and practical applications. Emphasize the role of transactions in ensuring smooth and secure operations within the Haircomb system.