Here we intend to document the script and steps within to build a new Treasury Withdrawal governance action.
Note: These scripts and tutorial are only setup for Treasury Withdrawals with a single withdrawal address and amount
Using the Google Docs template:
Export your metadata from Google Docs as markdown file (.md).
Set secrets, you can use the .env file for this.
source ./scripts/.envSet some useful variables that we can reuse
export DEPOSIT_RETURN_ADDR="my-address"
export WITHDRAWAL_ADDR="my-address"Make sure that CARDANO_NODE_NETWORK_ID and CARDANO_NODE_SOCKET_PATH are set.
Convert the .md to intersect's metadata standard (this is a modified CIP-108 document).
With the metadata-create script taking the data from the doc and creating a .jsonld.
The input file must be a .md file structured with H2 headers (## Title, ## Abstract, ## Motivation, ## Rationale, ## References, ## Authors). Pass --language <BCP-47-tag> to override the default en in the generated @context.@language.
./scripts/metadata-create.sh my-metadata.md --governance-action-type treasury --deposit-return-addr $DEPOSIT_RETURN_ADDRGenerate a markdown representation from the created .jsonld
and manually compare against the original .md.
./scripts/cip-108-markdown.sh my-metadata.jsonldWe can then run our validation script to check
- compliance with CIP schema(s)
- compliance with Intersect schemas
- spell check on CIP108 sections (aspell personal dictionary fetched from the
mainbranch of this repo at runtime; skip with--no-spell-check) - URI reachability for every
uri/urlfield plus markdown links and bare URLs inside prose fields;ipfs://<cid>is resolved via$IPFS_GATEWAY_URI(fallbackhttps://ipfs.io). Skip with--no-check-links. body.titlelength ≤ 80 andbody.abstractlength ≤ 2500 characters Because the metadata at this point in the procedure has not yet been signed, run with--draft:
./scripts/metadata-validate.sh my-metadata.jsonld --cip108 --cip169 --draftAt least one schema flag (--cipNNN, --intersect-schema, or --schema <URL>) is required.
The --draft flag is what suppresses the "missing author" failure at this stage; it must be omitted in step 9 below so the strict post-signing pass actually catches an empty-authors regression.
If metadata passes all the above validations. We can sign it with author key(s).
You can either pass the my-metadata.jsonld to authors to sign, using something like ./scripts/author-create.sh.
Or you can run ./scripts/metadata-canonize.sh and share the canonized body hash to sign via standard cardano wallets.
Check the author witnesses were added correctly.
./scripts/author-validate.sh my-metadata.jsonldPass --no-intersect to skip the comparison against Intersect's well-known author public key.
Just to double check that all is good now, with author.
- compliance with CIP schema(s)
- compliance with Intersect schemas
- spell check (skip with
--no-spell-check) - URI reachability (skip with
--no-check-links) body.titlelength ≤ 80 andbody.abstractlength ≤ 2500 characters- structural integrity (non-empty
authors)
Run without --draft so the empty-authors check is strict — this is what guarantees the document was actually signed in step 7:
./scripts/metadata-validate.sh my-metadata.jsonld --cip108 --cip169Pin the metadata to different IPFS pinning services.
./scripts/ipfs-pin.sh my-metadata.jsonldTo skip a specific pinning service use --no-local, --no-pinata, --no-blockfrost, or --no-nmkr.
This will now additionally check that the file is accessible via IPFS.
./scripts/ipfs-check.sh my-metadata.jsonldNow we can create an treasury withdrawal governance action file from our metadata.
./scripts/action-create-tw.sh my-metadata.jsonld --deposit-return-addr $DEPOSIT_RETURN_ADDR --withdrawal-addr $WITHDRAWAL_ADDRIt is highly recommended to submit all actions on testnets before mainnet. This gives the author the opportunity to ensure all explorers pick up and render the action's metadata properly