diff options
author | Janus Troelsen <ysangkok@gmail.com> | 2019-02-01 16:26:33 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-01 16:26:33 +0100 |
commit | b690bbaa0f5e29615de8e4736fdf9fd47d7b2d14 (patch) | |
tree | bf2c96a98e04ab97e1c8cfc3a20b56c05032ba81 | |
parent | cefe6603ea21745db930ad2559fef358bbd7fe09 (diff) | |
download | diyhpluswiki-b690bbaa0f5e29615de8e4736fdf9fd47d7b2d14.tar.gz diyhpluswiki-b690bbaa0f5e29615de8e4736fdf9fd47d7b2d14.zip |
clarify TAS/FAS, introduce listing
-rw-r--r-- | transcripts/stanford-blockchain-conference/2019/miniscript.mdwn | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/transcripts/stanford-blockchain-conference/2019/miniscript.mdwn b/transcripts/stanford-blockchain-conference/2019/miniscript.mdwn index 92ee5b0..b2356d2 100644 --- a/transcripts/stanford-blockchain-conference/2019/miniscript.mdwn +++ b/transcripts/stanford-blockchain-conference/2019/miniscript.mdwn @@ -66,9 +66,15 @@ If you are at all familiar with recent work in Bitcoin Core about output descrip # Mapping to bitcoin script -So how are we going to map this to bitcoin script? The basic construction is pretty simple. You treat every subexpression as part of the script sequence of opcodes that expect its inputs, so its signature or whatever is expected from the top of stack and replaces it with a 0 or 1 at the top of the stack. A multisig turns into 2 A B C 3 CHECKMULTISIG. pk(A) turns into A CHECKSIG. and(X,Y) turns into X TAS Y FAS BOOLAND. or(X,Y) turns into X TAS Y FAS BOOLOR. thres(2,X,Y,Z) is X TAS Y FAS ADDTAS Z something something something. +So how are we going to map this to bitcoin script? The basic construction is pretty simple. You treat every subexpression as part of the script sequence of opcodes that expect its inputs, so its signature or whatever is expected from the top of stack and replaces it with a 0 or 1 at the top of the stack. -During execution, you have access to two stacks but the only operation you can do is move something from one stack to the other. So you have an alternate stack and the stack. +- pk(A) turns into `<A> CHECKSIG`. +- multi(2,A,B,C) turns into `2 <A> <B> <C> 3 CHECKMULTISIG`. +- and(X,Y) turns into `<X> TAS <Y> FAS BOOLAND`. +- or(X,Y) turns into `<X> TAS <Y> FAS BOOLOR`. +- thres(2,X,Y,Z) turns into `<X> TAS <Y> FAS ADD TAS <Z> FAS ADD 2 EQ`. + +TAS stands for "to alt stack" and FAS stands for "from alt stack. During execution, you have access to two stacks but the only operation you can do is move something from one stack to the other. So you have an alternate stack and the stack. # Optimizations |