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.

.\elements-cli issueasset 100 1

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:

{
"txid": "e75baab2ac7932b3ee836dd17ac076120e43f2e5aa3be3d234d5aea41b0d018d",
"vin": 0,
"entropy": "1c67b952469b37bb389b037198f28c61e2d13c74214eae2ed1f45c8f0870cc5f",
"asset": "b22cf0ea8316cff05f123df251f915b0612d6e5cc9dc8c14b3eb20cf3d1e9211",
"token": "1183e865f13b10f12fb38d52c94cdcba1b2fd6e605947ba1a268736cc29cc671"
}

Create a block to confirm the transaction:

.\elements-cli generatetoaddress 1 <GENERATEDADDRESS>

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:

.\elements-cli stop

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:

.\elementsd -assetdir=<MY_ASSET_HEX_ID>: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:

[<SEQUENTIA_CHAIN_ID>]
assetdir=<ASSET_ID>:<YOUR_ASSET_LABEL>

For example:

[demoseq]
assetdir=8743e592b98a581dd2cae1b33600d1d26e7dc937fb0f63181de3871e0065a8e7:USDT

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.

.\elements-cli listissuances

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.

.\elements-cli setfeeexchangerates "{\"USDT\":100000000,\"signetcoin\":100000000}"

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:

.\elements-cli setfeeexchangerates "{\"f3fd5cde8b367fbeb763691b63f59003cac68dac19c05cb1036c2736e61d2fbc\":100000000,\"signetcoin\":100000000}"

Note that we are going to issue another asset which we will use later when replacing the asset used for fees in a transaction

.\elements-cli issueasset 100 1

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:

.\elements-cli setfeeexchangerates "{\"<ASSET_2>\":400000000,\"<ASSET_1>\":200000000,\"signetcoin\":100000000}"

In this case, ASSET 2 is worth twice as much as ASSET 1, which in turn is also worth twice as much as signetcoin. 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 signetcoin 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:

.\elements-cli generatetoaddress 1 <GENERATEDADDRESS>

Last updated