Skip to content

dotbitHQ/das-register

Repository files navigation

das-register

Backend of DAS registration service. You can use this repo to build your own DAS registration website (as like https://app.did.id)

Prerequisites

  • Ubuntu 18.04 or newer
  • MYSQL >= 8.0
  • Redis >= 5.0 (for cache)
  • GO version >= 1.17.10
  • ckb-node (Must be synced to latest height and add Indexer module to ckb.toml)
  • das-database
  • unipay (Payment service used for registered accounts)
  • If the version of the dependency package is too low, please install gcc-multilib (apt install gcc-multilib)
  • Machine configuration: 4c8g200G

Install & Run

Source Compile

# get the code
git clone https://github.com/dotbitHQ/das-register.git

# edit config/config.yaml before init mysql database
mysql -uroot -p
> source das-register/tables/das_register_db.sql;
> quit;

# compile and run
cd das-register
make register
./das_register --config=config/config.yaml

Docker

  • docker >= 20.10
  • docker-compose >= 2.2.2
sudo curl -L "https://github.com/docker/compose/releases/download/v2.2.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
docker-compose up -d

if you already have a mysql installed, just run

docker run -dp 8119-8120:8119-8120 -v $PWD/config/config.yaml:/app/config/config.yaml --name das-register-server admindid/das-register:latest

Usage

You need to run das-pay before you can run this service

Register

  • Use register API get the order ID
  • The server das-pay is monitoring the balance change of the receiving address on chain, and wait for user to pay with the order ID attached to the payment
  • Das-pay will notify the das-register to start the registration process after the user's payment is completed
  • Wait for das-register to complete the entire registration process
   +---------+                 +----------------+        +-----------+
   |   user  |                 |  das_register  |        |  das pay  |
   +----|----+                 +-------|--------+        +-----|-----+
        |                              |                       |
        |                              |                       |
        +----- Get order id ---------->+                       |
        |                              |                       |
        |                              |                       |
        +<---- Return order id --------+                       |
        |                              |                       |
        |                              |                       |
Pay for the order                      |                       |
      on chain                         |                       |
        |                              |            Update the order status
        |                              |                       |
        |                              |                       |
        |                  Continue the registration           |
        |                              |                       |
        |                              |                       |
        |                              |                       |
        +                              +                       +

Set Reverse Record

Das-register will use user's das balance to set reverse record via API reverse declare

Others

More APIs see API.md

Documents