cardano-foundation / cardano-token-registry

276 stars 1.71k forks source link

Documenting Plutus Smart-Contracts, --policy optional #312

Closed Icelandjack closed 12 months ago

Icelandjack commented 3 years ago

Following procedure for a wiki: How to pull request a wiki page on GitHub?

The FREPO is: https://github.com/mlabs-haskell/cardano-token-registry.wiki.git

$ git clone git@github.com:cardano-foundation/cardano-token-registry.wiki.git
$ cd cardano-token-registry.wiki

# squashing all FREPO changes
$ git pull https://github.com/mlabs-haskell/cardano-token-registry.wiki.git master

$ git push origin master
sevanspowell commented 3 years ago

Hi @Icelandjack, unfortunately I can't view the wiki page you're linking to, do your changes address our concerns that the attestation step (step 5) listed on this page is no longer required in the case of Plutus scripts?

https://github.com/input-output-hk/offchain-metadata-tools/pull/35#discussion_r692735464

Icelandjack commented 3 years ago

Hi @sevanspowell, I read the rest of the conversation and it sounds like I mistakenly dropped the attestations. So in that case I am reverting that particular change.

I have also removed an absent policy field to avoid policy: null.

Does this mean that step 5 does not need to be changed?

Since you can't view the wiki I will follow up with the patch.

Icelandjack commented 3 years ago
diff --git a/How-to-prepare-an-entry-for-the-registry-(NA-policy-script).md b/How-to-prepare-an-entry-for-the-registry-(NA-policy-script).md
index b403815..f5bf097 100644
--- a/How-to-prepare-an-entry-for-the-registry-(NA-policy-script).md
+++ b/How-to-prepare-an-entry-for-the-registry-(NA-policy-script).md
@@ -4,12 +4,14 @@ To register native token mappings, it is recommended to have pre-existing knowle

 After creating a Cardano native asset you will need the following to proceed with the steps to generate a mapping for the registry:

-- The monetary policy script for your native asset.
+- The monetary policy script for your native asset (optional for Plutus Smart-Contracts).
 - The assetName associated with the monetary policy script.
 - The policyId of the monetary policy script.
 - The private key/s used to define your asset policy.
 - Install `offchain-metadata-tools` (see [offchain-metadata-tools](https://github.com/input-output-hk/offchain-metadata-tools)).

+With Plutus Smart-Contracts the policy script is optional, instead of being a hash of the `policy.json` monetary policy script policyId is defined to be the hash (blake2b-224) of the serialized Plutus script itself.
+
 ## Step 1: Generate the 'subject'

 To create a new mapping, you must first obtain your metadata subject. The subject is defined as the concatenation of the base16-encoded policyId and base16-encoded assetName of your asset. In case your assetName is empty, then the policyId is your subject.
@@ -39,6 +41,8 @@ This creates a draft JSON file named after your subject.

 ## Step 3: Add required fields

+Plutus Smart-Contracts may not be linked to signing keys in which case `--policy` flag is not required.
+
 ```console
 token-metadata-creator entry baa836fef09cb35e180fce4b55ded152907af1e2c840ed5218776f2f6d7961737365746e616d65 \
   --name "My Gaming Token" \
@@ -59,7 +63,7 @@ token-metadata-creator entry baa836fef09cb35e180fce4b55ded152907af1e2c840ed52187

 ## Step 5: Sign your metadata

-Each metadata item must be signed with the key/s used to define your asset policy. For this example we assume only a single signing key is required to validate the monetary policy script and that all metadata fields will be signed at once with the signing key file. Please refer to [offchain-metadata-tools](https://github.com/input-output-hk/offchain-metadata-tools) for more granular options.
+Each metadata item must be signed with the key/s used to define your asset policy if one is available. For this example we assume only a single signing key is required to validate the monetary policy script and that all metadata fields will be signed at once with the signing key file. Please refer to [offchain-metadata-tools](https://github.com/input-output-hk/offchain-metadata-tools) for more granular options.

 ```console
 token-metadata-creator entry baa836fef09cb35e180fce4b55ded152907af1e2c840ed5218776f2f6d7961737365746e616d65 -a policy.skey
sevanspowell commented 3 years ago

Hey @Icelandjack, it's been a little unclear, but I think that not dropping attestations is the way to go.

I think I understand that the metadata could still be signed with some arbitrary key, and then the hash of that key is written to the chain, but don't quote me on that.

Icelandjack commented 3 years ago

Here is the pull request: https://github.com/input-output-hk/offchain-metadata-tools/pull/37!

Godspeed-exe commented 12 months ago

Closing because of old age, feel free to reopen if still relevant.