3. Create a new asset
3.1 Issue the asset
To create a new asset, use the command issueasset. Like regular Sequentia transactions, this command can also use any asset to pay for transaction fees. The arguments of the function are the following:
assetamount (numeric or string, required) Amount of asset to generate. Note that the amount is BTC-like, with 8 decimal places.
tokenamount (numeric or string, required) Amount of reissuance tokens to generate. Note that the amount is BTC-like, with 8 decimal places. These will allow you to reissue the asset using the `reissueasset` command as long as at least one satoshi unit (0.00000001) of the reissuance token is in your wallet. These tokens are not consumed during reissuance.
blind (boolean, optional, default=true) Whether to blind the issuances for confidential transactions.
contract_hash (string, optional, default="0000...0000") Contract hash that is put into issuance definition. Must be 32 bytes worth in hex string form. This will affect the asset id.
For this test, we will use only the first two arguments.
The output of issueasset will be similar to the following by way of example. You have to take note of the assetid under “asset”, that is, the HEX ID of your asset:
Create a block to confirm the transaction:
3.2 Give a name to the asset
Now let’s give a name to this asset. We have to stop and re-run the application:
Then execute elements daemon (elementsd) with parameter assetdir associating the HEX ID of the asset you issued. Replace <MY_ASSET_HEX_ID> below with the label you want to assign to it (the label is not written onchain, it’s part of your local node configuration). Imagine we are Tether Inc, and we are issuing USDT:
At this point on Windows you might need to re-open the command prompt.
Alternatively, rather than running .\elements-cli stop and changing the label via RPC, just close the application running your node, open elements.conf file and write at the bottom:
For example:
For more asset labels, just add new lines below with assetdir=<YOUR_ASSET_ID>:<YOUR_LABEL>
You will be able to use these labels instead of the assetid in the commands you will execute next.
Then re-run elementsd.exe
Then, check if everything has been done properly. The following command will allow you to see all issued assets and their characteristics. The output should contain information such as the amount of each issued asset and other characteristics like the asset label that you have associated with it.
3.3 Set a price for the asset
Now we have to set a price for this asset, that is, an exchange rate compared to other assets. Otherwise, this asset will be considered of no value, and your own node will not broadcast a transaction that pays fees with such an asset!
For mainnet nodes, price data will generally be retrieved from a third-party server, but users can always set it manually in their node, as we are doing now.
You may need to replace USDT with another label if you named it differently. Alternatively, you can use the asset hex ID instead of a label. In the latter case, the command will look like this, for example:
Note that we are going to issue another asset which we will use later when replacing the asset used for fees in a transaction
This command created a new asset. Let’s call it ASSET_2, whereas the one we created before will be referred to ASSET_1. Then, I can set all the asset prices this way:
In this case, ASSET 2 is worth twice as much as ASSET 1, which in turn is also worth twice as much as TEST. Imagine that the smallest unit here is a price like 1 satoshi as a reference unit, then one unit of ASSET_2 is worth four hundred million (400.000.000) satoshis while TEST is worth only one hundred million satoshis (100.000.000). Obviously, the choice of satoshis as a reference unit here is completely arbitrary; the user is free to set whatever they want, whether dollars or cents or milliBitcoin (BTC) or anything else. The important thing is that the relative prices of the assets measured in that reference unit are correct. The price server will provide this information, while front-end interfaces such as wallets will have custom options to display it.
Remember to create a new block when you make transactions or issue assets:
Last updated