Züs
Search
K
Comment on page

Burn and Mint Tokens using Zwallet

ZCN smart contract allows conversion of native ZCN token network to Ethereum wrapped WZCN token and from wrapped Ethereum WZCN token to native ZCN token through minting and burning of tokens using zwalletcli.\

Get Started

Import your Ethereum Account

./zwallet bridge-import-account command can be used to import your ethereum account Here are the parameters for the command.
Parameter
Required
Description
--mnemonic
Yes
Ethereum Wallet Mnemonic Phrase
--password
Yes
Ethereum Wallet Password
Sample Command:
./zwallet bridge-import-account --mnemonic "$MNEMONIC_PHRASE" --password "$ETHEREUM_WALLET_PASSWORD"
Sample Response:
Imported account $ETHEREUM_WALLET_ADDRESS
to path: $WALLET_CONFIG_DIRECTORY

Prerequisites

In order to perform DEX operations using zwalletcli basic config.yaml 0chain configuration file should be extended with the following params
---
block_worker: https://demo.zus.network/dns
signature_scheme: bls0chain
min_submit: 50 # in percentage
min_confirmation: 50 # in percentage
confirmation_chain_length: 3
ethereum_node_url: https://goerli.infura.io/v3/6141be73a15d47748af0dc14f53d57d7
store_unlock_duration_sec: 2
bridge:
bridge_address: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
token_address: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
authorizers_address: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
ethereum_address: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
password: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Burn ZCN and Mint WZCN token

  1. 1.
    Navigate into zwalletCLI directory
cd zwallet
2. Run the command below to list or check whether your ethereum account is imported successfully in key vault.
./zwallet bridge-list-accounts
Sample Response:
Ethereum available account: $ETHEREUM_WALLET_ID
3. Create ZCN wallet and fill it with tokens using the ./zwallet faucet command.
./zwallet faucet --methodName pour --input “{Pay day}”
Sample Response:
Execute faucet smart contract success with txn : 04f9a181c87a77306d4a6aa6473385eecacfa04c12933d96f1fae74e0c017949
4. Now to burn some ZCN tokens use the following command:
./zwallet bridge-burn-zcn --token 1
Sample Response:
Executed smart contract successfully with txn: $ZCN_BURN_HASH
Transaction completed successfully:
The response will output an zcn-burn-hash like above which can be used to fetch details about the burn transaction and mint WZCN tokens.
5. Here is a command for checking details about the ZCN burn transaction:
./zwallet bridge-get-zcn-burn --hash $ZCN_BURN_HASH
Sample Response:
ZCN burn ticket the completed consensus
Transaction nonce: 2
Transaction amount: 10000000000
ZCN transaction ID: $ZCN
6. Mint WZCN tokens using the command below:
./zwallet bridge-mint-wzcn --hash "zcn-burn-hash"
Sample Response:
Sending mint transaction to Ethereum
Payload amount: 10000000000
Payload nonce: 2
ZCN transaction ID: 67b7e0ea1d6522b62e93b22aef140dc59d2a61c6b4469a3c8f8cb8ae09b32eaa
Starting to mint WZCN
failed to prepare bridge: failed to pack arguments: argument count mismatch: got 4 for 5

Burn WZCN and Mint ZCN

  1. 1.
    Run the command below to list or check whether your ethereum account is imported successfully in key vault. If not import your Ethereum Account.
    ./zwallet bridge-list-accounts
    Sample Response:
    Ethereum available account: $ETHEREUM_WALLET_ID
  2. 2.
    Fill your ethereum wallet with WZCN tokens can be done using metamask.
  3. 3.
    Burn WZCN tokens using the following command :
./zwallet bridge-burn-wzcn --amount 1

List Authorizers

./zwallet bridge-list-auth command can be used to list all authroizers available to validate client transactions.
Sample Command:
./zwallet bridge-list-auth
Sample Response:
[
{
"id": "2f945f7310689f17afd8c8cb291e1e3ba21677243aa1d404a2293064e7983d60",
"url": "https://demo.zus.network/authorizer01/"
},
{
"id": "7b07c0489e2f35d7c13160f4da2866b4aa69aa4e8d2b2cd9c4fc002693dca5d7",
"url": "https://demo.zus.network/authorizer02/"
},
{
"id": "896c171639937a647f9e91d5ba676be580f6d2b7e0d708e4fe6ea36610a13ffd",
"url": "https://demo.zus.network/authorizer03/"
}
]

Show Authorizer Configuration

./zwallet bridge-auth-config command can be used to view authorizer configuration. Here are the parameters for the command.\
Parameter
Required
Description
--id
Yes
Provide Authorizer ID to view its configuration . Can be fetched using list authorizers command.
--help
Syntax Help for the command
Sample Command:
./zwallet bridge-auth-config --id $AUTHORIZER_ID
Sample Response:
{
"id": "2f945f7310689f17afd8c8cb291e1e3ba21677243aa1d404a2293064e7983d60",
"url": "https://demo.zus.network/authorizer01/",
"fee": 0,
"latitude": 0,
"longitude": 0,
"last_health_check": 0,
"delegate_wallet": "",
"min_stake": 0,
"max_stake": 0,
"num_delegates": 0,
"service_charge": 0
}

Show ZCNBridge Configurations

./zwallet bridge-config command can be used to view ZCNBridge configuration. To understand how to initialize a bridge client configurations check Intialize a Bridge Client.
Sample Command:
./zwallet bridge-config
Sample Response:
burn_address 0000000000000000000000000000000000000000000000000000000000000000
cost.add-authorizer 100
cost.burn 100
cost.delete-authorizer 100
cost.mint 100
max_delegates 10
max_fee 100
min_authorizers 1
min_burn 1
min_lock 0
min_mint 1
min_stake 0
owner_id 1746b06bb09f55ee01b33b5e2e055d6cc7a900cb57c0a3a5eaabb8a0e7745802
percent_authorizers 0.7