Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Predicate Based Asset IDs #537

Open
SilentCicero opened this issue Nov 19, 2023 · 2 comments
Open

Predicate Based Asset IDs #537

SilentCicero opened this issue Nov 19, 2023 · 2 comments
Labels
documentation Improvements or additions to documentation enhancement New feature or request

Comments

@SilentCicero
Copy link
Member

Abstract

Right now, our asset ID construction allows for contracts to mint assets with specific sub IDs. This is very useful for enabling rich multiple native assets. One sticking point with the UTXO model is that enabling blacklisting is nearly impossible for native assets. Many popular stable coins such as Tether and USDC require this feature to ensure that can take appropriate steps to blacklist bad actors from their system. While Fuel should encourage permissionless token design philosophically, not having reasonable facility for blacklisting on minted assets would be a net negative for the protocol. In this proposal, I suggest we consider changing the sub ID we currently have to a predicate ID root, in which, any actor can override existing predicates with this particular logic. This would enable system wide black listing, while retaining parallelism and minimally altering our existing asset system.

Current Asset ID

sha256(CONTRACT_ID ++ SUB_IDENTIFIER)

Proposed Asset ID

sha256(CONTRACT_ID ++ PREDICATE_IDENTIFIER)

Proposed Predicate Validation Logic

The asset predicate takes priority over the "owner" predicate and allow overriding. So the predicate logic would have to be able to both check if the asset based predicate is presented first, then if not, would check the owner predicate. This only introduces an additional check in the logic itself.

Minimal Changes

All existing behavior of multiple native assets can be retained, as token developers can still mint assets with a random predicate identifier or one that is clearly definable by the developer (e.g. "no_predicate").

Use-Cases

  • Global blacklisting of assets (no-matter who or where they are held)
  • Meta-transactional services, whereby additional actions can be triggered by third parties (but still retain the original owner)

UX Hurdles

Users would have to be made aware of these additional predicate conditions on their assets, but this can be done easily off-chain.

@SilentCicero SilentCicero added documentation Improvements or additions to documentation enhancement New feature or request labels Nov 19, 2023
@dmihal
Copy link
Contributor

dmihal commented Nov 19, 2023

Very supportive of this idea, however we need to preserve the ability to have SubIDs as well (not simply replacing them with predicate IDs)

How about including the Predicate ID within an additional hash?

sha256(CONTRACT_ID ++ sha256(PREDICATE_IDENTIFIER ++ SUB_IDENTIFIER))

@dmihal
Copy link
Contributor

dmihal commented Nov 19, 2023

As for how this could be executed in practice, I believe the easiest implementation would be to add a new input-type, which would overwrite the normal ownership.

InputPredicateCoin

name type description
txID byte[32] Hash of transaction.
outputIndex uint8 Index of transaction output.
owner byte[32] Owning address or predicate root.
amount uint64 Amount of coins.
asset_id byte[32] Asset ID of the coins.
sub_id byte[32] The sub-ID of the asset, used for generating the asset ID.
txPointer TXPointer Points to the TX whose output is being spent.
maturity uint32 UTXO being spent must have been created at least this many blocks ago.
predicateGasUsed uint64 Gas used by predicate.
predicateLength uint16 Length of predicate, in instructions.
predicateDataLength uint16 Length of predicate input data, in bytes.
predicate byte[] Predicate bytecode.
predicateData byte[] Predicate input data (parameters).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants