-
Notifications
You must be signed in to change notification settings - Fork 153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add KIP-10 Transaction Introspection Opcodes, 8-byte arithmetic and Hard Fork Support #487
Merged
michaelsutton
merged 99 commits into
kaspanet:master
from
biryukovmaxim:kip-10-mutual-tx
Nov 12, 2024
Merged
Add KIP-10 Transaction Introspection Opcodes, 8-byte arithmetic and Hard Fork Support #487
michaelsutton
merged 99 commits into
kaspanet:master
from
biryukovmaxim:kip-10-mutual-tx
Nov 12, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
biryukovmaxim
force-pushed
the
kip-10-mutual-tx
branch
from
June 16, 2024 11:55
0506248
to
ff25568
Compare
biryukovmaxim
force-pushed
the
kip-10-mutual-tx
branch
from
June 16, 2024 11:59
f0da1c1
to
f7a3f77
Compare
add ci cd test
biryukovmaxim
force-pushed
the
kip-10-mutual-tx
branch
from
November 10, 2024 17:02
de446c6
to
4d79485
Compare
someone235
previously approved these changes
Nov 10, 2024
michaelsutton
requested changes
Nov 10, 2024
Fallible conversion of output amount (usize -> i64) Co-authored-by: Michael Sutton <mikisiton2@gmail.com>
Fallible conversion of input amount (usize -> i64) Co-authored-by: Michael Sutton <mikisiton2@gmail.com>
Unrelated directly to this PR, but I noticed the following
The |
biryukovmaxim
force-pushed
the
kip-10-mutual-tx
branch
from
November 11, 2024 09:13
f5acb6e
to
2db1df5
Compare
9 byte integers must fail to serialize
Co-authored-by: Michael Sutton <mikisiton2@gmail.com>
Co-authored-by: Michael Sutton <mikisiton2@gmail.com>
Co-authored-by: Michael Sutton <mikisiton2@gmail.com>
michaelsutton
approved these changes
Nov 12, 2024
someone235
approved these changes
Nov 12, 2024
biryukovmaxim
changed the title
Add KIP-10 Mutual Transaction Opcodes and Hard Fork Support
Add KIP-10 Transaction Introspection Opcodes and Hard Fork Support
Nov 12, 2024
biryukovmaxim
changed the title
Add KIP-10 Transaction Introspection Opcodes and Hard Fork Support
Add KIP-10 Transaction Introspection Opcodes, 8-byte arithmetic and Hard Fork Support
Nov 12, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This pull request implements KIP-10 by introducing transaction introspection capabilities to the Kaspa scripting language through a new set of opcodes. These additions require activation through a new fork parameter (
kip10_activation_daa_score
).Added Opcodes (following Transaction struct field ordering)
Transaction Level
OpTxInputCount
(0xb3): Get number of inputs (Implemented)OpTxOutputCount
(0xb4): Get number of outputs (Implemented)OpTxInputIndex
(0xb9): Get current input index (Implemented)OpOutpointTxId
(0xba): Get previous transaction ID (Reserved)OpOutpointOutputIdx
(0xbb): Get previous output index (Reserved)OpTxInputScriptSig
(0xbc): Get input script signature (Reserved)OpTxInputSeq
(0xbd): Get input sequence number (Reserved)UTXO Related
OpTxInputAmount
(0xbe): Get input amount (Implemented)OpTxInputSpk
(0xbf): Get input script public key (Implemented)OpTxInputBlockDaaScore
(0xc0): Get input block DAA score (Reserved)OpTxInputIsCoinbase
(0xc1): Check if input is coinbase (Reserved)Output Related
OpTxOutputAmount
(0xc2): Get output amount (Implemented)OpTxOutputSpk
(0xc3): Get output script public key (Implemented)Key Changes
kip10_activation_daa_score
Kip10I64
typeExample 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.