In this section, you will learn how to issue more of an already issued asset and also how to destroy a given amount of an issued asset.
The need to reissue (or create more) of an asset or destroy a portion of the asset is likely to occur when the asset represents something that does not have a fixed supply. This could apply to assets that represent gold held in a vault. For example, as units of gold move in and out of the vault, the asset representing the vault's supply needs to be adjusted accordingly.
Reissuing an amount of an asset requires ownership of the associated token that was created alongside the asset when it was initially issued.
When creating more of an asset, it does not matter which node initially issued the asset, as long as the node reissuing an amount of the asset is in possession of what is commonly called the asset's reissuance token. We'll examine how to initially create the reissuance token, how to utilize it to reissue a specified amount of an asset, and also how to transfer the reissuance token to other nodes, thereby granting them permission to reissue the asset.
We'll need access to two Elements nodes, which we will refer to as e1 and e2. The nodes have had their blockchains reset, and the default asset has been split between them.
We'll have e1 issue an amount of 100 of a new asset and create 1 reissuance token for that same asset. We'll create the issuance as unblinded in order to simplify the example. So let's go ahead and issue the asset and its associated reissuance token.
e1-cli issueasset 100 1 false
Note the ID of the asset and also that of the (reissuance) token.
As we will later reissue more assets from e2, we will need to note the transaction ID under which the asset was issued and use it to import the address to which the asset was sent.
Confirm the transaction.
e1-cli -generate 1
We'll now check the transaction's details using the gettransaction command:
e1-cli gettransaction <txid>
Scrolling up past the hex of the transaction's data, you will see that in the transaction, e1 received 1 reissuance token and 100 of the associated asset.
Take a copy of the address so we can import it into e2.
And now importing the address into e2's wallet.
e2-cli importaddress <address>
We can now see that both e1 and e2 are aware of the asset issuance.
e1-cli listissuances e2-cli listissuances
Currently, e1 holds an amount of the asset and the 1 reissuance token, but e2 does not.
e1-cli getwalletinfo
Also note that e1 has less of the default asset than before because it paid a small amount to cover transaction fees. This amount is due to be collected by e1 when the block created is matured and has a depth of over 100 blocks.
e2-cli getwalletinfo
As e1 holds the reissuance token, it can reissue more of it. This is done by using the reissueasset command. Let's have e1 reissue another 100 of the asset.
e1-cli reissueasset <asset-id> 100
Checking the reissuance worked.
e1-cli getwalletinfo
You can see that e1 now holds 200 of the asset as expected.
As e2 does not hold an amount of the reissuance token, they will receive an error if they try to reissue the asset.
e2-cli reissueasset <asset-id> 100
Note the error message.
We can view the details of the reissuance from e1 using the listissuances command.
e1-cli listissuances
Note the
is_reissuance flag.If we now send e2 an amount of the reissuance token, they will be able to reissue an amount of the asset themselves. First, we need an address to send it to. It is worth noting that the reissuance token is treated just the same as any other asset within elements when sending and displaying balances, and that it can also be broken down to smaller denominations like any other asset, so we do not need to send the 1 reissuance token to e2 in order for it to be able to reissue the asset. Any denomination will suffice. Generating an address for e2 to receive the reissuance token.
e2-cli getnewaddress
Then send a fraction of the RIT from e1 to e2.
e1-cli sendtoaddress <address-of-e2> 0.1 "" "" false false 1 UNSET false <reissuance-token-id>
Confirm the transaction.
e1-cli -generate 1
We can now see that e2 holds the 0.1 it was sent.
e2-cli getwalletinfo
This means that e2 can now reissue more of the assets associated with the RIT it holds in its wallet. We'll have e2 reissue 500 of the asset.
e2-cli reissueasset <asset-id> 500
Check the result of the reissuance.
e2-cli getwalletinfo
You can see that e2 now holds the amount reissued in its wallet balance and that the RIT itself is not consumed in the process of asset reissuance.
Destroying an amount of an asset is something anyone who holds at least that amount can do; it is not governed by the reissuance token.
e2-cli destroyamount <asset-id> e2-cli getwalletinfo
In this section, we have seen how to issue an asset, along with how to utilize the reissuance token that is optionally created as part of the asset issuance process. We've also seen how transferring a reissuance token is as simple as transferring any other asset, and that holding any amount of a reissuance token grants the holder the right to issue more of the associated asset. It is therefore crucial to control who has access to reissuance tokens within your network. We've also seen how to destroy an amount of an asset, and that this process is not controlled by the possession of the reissuance token.