This pull request introduces four new opcodes to the Kaspa scripting language: OpInputSPK, OpOutputSpk, OpInputAmount, and OpOutputAmount. These additions require a hard fork. The new opcodes are specifically designed to support KIP-10 mutual transactions
Features
New Opcodes:
OpInputSpk: Retrieves the script public key of the input.
OpOutputSpk: Retrieves the script public key of the output.
OpInputAmount: Retrieves the amount of the input.
OpOutputAmount: Retrieves the amount of the output.
Example Usage
The example provided demonstrates common logic that should be used with the new opcodes. The script allows for two main scenarios:
Owner Scenario: The script checks if the input is used by the owner and verifies the owner's signature.
Borrower Scenario: The script allows the input to be consumed if the output with the same index has a value of input + threshold and goes to the P2SH of the script itself. This scenario also includes a check where the threshold is not reached, demonstrating the validation of input and output values.
Overview
This pull request introduces four new opcodes to the Kaspa scripting language:
OpInputSPK
,OpOutputSpk
,OpInputAmount
, andOpOutputAmount
. These additions require a hard fork. The new opcodes are specifically designed to support KIP-10 mutual transactionsFeatures
OpInputSpk
: Retrieves the script public key of the input.OpOutputSpk
: Retrieves the script public key of the output.OpInputAmount
: Retrieves the amount of the input.OpOutputAmount
: Retrieves the amount of the output.Example Usage
The example provided demonstrates common logic that should be used with the new opcodes. The script allows for two main scenarios:
input + threshold
and goes to the P2SH of the script itself. This scenario also includes a check where the threshold is not reached, demonstrating the validation of input and output values.For detailed code, refer to the example
Motivation
The introduction of these new opcodes and the hard fork support enhances the flexibility and functionality of the Kaspa scripting language.
These changes are part of the implementation of the KIP-10 proposal.
For more information, refer to the KIP-10 research document.