Quick Start

Due to the rapid iterative development of the testnet, we only provide pre-compiled executable files right now. Please download through the official channel. NOTE the testnet is currently using the software version v0.1.3.

The cross-chain assets of the testnet now ONLY support BTC and ETH mainnets, and ERC20 tokens such as USDT. ALL other ASSETS/TOKENS will be lost if you deposit them into the testnet, so please take extra caution if you do so.

Join HBTC Testnet

Clone testnet project to local machine:

git clone https://github.com/hbtc-chain/testnet.git

Setup configration and genesis files

Copy the config directory in testnet project to $HOME/hbtcchain/node directory. Edit the node alias moniker in the configuration file $HOME/hbtcchain/node/config/config.toml.

# A custom human readable name for this node
moniker = "<your_custom_moniker>"

Start the node

Start with binary

Go to the $HOME/hbtcchain/node directory, copy the executable file hbtcd from the project testnet to this directory, and start with the following command:

./hbtcd start --home ./

Start with docker

Enter the testnet project and execute the command:

docker-compose -f docker-compose.yml up -d

It will launch the hbtcd container and connect to the testnet if started successfully.

Interact with HBTC chain

After the full node has synchronized all the blocks with the whole network, we can use the command line tool (hbtccli) to interact with the HBTC Chain and can run the following command to check all the commands.

hbtccli help

We give a brief introduction to the process of cross-chain asset depositing, transferring and withdrawing coins/tokens, please note that the following operation is interactive with the Ethereum mainnet, please proceed with caution.

1. Create and manage HBTC chain custodian units

hbtccli keys add alice --home node/hbtccli

With above command we created an ALICE custodian unit in the specified node directory (you need to enter your password to encrypt the custodian unit key during the creation process), and it was successfully created as follows:

{
  "name": "alice",
  "address": "HBCPNuLKXuQSVgGe4kfF3JxJZb1Uytkajb3Q",
  "pubkey": "hbcpub1addwnpepqdp4ac6l2f7tjtwssvdra7fy2xfrl8th4ltcx4dgy60z2a7ffx5lcu2ja8v",
}

2. Create cross-chain custodian addresses for Ethereum

hbtccli tx keygen keygen alice eth HBCPNuLKXuQSVgGe4kfF3JxJZb1Uytkajb3Q  --chain-id hbtc-testnet --home node/hbtccli

With above command we created a cross-chain custodian address of ETH for ALICE, and after waiting for 2-3 blocks after the command is sent and executed (it takes a certain amount of time for distributed key generation), we can get the cross-chain custodian address of ETH by querying the corresponding custodian information with the following command:

hbtccli query cu cuinfo HBCPNuLKXuQSVgGe4kfF3JxJZb1Uytkajb3Q --chain-id hbtc-testnet --home node/hbtccli

The response to the query should be as follows:

{
  "type": "hbtcchain/CustodianUnit",
  "value": {
    "address": "HBCPNuLKXuQSVgGe4kfF3JxJZb1Uytkajb3Q",
    "assets": [
      {
        "denom": "eth",
        "address": "0x97efBEAd089c9B57C4d5ed4a57d4ebBE3659d34B",
        "enbale_sendtx": true
      }
    ],
    "asset_pubkey": "A/dbw3DsU9HGTnglann9ZvlGl1gCPsC+8/2gWNrjhcQ3"
  }
}

According to the response, we have created a cross-chain custodian address of ETH for the custodian unit (0x97efBEAd089c9B57C4d5ed4a57d4ebBE3659d34B), and the key of this address is distributed by the validator nodes to store the private key shares, with the public key to be visible on the custodian unit (assert_pubkey).

3. Deposit cross-chain assets

Generate your own eth cross-chain address (0x97efBEAd089c9B57C4d5ed4a57d4ebBE3659d34B) to deposit a certain amount of eth, after the deposit is complete, HBTC Chain will automatically scan the cross-chain address of the custodian unit, the corresponding deposit will be credited to the corresponding custodian unit of HBTC Chain. For example, ALICE deposited 0.5eth and queries the information for the corresponding custodian unit as follows:

{
  "type": "hbtcchain/CustodianUnit",
  "value": {
    "address": "HBCcUCWJNattE5PYm6xQKbaCoRCG2SaVdHvH",
    "coins": [
      {
        "denom": "eth",
        "amount": "500000000000000000"
      }
    ],
    "assets": [
      {
        "denom": "eth",
        "address": "0x97efBEAd089c9B57C4d5ed4a57d4ebBE3659d34B",
        "nonce": "2",
        "enable_sendtx": true
      }
    ],
}

4. Send cross-chain assets

hbtccli tx send alice  BHccpSzNbAPue6QBTfN8259t12CfxC9NY2K  100000000000000000eth --chain-id hbtccli-testnet --home node/hbtccli

With above command we transferred 0.5eth of the current custodian unit’s deposit to another custodian address, and the other party’s account will receive an incremental 0.1eth of assets.

5. Withdraw cross-chain assets

hbtccli tx transfer withdrawal alice 0xC933C741416151dAcFE9428d39222f747e2b45EB 200000000000000000eth 21000000000000000 --chain-id hbtc-testnet --home node/hbtccli

With this command, custodian alice withdraws 0.2eth from its own custodian account to its own eth account (0xC933C741416151dAcFE9428d39222f747e2b45EB non-custodian address), and after passing a certain block height, the user can see the withdrawal information in its account.