2

The cardano-wallet api documentation describes an endpoint which appears useful for minting native assets (https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/mintBurnAssets). Everything in the request seems pretty straightforward except for the way in which you would go about defining the monetary policy. For example, we want our policy to allow future minting by a specific wallet id, among other attributes.

The only field in this api call which appears related to monetary policy is the monetary_policy_index field inside the mint_burn list. This field takes a string, but as there is no example usage, it's unclear to me how to use that to define a complex monetary policy.

Does anyone have a concrete example of minting native assets using cardano-wallet?

2 Answers 2

1

To deal minting policy we should consider 2 parts:

  1. On-chain part

We need to have a minting script that is written in Plutus. In this minting script, we could define the logic we want to have. For instance, which wallet can mint/burn, a list of wallets can mint/burn, the limited time range allows minting/burning, etc.

The following is an example of a minting script that requires a specific address to mint.

https://github.com/input-output-hk/plutus-pioneer-program/blob/3bfe927ae0b229290a00f2746fc248d02f0ca9d5/code/Week05/lecture/Signed.hs

  1. Off-chain part

Off-chain part is for creating transactions that use the minting script prepared above to mint or burn native assets. In this part, we can define how many native assets we would like to mint/burn in those transactions.

The following is the off-chain code to use the minting script above (It uses lucid library instead of cardano-wallet, but I think the approach is almost the same).

https://github.com/input-output-hk/plutus-pioneer-program/blob/3bfe927ae0b229290a00f2746fc248d02f0ca9d5/code/Week05/lecture/lucid-signed.ts

Thus, the cardano-wallet mentioned in the API documentation is for the off-chain part only I think. And we need On chain part to create native assets.

See more,

  1. https://www.youtube.com/watch?v=g_VoKPK-tk0&ab_channel=IOGAcademy
  2. https://www.youtube.com/watch?v=Faru8_Br2Xg&ab_channel=IOGAcademy

Hope this is helpful!

0

It is not possible to create complex monetary policies using the cardano-wallet. As far as I know, it is not even possible to create a time lock for the policy in it.

For example, we want our policy to allow future minting by a specific wallet id, among other attributes.

For such policy, you might need to use Plutus.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.