Skip to content

scorpiotzh/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://d.id/bit)

Prerequisites

  • Ubuntu 18.04 or newer
  • MYSQL >= 8.0
  • Redis >= 5.0 (for cache)
  • Elasticsearch >= 7.17 (for Recommended account)
  • GO version >= 1.21.3
  • 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 unipay before you can run this service
  • You need to run das-database before you can run this service

Register

  • Use register API get the order ID
  • The server unipay 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
  • unipay 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  |        |  unipay  |         |das-database|
   +----|----+                 +-------|--------+        +-----|-----+        +-----|-----+
        |                              |                       |                    |
        |                              |                       |                    |
        +----- Get order id ---------->+                       |                    |
        |                              |                       |                    |
        |                              |                       |                    |
        +<---- Return order id --------+                       |                    |
        |                              |                       |                    |
        |                              |                       |                    |
Pay for the order                      |                       |                    |
      on chain                         |                       |                    |
        |                              |            Update the order status   Parse block data
        |                              |                       |                    |
        |                              |                       |                    |
        |                  Continue the registration           |                    |
        |                              |                       |                    |
        |                              |                       |                    |
        |                              |                       |                    |
        +                              +                       +                    +

Set Reverse Record

Reverse APIs see reverse svr

Others

More APIs see API.md

Documents

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 99.8%
  • Other 0.2%