Welcome to the Plutus Explained series of blog posts where I seek to explain the Plutus programming language, in an accessible manner. This post accompanies the Plutus Pioneer week 5 video. (2-5 minute mark)
First of all each UTxO has both an
Address and a
Value (i.e. quantity). In EUTxO, each UTxO also has a
Data too, though we won’t be referencing that here.
A native token in Cardano is known as an asset class. An asset class is defined by two things: currency symbol, and token name, both of which are essentially of byte string data type.
Ada is measured in Lovelace, so lovelace would be the asset class.
The currency symbol is a hash of the minting policy script, and points to a UTxO on the blockchain. Each time we wish to create or burn a native token, the policy script is looked up.
Except in the case of Lovelace – for this, by design, there is no policy script so its not possible to mint or burn any.
- Use getValue function to work out the quantity of the asset class.
- Use flattenValue to extract the currency symbol, token name and value into a triplet
- Using singleton with a currency symbol, token name, and quantity we can construct a native token