-
Notifications
You must be signed in to change notification settings - Fork 217
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: reference input feature (#4074) <!-- Detail in a few bullet poi…
…nts the work accomplished in this PR. Before you submit, don't forget to: CODE-OF-CONDUCT.md CONTRIBUTING.md LICENSE MAINTAINERS.md README.md cabal.project default.nix docker-compose.yml docs flake.lock flake.nix floskell.json fourmolu.yaml hie-direnv.yaml lib nix prototypes reports scripts shell.nix specifications test touch.me.CI weeder.dhall Make sure the GitHub PR fields are correct: ✓ Set a good Title for your PR. ✓ Assign yourself to the PR. ✓ Assign one or more reviewer(s). ✓ Link to a Jira issue, and/or other GitHub issues or PRs. ✓ In the PR description delete any empty sections and all text commented in <!--, so that this text does not appear in merge commit messages. CODE-OF-CONDUCT.md CONTRIBUTING.md LICENSE MAINTAINERS.md README.md cabal.project default.nix docker-compose.yml docs flake.lock flake.nix floskell.json fourmolu.yaml hie-direnv.yaml lib nix prototypes reports scripts shell.nix specifications test touch.me.CI weeder.dhall Don't waste reviewers' time: ✓ If it's a draft, select the Create Draft PR option. ✓ Self-review your changes to make sure nothing unexpected slipped through. CODE-OF-CONDUCT.md CONTRIBUTING.md LICENSE MAINTAINERS.md README.md cabal.project default.nix docker-compose.yml docs flake.lock flake.nix floskell.json fourmolu.yaml hie-direnv.yaml lib nix prototypes reports scripts shell.nix specifications test touch.me.CI weeder.dhall Try to make your intent clear: ✓ Write a good Description that explains what this PR is meant to do. ✓ Jira will detect and link to this PR once created, but you can also link this PR in the description of the corresponding Jira ticket. ✓ Highlight what Testing you have done. ✓ Acknowledge any changes required to the Documentation. --> - [x] I have added md file - [x] I have updated swagger - [x] I have updated `ApiConstructTransactionData` and `ApiMintBurnData` - [x] Make sure the feature is safe in a sense that `not_implemented` will be triggered ### Comments <!-- Additional comments, links, or screenshots to attach, if any. --> ### Issue Number <!-- Reference the Jira/GitHub issue that this PR relates to, and which requirements it tackles. Note: Jira issues of the form ADP- will be auto-linked. --> Source commit: 06e2cdb
- Loading branch information
Cardano Wallet Documentation Bot
committed
Aug 7, 2023
1 parent
0fb9881
commit 454c884
Showing
2 changed files
with
124 additions
and
17 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
# Specification: Minting and Burning | ||
|
||
This document specifies those aspects of the "Transactions New > Construct" HTTP endpoint that relate to minting and burning native assets. | ||
|
||
## Reference inputs for minting scripts | ||
|
||
[Reference inputs][ref] are inputs of a transaction that are not spent; instead, the outputs they reference are made available to, say, Plutus validator scripts for inspection. | ||
|
||
[ref]: https://cips.cardano.org/cips/cip31/#referenceinputs | ||
|
||
In particular, with reference inputs, we can define a minting script in one transaction and reference the script in subsequent transaction(s). In other words, we can save space on the blockchain by defining a script once and referencing it later, instead of including a full copy of the script with every transaction. | ||
|
||
The "Transactions New > Construct" HTTP endpoint allows the creation and use of reference inputs. | ||
|
||
Specifically: | ||
|
||
1. Creation of a transaction output that contains a minting script and is suitable for use as reference input. | ||
|
||
In the `reference_policy_script_template` field, you can optionally add a script template. The HTTP endpoint will map this script template into a script using the wallet's policy public key, and this script will be included in the first transaction output (i.e. at index `0`) of the transaction. | ||
|
||
Example `POST` data for the endpoint: | ||
|
||
``` | ||
{ | ||
... | ||
"reference_policy_script_template": | ||
{ "all": | ||
[ "cosigner#0", | ||
{ "active_from": 120 } | ||
] | ||
}, | ||
... | ||
} | ||
``` | ||
2. Using a refence input that contains a minting script. | ||
In the `mint_burn` field, the array element contains `reference_input`. This field specifies a transaction input (pair of transaction ID and output index) which will be added as a reference input and is assumed to contain the minting script. (If the corresponding output was created using the method above, the appropriate output index is `0`). | ||
Example `POST` data for the endpoint with reference input: | ||
``` | ||
{ | ||
... | ||
"mint_burn": [{ | ||
"reference_input": | ||
{ "id": "464917d2bac71df96269c2d7c34dcb83183b8a3a3253c06e9d6a8bd0681422c9", | ||
"index": 0 | ||
}, | ||
"asset_name": "ab12", | ||
"operation": | ||
{ "mint" : | ||
{ "receiving_address": #{destination}, | ||
"quantity": 10000 | ||
} | ||
} | ||
}] | ||
... | ||
} | ||
``` | ||
For contrast: Example `POST` data for the endpoint with script template: | ||
``` | ||
{ | ||
... | ||
"mint_burn": [{ | ||
"policy_script_template": | ||
{ "all": | ||
[ "cosigner#0", | ||
{ "active_from": 120 } | ||
] | ||
}, | ||
"asset_name": "ab12", | ||
"operation": | ||
{ "mint" : | ||
{ "receiving_address": #{destination}, | ||
"quantity": 10000 | ||
} | ||
} | ||
}] | ||
... | ||
} | ||
``` |
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