Virtual UTXOs
Last updated
Last updated
Brollup is built on the concept of , enabling their use in smart contracts as payable constructs.
Brollup transactions are off-chain coinswaps between VTXOs and calldata. Similar to how the swaps VTXOs for new VTXOs, Brollup swaps VTXOs for calldata (plus new VTXOs).
VTXOs are verifiable off-chain and enforceable on-chain. Calldata, on the other hand, undergoes client-side validation; Bitcoin nodes see the bytes, while Brollup nodes read and interpret the bytes.
Since calldata is evaluated in a client-side validated context and VTXOs are verifiable off-chain, a VTXO can be swapped for calldata that executes a payable condition in a smart contract. For example, the contract can grant tokens to the msg.sender
in exchange for paid Bitcoin, with the location of the payment VTXO derived from the calldata.
This approach covers over 90% of DeFi use cases, whether listing an NFT for sale in exchange for Bitcoin—where the buyer pays with Bitcoin upon execution—or placing a token sell order on a decentralized exchange, where the filler pays with Bitcoin upon execution. All of this is atomically executed, verifiable, scalable, and enforceable on Bitcoin.
This is an example of an NFT marketplace contract that can run on Brollup, containing three callable methods:
nft_auction_list msg.sender (Alice) calls this method to list her piece for sale, providing two arguments: her NFT contract address (Contract) and price tag (u32).
nft_auction_buy msg.sender (Bob) calls this method to buy Alice’s piece, providing an argument and a payment: Alice’s NFT contract address (Contract) and the Bitcoin payment (Payable).
nft_auction_cancel msg.sender (Alice) calls this method to cancel her listing if no one is interested in buying her piece, providing one argument: her NFT contract address.