Module agora.script.Lock

Contains the Lock / Unlock definitions

These are the types that will ultimately replace the signature in the Input and the address in the Output.

The Lock type contains a tag, allowing 4 different types of lock scripts:

Key => lock is a 64-byte public key, unlock is expected to be a signature. KeyHash => lock is a hash of a 64-byte public key, unlock is expected to be a pair of . This form may be used for better privacy. Script => lock is a script that will be evaluated by the engine. The unlock script may either be empty or only contain stack push opcodes. Redeem => lock is a , and unlock may only contain stack push opcodes, where the last push will be read as the redeem script.

Functions

NameDescription
genKeyLock(key) Compatibility (however may only be signed with Schnorr)
genKeyLock(key) Generates a LockType.Key lock script.
genKeyUnlock(sig) Generates a LockType.Key unlock script.
toLockType(value, lock) Converts the byte to one of the recognized lock types.
validateLockSyntax(lock, StackMaxItemSize) Validates the Lock script's syntax on its own. For user's safety, Agora's protocol rules disallow accepting an Output with a syntactically invalid Lock script. This prevents accidental loss of funds, for example in cases where the lock script is ill-formed (e.g. missing END blocks, dangling ELSE statements, etc).

Structs

NameDescription
Lock Contains a tag and either a Hash or set of opcodes
Unlock Contains a data tuple or a set of push opcodes

Enums

NameDescription
LockType The input lock types.