{"id":"47ecb15f2a542c066ca7bd2b9137d96410ebc1d0d718f0279bb7b11cff287058","pubkey":"cbc5ef6b01cbd1ffa2cb95a954f04c385a936c1a86e1bb9ccdf2cf0f4ebeaccb","created_at":1728228891,"kind":1,"tags":[["p","66c292bee0a69c221aebd2f288ffe1efaa3163217161c9539337e2b0dd55136a"]],"content":"thereâs a lot of talk about âcovenantsâ but not a lot of understanding what that entails. lets do a little dive into how i think about the opcode proposals and how they relate to âenabling covenants on bitcoinâ\n\nwhat is a covenant?\n\ngreat question. a covenant is the ability to specify what the transaction that spends your bitcoin must look like. for example, you could say âthe transaction that spends this bitcoin must pay 500k sats to this addressâ or âthe transaction that spends this bitcoin must have a locktime set to block 880,000â \n\nin order to make these kinds of assertions in bitcoin transactions, you need the ability to find out what information is in the transaction that is spending an output. this information needs to be accessible when the script is running.\n\nbitcoin script is a limited programming language that you use to write locks for bitcoin. one of the limitations is what data you have access to while the program is running. \n\nso in order to write more âexpressiveâ bitcoin scripts, which can say âone output must be to my address and pay 500k satsâ, for example, you need to be able to look at the outputs on a transaction. \n\nthis ability to look at the info on a transaction is called âintrospectionâ. being able to introspect a transaction is a big missing piece in bitcoin. adding introspection enables you to write covenants.\n\nso how do you get introspection in bitcoin script? \n\nyou have to add a new opcode for it. in fact, weâve added two opcodes to bitcoin that enable introspection already: op-checklocktimeverify (op-cltv) and op-checksequenceverify (op-csv)\n\nthese look at the locktime/sequence of a transaction and require a certain value to be set in order to be valid. they were added in order to enable lightning, which uses both op-cltv and op-csv to make âprimitiveâ covenants. these were added to enable LN, to help scale bitcoin.\n\ntoday you could write a bitcoin script that asserts âthe transaction that spends this bitcoin must have a locktime set to block 880,000â. youâd use op-cltv to make that script, and any coins locked to that script wouldnât be spendable til block 880,000.\n\nthereâs no way to look at the output fields in a transaction though. you cant write a script that requires funds to go somewhere, youâd have to use presigned txs (like how lightning does) to make that kind of assertion.\n\nok so the goal of introspection is to let you look at what information is in a transaction thatâs spending a bitcoin output. we can do this already with op-cltv and op-csv. but this is limited just to timelocks, and doesnât let us make assertions about outputs, or other inputs.\n\nin the next post iâll talk about how the current opcode proposals (op-ctv, op-txhash, op-tx, op-cat) work and how they enable more broad tx introspection !\n\nif you found this interesting, check out nostr:npub1vmpf90hq56wzyxht6teg3llpa74rzcepw9suj5unxl3tph24zd4qgtxhm7 and our classes on bitcoin transactions!","sig":"70a9ef6169235c7e0d979557ab048a254faa1a0c2ca375745eea2349ac09aa94e4978160bdcb6e7867a070c29ace04599bb616ad6630861c73b1c4415acafb9a"}