Spell JSON Reference
Spell is the metadata added to a Bitcoin transaction to make it also a Charms transaction: spells create charms. This reference provides an explanation of each parameter in the Spell JSON format.
Structure Overview
Section titled “Structure Overview”The Spell JSON has the following top-level fields:
version: Protocol version identifiertx: Normalized transaction payload (ins,refs,outs, optionalbeamed_outs, optionalcoins)app_public_inputs: App definitions and public input datamock: Optional boolean used for mock proving
Parameter Details
Section titled “Parameter Details”version
Section titled “version”Protocol version number.
"version": 11Required Value: Must be 11 for Charms CLI v11.0.1.
Spells exist on-chain with lower versions, and they are recognized by the client, but are not supported by the prover.
Normalized transaction payload.
"tx": { "ins": [ "<txid_1>:<vout_1>", "<txid_2>:<vout_2>" ], "refs": [ "<ref_txid>:<ref_vout>" ], "outs": [ { "0": { "ticker": "TOAD", "remaining": 30160 }, "1": 42 }, { "2": 69420 } ], "beamed_outs": { "1": "009fb48961bca8ec68f01ec882f7ec0dc7dc5cc6bcf4ad154f129ea2338f6cd1" }, "coins": [ { "amount": 1000, "dest": "2f7e10b8f6e2089b5bb5dcce96e8dd49ca01012f6506af0fe7bf5d2f2f5db531" } ]}ins: Input UTXOs spent by the transaction (txid:vout). Optional in serialized spells.refs: Optional reference UTXOs.outs: Output charms. Each output is a map of app index to charm data.beamed_outs: Optional map of output index to destination UTXO hash for beaming.coins: Optional native coin outputs (amountand hex-encodeddest).
Use charms util dest to derive output dest from an address when constructing coins entries.
app_public_inputs
Section titled “app_public_inputs”Maps each app in the spell to that app’s public input data.
"app_public_inputs": { "n/<app_id>/<app_vk>": { "ticker": "TOAD", "remaining": 30580 }, "t/<app_id>/<app_vk>": null, "c/0000000000000000000000000000000000000000000000000000000000000000/<app_vk>": { "param": "value" }}- App keys are in
tag/identity/vkformat:n/...for NFT appst/...for fungible token appsc/...for contract apps
- Public input values can be
nullfor simple transfers.
App indexes used in tx.outs (0, 1, 2, …) refer to this map in sorted key order.
"mock": falseOptional. Use true only for mock-mode workflows.
About Private Inputs
Section titled “About Private Inputs”Private app inputs are not part of Spell JSON in v11.0.1. Pass them separately to proving/checking interfaces:
charms spell prove --private-inputs=./private-inputs.yaml ...- For API requests, use
app_private_inputsin the prover payload.
Implementation Tips
Section titled “Implementation Tips”- Keep
versionat11. - Ensure all app indexes in
tx.outsare valid indexes intoapp_public_inputs. - Include all prerequisite transactions in
prev_txswhen checking/proving. - Validate spell shape with
charms spell checkbefore proving.