KIP 17#32
Conversation
|
|
||
| #### Transaction Level Introspection Opcodes: | ||
|
|
||
| 1. `OpTxVersion` (0xb2): Returns the version of the transaction. |
There was a problem hiding this comment.
from reference implementation, returned as script number. could be a general compact information valid for all returned number
|
|
||
| 1. `OpTxVersion` (0xb2): Returns the version of the transaction. | ||
| 2. `OpTxLockTime` (0xb5): Returns the locktime field of the transaction. | ||
| 3. `OpTxSubnetId` (0xb6): Returns the subnetwork ID of the transaction. |
There was a problem hiding this comment.
from reference implementation, returned as raw bytes
| 3. `OpTxSubnetId` (0xb6): Returns the subnetwork ID of the transaction. | ||
| 4. `OpTxGas` (0xb7): Returns the gas field of the transaction. | ||
| 5. `OpTxPayloadLen` (0xc4): Returns the payload length of the transaction. | ||
| 6. `OpTxPayloadSubstr` (0xb8): Returns the payload substring of the transaction from `start` to `end`. Returns error for invalid ranges, or when `end-start > MAX_SCRIPT_ELEMENT_SIZE = 520`. |
There was a problem hiding this comment.
- invalid ranges implicitly means 1. out of bounds relative to provided bytes or 2. start > end, might be interesting to specify these two cases (implementation does a difference in term of returned error).
- Substr could be confusing, implementation does more of a
"slice"operated on bytes
|
|
||
| #### Input/Output Introspection Opcodes: | ||
|
|
||
| 1. `OpTxInputSpkLen(idx)`: (0xc5) Returns the script public key length of the specified input. |
There was a problem hiding this comment.
from reference implementation, positive and 4-bytes script num encoded, valid for all index-like args, can be generalized maybe
| Status: Draft | ||
| ``` | ||
|
|
||
| ## Abstract |
There was a problem hiding this comment.
suggestion, add txscript engine minimal encoding relaxation on stack data consumption, with related PR: kaspanet/rusty-kaspa#813 (the PR contains multiple commits and they aren't all related to this addition, but I think PR link is sufficient)
| 6. `OpTxInputScriptSigSubstr(idx, start, end)`: (0xca) Returns the script signature substring of the input from `start` to `end`. Returns error for invalid ranges, or when `end-start > MAX_SCRIPT_ELEMENT_SIZE = 520`. | ||
| 7. `OpOutpointTxId(idx)` (0xba): Returns the transaction ID of the outpoint. | ||
| 8. `OpOutpointIndex` (0xbb): Returns the index of the outpoint. | ||
| 9. `OpTxInputSeq(idx)` (0xbd): Returns the sequence number of the input. |
There was a problem hiding this comment.
as LE raw bytes, not script num (maybe worth a motivation)
|
|
||
| 1. `OpCat(str1, str2)`: (0x7e) Concatenates two byte strings. Returns error if the resulting string exceeds `MAX_SCRIPT_ELEMENT_SIZE = 520` [2]. | ||
| 2. `OpSubstr(str, start, end)`: (0x7f) Returns the substring of a byte string (from start (inclusive) until end (exclusive)). Returns error for invalid ranges, or when `end-start > MAX_SCRIPT_ELEMENT_SIZE = 520`. | ||
| 3. `OpBlake2bWithKey(data, key)`: (0xa7) Returns the Blake2b hash of the data with the key used for domain separation. |
There was a problem hiding this comment.
we probably should specify fixed 32-bytes length
|
|
||
| ### 2. Activation | ||
|
|
||
| The features introduced in this KIP are activated based on DAA score: |
There was a problem hiding this comment.
Should we mention based on consensus flag as of now and later controlled by DAA score?
|
|
||
| For example, we can implement a simple covenant that requires us to increase a counter stored in the transaction payload every time the UTXO is spent, and forces us to send the new transaction to the same scriptPubKey: | ||
|
|
||
| Given siganture script of the form: `<PREV_TX_REST> <PREV_TX_PAYLOAD>`, the scriptPubKey will be: |
| } | ||
| ``` | ||
|
|
||
| In general, once we can encode some state transition function δ in script, we can validate that `δ(prev_payload,tx) = new_payload`, where δ can also introduce some constraints on `tx` using introspection opcodes (checking its signautre, enforcing a locktime, etc). |
No description provided.