Skip to content

UseCases_tokens_Create Management Tokens

BytzCK edited this page Oct 30, 2021 · 6 revisions

Use Cases, Scenario’s, Walkthroughs - for tokens

Case "Create management tokens"

Feature: Create the Management Tokens which enable regular token operations

Actor: The Token Management Key owner

Summary:

Before regular token operation is enabled, the following Management Tokens must be available:

  • The Management token group, which will replace the Token Management Key
  • The GVT token group, which is needed to create masternodes

The creator of these two token groups:

  • performs a token management creation transaction to create the respective token groups, which gives him token authorities for the three token groups.
  • mints 500 MGT, and 71 GVT

These two token groups have a ticker name, a full name and a website. Currently, the wallet only displays token group names when all fields are correctly specified:

  1. Ticker name (max 8 characters, only letters)
  2. Token name (max 32 characters, only letters)
  3. Decimal position (between 0 and 16)
  4. Token description document URL (max 79 characters, valid URL)
  5. Document hash (256 bit hexadecimal string, can be 0)

Preconditions:

  • The network (Mainnet, Testnet or Regtest) should be past the TokenStart block height
  • The actor has access to funds at the Token Management Key
  • The Management token group, and the GVT token group are not yet created

Steps:

BYTZ (and other coins in the Bitcoin family) natively support coin amounts with 18 decimals (10 before and 8 after the decimal separator). BYTZ tokens support a variable decimal position (determined at token group creation), but the restriction of 18 decimals remain.

  • The MGT token group is defined with 4 decimals in the fractional part

  • The GVT token group is atomic, so 0 decimals in the fractional part

  • Create a new bls hash for MGT token with the command bls generate

  • Create a new bls hash for GVT token with the command bls generate

The command to create a management token group is: configuremanagementtoken [TICKER] [NAME] [DECIMALPOS] [URL] [DOCUMENTHASH] [BLS Hash] [true|false] [true|false]

(This command spends BYTZ from the Token Management Address to proof it has access to the Token Management Key. The BYTZ are spent to a change address, so if you run out of BYTZ at this address (Input tx is not available for spending), you need to send additional BYTZ to the Token Management Address.)

Next, you need to mint the actual management tokens.

We'll send the tokens and the token authorities to a locally generated new address. Note that the tokens and token authorities can be sent to any address when they are minted. You'll need to use the groupIdentifier returned by the tokeninfo list command (e.g., bytzreg1zwnr8g4amts82we3csqeyxnxka7atwtzj6xh2utyajhg9fdd4dhqskff0ys), and you'll need a recipient BYTZ address (the output of the getnewaddress command, e.g. TkhfncwgMnzDqD4W14UVLgYxebuUbWuHWm) to mint the tokens.

Enter the following commands on regtest:

$ configuremanagementtoken MGT Management 4 https://github.com/bytzcurrency/ATP-descriptions/blob/master/BYTZ-regtest-MGT.json 4f92d91db24bb0b8ca24a2ec86c4b012ccdc4b2e9d659c2079f5cc358413a765 0f203ecb64417aeadae3696e0c0dd7063f23cdddbe683bd05434afd739f9607eb8a0ca183bf81cf6f596949bae8b94bf false true
{
  "groupID": "bytzreg1zw9jh8lv0hs7hlngjqfm7ekqa6m0phnmslf7fllv44lam6p9yhuqs4gfgk8",
  "transaction": "4f9562426f492a832f0d90f37977395408090a6709bacd26a363142a8f2482a4"
}

$ generate 1
[
  "678d54d4995f162d7003d11f829a7fdbf640cf74d0f65e8f913f1b09ba7bb364"
]

$ getnewaddress
TkhfncwgMnzDqD4W14UVLgYxebuUbWuHWm

# Mint 500 Management tokens
$ minttoken bytzreg1zw9jh8lv0hs7hlngjqfm7ekqa6m0phnmslf7fllv44lam6p9yhuqs4gfgk8 TkhfncwgMnzDqD4W14UVLgYxebuUbWuHWm 500.0000

