Repository navigation
Conversation
- Create asset_types.go with AssetPacket, AssetGroup, AssetID and related types - Create asset_opcodes.go with 18 opcode handler implementations - Add assetPacket field and SetAssetPacket method to Engine - Register new opcode constants and opcodeArray entries in opcode.go - Update opcode_test.go for new opcode names and adjusted unknown ranges Co-authored-by: tiero <3596602+tiero@users.noreply.github.com>
…codeFindAssetGroupByAssetID Co-authored-by: tiero <3596602+tiero@users.noreply.github.com>
Co-authored-by: tiero <3596602+tiero@users.noreply.github.com>
…ection to asset sum Co-authored-by: tiero <3596602+tiero@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add Arkade Script introspection opcodes for assets
Add Arkade Asset introspection opcodes (0xe5-0xf6)
Feb 8, 2026
Collaborator
|
copy pasted and improved in #4 |
6 tasks done
Closed
This was referenced Aug 6, 2026
This file contains hidden or 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
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.
Implements 18 asset-layer introspection opcodes for the Arkade script engine, enabling contracts to query asset groups, inputs/outputs, cross-UTXO asset lookups, and intent-specific data from the Arkade Asset V1 packet.
New opcodes
OP_INSPECTNUMASSETGROUPS,OP_INSPECTASSETGROUPASSETID,OP_INSPECTASSETGROUPCTRL,OP_FINDASSETGROUPBYASSETIDOP_INSPECTASSETGROUPMETADATAHASHOP_INSPECTASSETGROUPNUM,OP_INSPECTASSETGROUP,OP_INSPECTASSETGROUPSUMOP_INSPECTOUTASSETCOUNT,OP_INSPECTOUTASSETAT,OP_INSPECTOUTASSETLOOKUPOP_INSPECTINASSETCOUNT,OP_INSPECTINASSETAT,OP_INSPECTINASSETLOOKUPOP_INSPECTGROUPINTENTOUTCOUNT,OP_INSPECTGROUPINTENTOUT,OP_INSPECTGROUPINTENTINCOUNT,OP_INSPECTGROUPINTENTINChanges
asset_types.go—AssetPacket,AssetGroup,AssetID,AssetInput,AssetOutputand cross-lookup entry types. Asset IDs are(txid32, gidx_u16)pairs per spec.asset_opcodes.go— Handler functions for all 18 opcodes with overflow-safe summation inOP_INSPECTASSETGROUPSUM.engine.go—assetPacket *AssetPacketfield +SetAssetPacket()setter onEngine.opcode.go— ReplacedOP_UNKNOWN229–OP_UNKNOWN246with named constants; wired handlers intoopcodeArray.opcode_test.go— Updated disasm test for new opcode names.asset_opcodes_test.go— 35 tests covering happy paths, error conditions, and group index bounds validation.Usage
Original prompt
Arkade Script Opcodes
This document outlines the introspection opcodes available in Arkade Script for interacting with Arkade Assets, along with the high-level API structure and example contracts.
For base opcodes (transaction introspection, arithmetic, cryptographic, etc.), see arkd PR #577.
Arkade Asset Introspection Opcodes
These opcodes provide access to the Arkade Asset V1 packet embedded in the transaction.
All Asset IDs are represented as two stack items:
(txid32, gidx_u16).Packet & Groups
OP_INSPECTNUMASSETGROUPSKOP_INSPECTASSETGROUPASSETIDktxid32 gidx_u16k. Fresh groups usethis_txid.OP_INSPECTASSETGROUPCTRLk-1|txid32 gidx_u16OP_FINDASSETGROUPBYASSETIDtxid32 gidx_u16-1|kPer-Group Metadata
OP_INSPECTASSETGROUPMETADATAHASHkhash32Per-Group Inputs/Outputs
OP_INSPECTASSETGROUPNUMk source_u8count_u16orin_u16 out_u16source: 0=inputs, 1=outputs, 2=bothOP_INSPECTASSETGROUPk j source_u8type_u8 data... amount_u64k.source: 0=input, 1=outputOP_INSPECTASSETGROUPSUMk source_u8sum_u64orin_u64 out_u64source: 0=inputs, 1=outputs, 2=bothOP_INSPECTASSETGROUPreturn values by type:type_u80x01input_index_u32 amount_u640x02txid_32 output_index_u32 amount_u640x01output_index_u32 amount_u640x02output_index_u32 amount_u64Cross-Output (Multi-Asset per UTXO)
OP_INSPECTOUTASSETCOUNTonoOP_INSPECTOUTASSETATo ttxid32 gidx_u16 amount_u64oOP_INSPECTOUTASSETLOOKUPo txid32 gidx_u16amount_u64|-1o, or -1 if not foundCross-Input (Packet-Declared)
OP_INSPECTINASSETCOUNTiniOP_INSPECTINASSETATi ttxid32 gidx_u16 amount_u64iOP_INSPECTINASSETLOOKUPi txid32 gidx_u16amount_u64|-1i, or -1 if not foundIntent-Specific
OP_INSPECTGROUPINTENTOUTCOUNTknkOP_INSPECTGROUPINTENTOUTk joutput_index_u32 amount_u64kOP_INSPECTGROUPINTENTINCOUNTknkOP_INSPECTGROUPINTENTINk jtxid_32 output_index_u32 amount_u64kHigh-Level API (Arkade Compile Sugar)
The following API provides syntactic sugar for Arkade Script contracts. Each property/method is documented with its translation to underlying opcodes.
Asset Groups