From: Rusty Russell <rusty@rustcorp.com.au>
To: <bitcoin-dev@lists.linuxfoundation.org>
Cc: Christian Decker <decker@blockstream.com>,
Russell O'Connor <roconnor@blockstream.com>
Subject: [bitcoin-dev] Covenants through merkelized txids.
Date: Fri, 10 Nov 2017 12:01:14 +1030 [thread overview]
Message-ID: <87lgjex6l9.fsf@rustcorp.com.au> (raw)
Hi all,
This is an alternative to jl2012's BIPZZZ (OP_PUSHTXDATA[1]).
It riffs on the (ab)use of OP_CHECKSIGFROMSTACK that Russell[2]
used to implement covenants[3]. I've been talking about it to random
people for a while, but haven't taken time to write it up.
The idea is to provide a OP_TXMERKLEVERIFY that compares the top stack
element against a merkle tree of the current tx constructed like so[4]:
TXMERKLE = merkle(nVersion | nLockTime | fee, inputs & outputs)
inputs & outputs = merkle(inputmerkle, outputmerkle)
input = merkle(prevoutpoint, nSequence | inputAmount)
output = merkle(nValue, scriptPubkey)
Many variants are possible, but if we have OP_CAT, this makes it fairly
easy to test a particular tx property. A dedicated OP_MERKLE would make
it even easier, of course.
If we one day HF and add merklized TXIDs[5], we could also use this method
to inspect the tx *being spent* (which was what I was originally trying to
do).
Thanks for reading!
Rusty.
[1] https://github.com/jl2012/bips/blob/vault/bip-0ZZZ.mediawiki
[2] Aka Dr. "Not Rusty" O'Connor. Of course both of us in the same thread will
probably break the internet.
[3] https://blockstream.com/2016/11/02/covenants-in-elements-alpha.html
[4] You could put every element in a leaf, but that's less compact to
use: cheaper to supply the missing parts with OP_CAT than add another level.
[5] Eg. use the high nVersion bit to say "make my txid a merkle".
reply other threads:[~2017-11-10 1:32 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87lgjex6l9.fsf@rustcorp.com.au \
--to=rusty@rustcorp.com.au \
--cc=bitcoin-dev@lists.linuxfoundation.org \
--cc=decker@blockstream.com \
--cc=roconnor@blockstream.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox