Tapscript opcodes for Bitcoin smart contracts in the Arkade ecosystem
Experimental Technology
The Arkade Script opcodes are experimental technology in active development. All code and examples presented here are for exploration and proof of concept purposes only. Do not use in production environments.
Arkade Script consists of a set of Tapscript opcodes that extend Bitcoin Script’s functionality to enable powerful smart contracts. These opcodes are designed to work within the VTXO (Virtual Transaction Output) paradigm.
The VTXO paradigm provides two execution paths for every contract:
This dual-path approach ensures that contracts can execute efficiently offchain with server cooperation, while maintaining the security guarantee that users can always execute onchain after a timelock if the server becomes unavailable.
Arkade Script leverages a set of new Tapscript opcodes that extend Bitcoin Script’s functionality. These opcodes are implemented using the OP_SUCCESS
mechanism introduced in Taproot, which allows for cleaner opcode additions than the previous OP_NOP
approach.
Taproot already increases many resource limitations compared to previous segwit versions:
These opcodes overcome the 520-byte limitation for hashing operations while maintaining security against resource exhaustion:
OP_SUCCESS196
): Pops a bytestring and pushes a SHA256 context initialized with that dataOP_SUCCESS197
): Pops a bytestring and a SHA256 context, then pushes an updated contextOP_SUCCESS198
): Pops a bytestring and a SHA256 context, then pushes the final hash valueThese opcodes provide efficient access to transaction data, enabling covenants and complex state transitions:
OP_SUCCESS199
): Examines the outpoint of an inputOP_SUCCESS200
): Examines the asset of an inputOP_SUCCESS201
): Examines the value of an inputOP_SUCCESS202
): Examines the scriptPubKey of an inputOP_SUCCESS203
): Examines the sequence number of an inputOP_SUCCESS204
): Examines the issuance information of an inputOP_SUCCESS205
): Pushes the current input indexOP_SUCCESS206
): Examines the asset of an outputOP_SUCCESS207
): Examines the value of an outputOP_SUCCESS208
): Examines the nonce of an outputOP_SUCCESS209
): Examines the scriptPubKey of an outputOP_SUCCESS210
): Examines the version of the transactionOP_SUCCESS211
): Examines the locktime of the transactionOP_SUCCESS212
): Examines the number of inputs in the transactionOP_SUCCESS213
): Examines the number of outputs in the transactionOP_SUCCESS214
): Examines the weight of the transactionThese opcodes provide signed 64-bit arithmetic operations with overflow detection, overcoming the limitations of the 4-byte CScriptNum
:
OP_SUCCESS215
): 64-bit addition with overflow detectionOP_SUCCESS216
): 64-bit subtraction with overflow detectionOP_SUCCESS217
): 64-bit multiplication with overflow detectionOP_SUCCESS218
): 64-bit division with overflow detectionOP_SUCCESS219
): 64-bit negation with overflow detectionOP_SUCCESS220
): 64-bit less than comparisonOP_SUCCESS221
): 64-bit less than or equal comparisonOP_SUCCESS222
): 64-bit greater than comparisonOP_SUCCESS223
): 64-bit greater than or equal comparisonThese opcodes facilitate conversion between different numeric formats:
OP_SUCCESS224
): Converts a CScriptNum
to an 8-byte little-endian valueOP_SUCCESS225
): Converts an 8-byte little-endian value to a CScriptNum
OP_SUCCESS226
): Converts a 4-byte unsigned little-endian value to an 8-byte signed little-endian valueThese opcodes enable more complex cryptographic operations:
OP_SUCCESS227
): Verifies scalar multiplication of EC points (Q = k*P)OP_SUCCESS228
): Verifies Taproot key tweaking (Q = P + k*G)OP_PUSHCURRENTINPUTINDEX
with the input introspection opcodes to examine the current inputCScriptNum
, 4-byte LE, and 8-byte LE formats for arithmetic operations