- Made
tools.make_scripthash_lock
,tools.make_scripthash_witness
,parsing.get_symbols
,parsing.parse_comptime
, andparsing.assemble
visible at the module root level.
- Fix:
OP_EVAL
now includes plugin support - Changed
OP_SPLIT
andOP_SPLIT_STR
to take index parameter from stack - Added another signature extension e2e test
- Added
make_scripthash_lock
andmake_scripthash_witness
tools - Added REPL in
tools.repl
and made it accessible via CLI:tapescript repl
- Added comptime (preprocessor) features to parsing:
~ { ops }
is replaced with the byte code forops
as a hexadecimal symbol before assembly (i.e. it compilesops
and replaces the symbol section with the result);~! { ops }
causesops
to be compiled and executed, then the whole section is replaced with the top item in the Stack as a hexadecimal symbol.
- Signature extension system: call a plugin at the beginning of each of the
following ops, passing it the runtime:
CHECK_SIG
,CHECK_MULTISIG
,SIGN
, andGET_MESSAGE
. Each plugin function must have this signature:Callable[[Tape, LifoQueue, dict], None]
- Example sig extension implementation using values in cache key b'sigext'
- Signature extension system uses an underlying scoped plugin system. In the future, additional OPs may get plugin hooks using this system.
- Slightly simplified
CHECK_SIG
andSIGN
to now useGET_MESSAGE
instead of repeating that message construction logic. To avoid calling plugins twice, a new Tape containing only the sigflag is passed toGET_MESSAGE
by these calls. - New class
Stack
with item size limits to avoid denial of service attack from the 6 byte scripttrue loop { dup concat }
. Refactor system to use newStack
. (Internally usecollections.deque
.) - Removed
OP_PUSH4
- Redefined x05 to be
OP_GET_MESSAGE
and x59 to beNOP89
- Reversed the order in which the message and signature are pulled from the
queue by
CHECK_SIG_QUEUE
to make it equivalent to theOP_CSFS
BIP. - Reversed the order of
CONCAT
to make it equivalent to theOP_CAT
BIP. - Reversed the order of outputs of
DECRYPT_ADAPTER_SIG
to for compatability with changedCONCAT
. - Renamed ops:
OP_SIGN_QUEUE
->OP_SIGN_STACK
OP_CHECK_SIG_QUEUE
->OP_CHECK_SIG_STACK
OP_READ_CACHE_Q
->OP_READ_CACHE_STACK
OP_READ_CACHE_Q_SIZE
->OP_READ_CACHE_STACK_SIZE
- Changed aliases:
OP_RCS
(RCS
) ->OP_RCZ
(RCZ
)OP_RCQ
(RCQ
) ->OP_RCS
(RCS
)OP_RCQS
(RCQS
) ->OP_RCSZ
(RCSZ
)OP_CSQ
(CSQ
) ->OP_CSS
(CSS
)OP_CTV
(CTV
) ->OP_CTSV
(CTSV
)
- Added
OP_CTS
alias forOP_CHECK_TIMESTAMP
- Added
OP_CAT
alias forOP_CONCAT
- Added
OP_CATS
alias forOP_CONCAT_STR
- Added new classes
Script
,ScriptLeaf
, andScriptNode
and replaced thecreate_merklized_script
function withcreate_merklized_script_prioritized
to make using the newOP_MERKLEVAL
easier. - Updated all tool functions to use the
Script
class - Added
Script.__bytes__
,Script.__str__
, andScript.__add__
- Added
ScriptProtocol
representingScript
functionality - Added
ScriptProtocol
compatibility to script running functions - Fix:
OP_LOOP
now exits ifOP_RETURN
is called within the loop body - Added
OP_CHECK_TEMPLATE
(OP_CT
) andOP_CHECK_TEMPLATE_VERIFY
(OP_CTV
) - Added
OP_TAPROOT
(OP_TR
) - Fixed
OP_DIV_FLOAT
arithmetic bug - Changed
OP_RANDOM
to take its argument from the stack instead of the tape - Added
OP_ADD
alias forOP_ADD_INTS
- Added
OP_SUB
alias forOP_SUBTRACT_INTS
- Added
OP_MULT
alias forOP_MULT_INTS
- Added
OP_DIV
alias forOP_DIV_INTS
- Added
OP_MOD
alias forOP_MOD_INTS
- Improved documentation generation
- Fixed
OP_NOT
to do a proper bitwiseNOT
operation. - Switched the
true
value from0x01
to0xff
for compatibility withFALSE NOT
- Fixed compiler to handle negative ints.
- Added 32-bit float type to arg parsing forsome args: preface the value with
f
.
- Changed
OP_CHECK_TRANSFER
to pull thecount
parameter from the queue. - Added
OP_LESS
: pulls ints value1 and value2 from the queue and putsvalue1<value2
onto the queue. - Added
OP_LESS_OR_EQUAL
(aliasOP_LEQ
): pulls ints value1 and value2 from the queue and putsvalue1<=value2
onto the queue. - Added
OP_GET_VALUE s"key"
(aliasOP_VAL
): puts the read-only cache values at the string key onto the queue. - Added example txn protocol using a sequence number (held in a sigfield) and sequence number constraint. Included an e2e test implementing eltoo protocol.
- Added
OP_FLOAT_LESS
(aliasOP_FLESS
): pulls floats value1 and value2 from the queue and putsvalue1<value2
onto the queue. - Added
OP_FLOAT_LESS_OR_EQUAL
(aliasOP_FLEQ
): pulls floats value1 and value2 from the queue and putsvalue1<=value2
onto the queue. - Added
OP_INT_TO_FLOAT
(aliasOP_I2F
): pulls an int from the queue, converts it to a float, then puts it back onto the queue. - Added
OP_FLOAT_TO_INT
(aliasOP_F2I
): pulls a float from the queue, converts it to an int, then puts its back onto the queue. - Added
OP_LOOP
: simple "while" loop that runs its code block until the top value of the queue is false; raises an error if loop runs more thanTape.callstack_limit
times. - Added
OP_CHECK_MULTISIG flags m n
(aliasOP_CMS
) to do a Bitcoin-style m-of-n multisig: pullsn
public keys from queue, then pullsm
signatures from queue, then checks each signature against each public key; puts False onto queue if public key is used more than once or if any signature that does not validate to a public key, else puts True onto queue. - Added
OP_CHECK_MULTISIG_VERIFY flags m n
(aliasOP_CMSV
) to runOP_CHECK_MULTISIG
followed byOP_VERIFY
. - Changed
IF
syntax to use '{' and '}' instead of '(' and ')' to designate blocks. - Refactored compiler innards.
- Added compiler ability to hoist statements between parentheses following
IF
to run before theOP_IF
, e.g.IF ( @var1 @var2 LEQ ) { ...
will now hoist to@var1 @var2 LEQ IF {...
. Inclusion of parenthetic substatements is optional. - Added
OP_SIGN flags
: takes a signing key seed from the queue, signs a message constructed from sigfields not blanked by the flags, and puts that signature onto the queue. - Added
OP_SIGN_QUEUE
: takes a signing key seed and message from the queue, signs the message, and puts the signature onto the queue. - Added
OP_CHECK_SIG_QUEUE
: takes a verify key, signature, and message from the queue; puts True onto the queue if the signature was valid for the vkey and message, otherwise puts False onto the queue. - Reversed order of items placed onto queue after
OP_SPLIT
andOP_SPLIT_STR
. - Updated
OP_EQUAL
to use a timing attack safe comparison. - Added
OP_XOR
,OP_OR
, andOP_AND
bitwise operators. - Added
OP_DERIVE_SCALAR
,OP_CLAMP_SCALAR
,OP_ADD_SCALARS
,OP_SUBTRACT_SCALARS
,OP_DERIVE_POINT
, andOP_SUBTRACT_POINTS
to expose more ed25519 maths. - Added
OP_MAKE_ADAPTER_SIG_PUBLIC
,OP_MAKE_ADAPTER_SIG_PRIVATE
,OP_CHECK_ADAPTER_SIG
, andOP_DECRYPT_ADAPTER_SIG
to allow easier use of adapter signatures. - Added
OP_INVOKE
and associatedCanBeInvoked
interface for more flexible contracts that can be invoked withOP_INVOKE
. - Added a simple CLI and a bunch of new tools for using adapter signatures, HTLCs, PTLCs, and AMHLs.
- Expanded the variable syntax to include directly pulling items from the queue.
- Added a macro and variable system to the compiler.
- Added OP code aliases.
- Improved compiler and fixed some edge cases.
- Extended comment support to within control flow blocks.
- Fixed string value parsing.
- Refactored compiler logic.
- Improved compiler error reporting.
- Improved
OP_EVAL
and other subtape execution OPs. - Bug fixes.
- Bug fixes.
- Compiler improvement: handle
OP_TRY_EXCEPT
withinOP_IF
andOP_IF_ELSE
.
- Bug fixes.
- Replaced
NOP61
withOP_TRY_EXCEPT
. Constitutes a hard fork, but nobody is using this yet, so no harm done. - Reduced maximum subtape size from 16MB to 64KB, saving a byte in encoded size
arguments for
OP_IF
,OP_IF_ELSE
,OP_DEF
, andOP_TRY_EXCEPT
.