🛠️trc-20

This is a highly experimental standard for token accounting on TAO

Tao Request for Comment (trc-20) is first of many experimental token standards on Bittensor. Trc-20 implements an interface similar to ERC-20 as seen below. The Tao Accounting System will be the first to support trc-20s.

Overview

Experimental fungibility on TAO Bittensor

  • Create new trc-20's with the deploy function

  • Mint a configurable amount of trc-20's with themint function

  • Approve an amount of trc-20's to transfer with the approve function

  • Transfer an amount of trc-20's with the transfer function

Trc-20 balances states are maintained by the Tao Accounting System. States are picked up miners and validators conduct random storage checks against miners and score responses based on accuracy (encrypted hash verification) and speed (time to response).

Operations

import bittensor as bt
from bittensor.synapse import Synapse 

class Deploy(bt.Synapse):

class Mint(bt.Synapse):

class Transfer(bt.Synapse):
    
class Approve(bt.Synapse):

class BalanceOf(bt.Synapse):
    
class TotalSupply(bt.Synapse):

Deploy trc-20

class Deploy(bt.Synapse):
    # Key of data
    tick: str = "" 
    max: int = -1
    lim: int = -1
    dec: int = -1
    
    required_hash_fields: typing.List[str] = ["tick", "max"]

    # Deserialize responses
    def deserialize(self) -> str:
        return self.tick
KeyRequiredDescription

tick

yes

Ticker: 4 letter unique identifier for trc-20

max

yes

Max Supply: max supply of the trc-20

lim

no

Mint limit: the max mint limit users can mint to themselves per execution

dec

no

Decimals: defaults to 18 decimals of precision, sets decimal precision

Mint trc-20

class Mint(bt.Synapse):
    # Key of data
    tick: str = "" 
    amt: int = -1
    
    required_hash_fields: typing.List[str] = ["tick", "amt"]

    # Deserialize responses
    def deserialize(self) -> str:
        return self.tick
KeyRequiredDescription

tick

yes

Ticker: 4 letter unique identifier for trc-20

amt

yes

Amount to mint: set the amount of the trc-20 to transfer

Transfer trc-20

class Transfer(bt.Synapse):
    # Key of data
    tick: str = ""
    amt: int = -1
    to: str = ""

    required_hash_fields: typing.List[str] = ["tick", "amt", "to"]

    # Deserialize responses
    def deserialize(self) -> int:
        return self.amt
KeyRequiredDescription

tick

yes

Ticker: 4 letter unique identifier for trc-20

amt

yes

Amount to transfer: set the amount of the trc-20 to transfer

to

yes

Receiver address: address to transfer the trc-20 to.

Last updated