Space Scripts
Script format is still experimental and may change before launch on Bitcoin mainnet
Space scripts are embedded within standard Bitcoin scripts and are interpreted as a NOP by the Bitcoin blockchain but they define protocol specific operations on top of what can already be specified with Bitcoin scripting capabilities.
Scripts are identified with a 4-byte magic (0xDE repeated) followed by the script length encoded as varint followed by the script. The script may span over multiple Bitcoin push bytes. \
For example, to encode the following space script:
It would look like this
Embedded in a Bitcoin script:
Space scripts could be embedded across a series of consecutive OP_PUSHBYTES. This makes space scripts very flexible and enable future extensibility. To make it into a valid Bitcoin script you need to drop those bytes off the stack using either OP_DROP
or OP_FALSE OP_IF <script> OP_ENDIF
Space Op Codes
The following are the op codes useable within a space script
OP | Code | Input | Output | Description |
---|---|---|---|---|
OP_PUSH | 0x00 | <varint> | data | Pushes the specified data to the stack |
OP_OPEN | 0x01 | <space name> | -- | Removes the top stack item. Reveals the space name for auction. Requires a Bid PSBT to be carried in the transaction |
OP_SET | 0x02 | <vout><bytes> | -- | Removes the top stack item; associates the given bytes with the space output at the specified index |
OP_SETALL | 0x03 | <bytes> | -- | Removes the top stack item; associates the given bytes with all spaces being transferred in this transaction |
OP_NOP_4 ... 1D | 0x04..0x1D | -- | -- | Nothing |
OP_RESERVE ... FF | 0x1E..0xFF | -- | -- | Marks space as reserved until the specific op code is enabled in a future upgrade |
Last updated