# Ownership of native assets

**URL:** <https://forum.fuel.network/t/ownership-of-native-assets/3106>\
**Category:** General\
**Tags:** tokens\
**Created:** [September 21, 2023, 9:41am UTC](https://forum.fuel.network/t/ownership-of-native-assets/3106 "2023-09-21T09:41:13Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![prberg](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/prberg/32/1612_2.png) [@prberg](https://forum.fuel.network/u/prberg)\
**Post date:** [September 21, 2023, 9:41am UTC](https://forum.fuel.network/t/ownership-of-native-assets/3106/1 "2023-09-21T09:41:13Z")

</div>

Based on my reading of [this thread](https://forum.fuel.network/t/src-20-fungible-token-standard/186/14) and [this GitHub issue](https://github.com/FuelLabs/sway-standards/issues/1), I understand that SRC-20 purports to implement a contract standard for associating metadata (name, symbol, decimals) and indexing parameters (e.g. total supply) to [native assets](https://twitter.com/fuel_network/status/1613213482811523073).

That’s cool. But what I don’t understand is how these contracts are owned, particularly how the minting and burning processes are managed.

As per the Fuel specs, I gather that assets [can be minted by any contract whatsoever](https://specs.fuel.network/master/fuel-vm/instruction-set.html?highlight=mint#mint-mint-new-coins). But how does this opcode work when `$rB` (the asset id) has already been minted by some other contract?

Only the original contract is allowed to mint further coins, right?

---

<div class="post-metadata">

**Author:** ![bitzoic](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/bitzoic/32/2077_2.png) [@bitzoic](https://forum.fuel.network/u/bitzoic)\
**Post date:** [September 21, 2023, 10:09am UTC](https://forum.fuel.network/t/ownership-of-native-assets/3106/2 "2023-09-21T10:09:14Z")

</div>

> But how does this opcode work when `$rB` (the asset id) has already been minted by some other contract?

When calling the `mint` opcode, the `$rB` provided is the Sub Id, this can be seen [here](https://github.com/FuelLabs/sway/blob/ce0627e4584e575b279cfd0d0e42a076a4894630/sway-lib-std/src/token.sw#L117) in the standard library.

Internally, the Asset ID is then created from the hash of the calling contract’s Contract ID and the Sub ID as per the spec [here](https://github.com/FuelLabs/fuel-specs/blob/master/src/identifiers/asset.md#asset-id).

> Only the original contract is allowed to mint further coins, right?

Due to the hashing of the Contract Id and Sub Id, the coins minted from a contract can ONLY be minted by that contract and it’s Sub Id. Any other Contract Id or Sub Id will generate a different Asset Id.

The same goes for burning, the Sub Id is provided and hashed with the calling contract’s Contract Id. This must hash to the Asset Id.

---

<div class="post-metadata">

**Author:** ![bitzoic](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/bitzoic/32/2077_2.png) [@bitzoic](https://forum.fuel.network/u/bitzoic)\
**Post date:** [September 21, 2023, 10:09am UTC](https://forum.fuel.network/t/ownership-of-native-assets/3106/3 "2023-09-21T10:09:56Z")

</div>

Upon minting and burning, a [receipt](https://github.com/FuelLabs/fuel-specs/blob/master/src/abi/receipts.md#mint-receipt) containing the Contact Id and Sub Id is provided which can be fetched via the indexer. This can be used to verify that a particular contract is the minting contract.

---

<div class="post-metadata">

**Author:** ![prberg](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/prberg/32/1612_2.png) [@prberg](https://forum.fuel.network/u/prberg)\
**Post date:** [September 21, 2023, 1:07pm UTC](https://forum.fuel.network/t/ownership-of-native-assets/3106/4 "2023-09-21T13:07:16Z")

</div>

Thanks for the detailed answer, @bitzoic. All clear now!

Is the sub id `$rB` supposed to be a random value generated by the contract developer?

---

<div class="post-metadata">

**Author:** ![david](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/david/32/32_2.png) [@david](https://forum.fuel.network/u/david)\
**Post date:** [September 22, 2023, 10:28am UTC](https://forum.fuel.network/t/ownership-of-native-assets/3106/5 "2023-09-22T10:28:25Z")

</div>

> [@prberg](#):
>
> Is the sub id `$rB` supposed to be a random value generated by the contract developer?

It’s up to the developer!

- If the contract only creates a single token, we expect the SubId will often be 0
- For NFTs, the SubIds might be sequential
- In the case of “vault” type tokens, the subId might be the AssetId of the underlying asset
- ENS-style naming applications might use a namehash-type algorithm
- You can even use asset sub-ids to represent contract state! Pass some state into the asset subId, and you can then reconstruct the assetId in a separate contract or predicate to prove state (I’ve called this idea “packet-oriented programming”, probably needs a better explanation than this)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex022/uploads/fuel/original/2X/5/57d5a345cc15a64b636e0d56e042857f8a0e80b1.png) [@system](https://forum.fuel.network/u/system)\
**Post date:** [October 13, 2023, 6:29am UTC](https://forum.fuel.network/t/ownership-of-native-assets/3106/6 "2023-10-13T06:29:20Z")

</div>

Closed on October 13, 2023, 6:29am UTC

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.