# Generate a new regtest block
$ generate 1
[
  "a4ab3bad187d6e838320d18af701e2fe334c09cae556b08e8055429f23e582ed"
]

Next, create GVT Token

$ configuremanagementtoken GVT GuardianValidator 0  https://github.com/bytzcurrency/ATP-descriptions/blob/master/BYTZ-regtest-GVT.json f5125a90bde180ef073ce1109376d977f5cbddb5582643c81424cc6cc842babd 7c40d3489a6109b355a241cfc17863b935f84b6c435c649c6790bbec64b757553885a1cd9ccf22bad67ff04484a1df6 false true

{
  "groupID": "bytzreg1zw0tzp0x05szcvhq68gyh9d6v5zhc652q2r8al8dk3r8vauxj3vqsxstc84",
  "transaction": "2b27f9093e7f9e6c6a81d43abbb837ca4a370a7166f224ffac78b0e0e7bdcbff"
}

$ generate 1
[
  "78a10149e2666a65bf71ce47a1a5dddb26a8abb2d303205a7ac299a8b119e3e3"
]

Verify that the token groups indeed have been created:

$ tokeninfo all
[
  {
    "groupID": "bytzreg1zuz0rawv",
    "specification": {
      "ticker": "BYTZ",
      "name": "Bytz",
      "metadata_url": "https://bytz.gg",
      "metadata_hash": "0000000000000000000000000000000000000000000000000000000000000000",
      "decimal_pos": 8
    }
  },
  {
    "groupID": "bytzreg1zvjns3w2h5mxcz3pg24whdyhygkcdgerqjzk86n7uzfu6u8nry3qsuwdydt",
    "flags": "management",
    "specification": {
      "ticker": "MGT",
      "name": "Management",
      "metadata_url": "https://github.com/bytzcurrency/ATP-descriptions/blob/master/BYTZ-regtest-MGT.json"
      "metadata_hash": "4f92d91db24bb0b8ca24a2ec86c4b012ccdc4b2e9d659c2079f5cc358413a765",
      "decimal_pos": 4,
      "bls_pubkey": "0f203ecb64417aeadae3696e0c0dd7063f23cdddbe683bd05434afd739f9607eb8a0ca183bf81cf6f596949bae8b94bf"
    }
  },
  {
    "groupID": "bytzreg1zw0tzp0x05szcvhq68gyh9d6v5zhc652q2r8al8dk3r8vauxj3vqsxstc84",
    "flags": "management",
    "specification": {
      "ticker": "GVT",
      "name": "GuardianValidator",
      "metadata_url": "https://github.com/bytzcurrency/ATP-descriptions/blob/master/BYTZ-regtest-GVT.json",
      "metadata_hash": "f5125a90bde180ef073ce1109376d977f5cbddb5582643c81424cc6cc842babd",
      "decimal_pos": 0,
      "bls_pubkey": "97c40d3489a6109b355a241cfc17863b935f84b6c435c649c6790bbec64b757553885a1cd9ccf22bad67ff04484a1df6"
    }
  }
]

(You'll see that the native token BYTZ has been added too.)

And finally, mint GVT tokens.

# Mint 71 GVT tokens
$ minttoken bytzreg1zw0tzp0x05szcvhq68gyh9d6v5zhc652q2r8al8dk3r8vauxj3vqsxstc84 TdKU3vVVun1cgqK4PVubM3SqdCTrvwSTmE 71

# Generate a new regtest block
$ generate 1
[
  "27e4fe2b378cbd43e1c184a7a21dd8bca62133f0ee658ee8d0a6fa5d167d7336"
]

Verify that the correct amount of tokens have been created using the token balance command. See the case Find token authorities for more detailed information on this command.

Postconditions:

  • The Management (MGT) token group is created
  • The Guardian Validator (GVT) token group is created
  • 500 MGT are minted
  • 71 GVT are minted
  • The above token amounts have been verified

Related use cases:

Clone this wiki locally