Skip to content

Instantly share code, notes, and snippets.

@Oxchild
Last active January 6, 2022 09:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Oxchild/c146887ed71ab5a3eda3197cfdb72af5 to your computer and use it in GitHub Desktop.
Save Oxchild/c146887ed71ab5a3eda3197cfdb72af5 to your computer and use it in GitHub Desktop.
Setting Up APIS Core

APIS Core for Docker

Docker Stats

APIS Core를 Docker 컨테이너 내에서 구동하기 위한 Docker 이미지입니다.

APIS 마스터노드, PoS 채굴, RPC 기능을 지원합니다.

Engilsh Version

목차

1. 권장 시스템 사양

2. 권장 VPS(가상서버) 서비스

3. Docker 이미지로 시작하기

4. Preloaded 버전 Docker 이미지로 시작하기

5. Preloaded 버전 AMI로 시작하기

6. APIS Core 구동

7. APIS Core 업데이트

8. APIS Core를 Preloaded 버전 APIS Core로 업데이트

9. APIS Core 삭제

10. Credits

권장 시스템 사양

  • Ubuntu 운영체제와 Docker가 설치된 PC, 클라우드 서버(인스턴스), 또는 VPS
  • 평균 400kbps 속도의 안정적인 네트워크
  • Ubuntu 16.04 LTS 또는 그 이후 버전의 운영체제
  • 1 vCPU와 동등한 수준의 프로세서 성능 (AWS 기준)
  • 최소 2GB의 RAM(메모리)
  • 최소 25GB의 블록체인 파일 저장을 위한 저장 공간 용량

권장 VPS(가상서버) 서비스

VPS 제공 회사명 서비스명 시스템 성능
Amazon Web Services (AWS) t2.small (EC2) 1 CPU / 2GB RAM
Microsoft Azure D1 (Linux VM) 1 Core / 3.5GB RAM / 50GB Storage
Google Cloud Platform n1-standard-1 (Compute Engine) 1 vCPU / 3.75GB RAM
Vultr VC2 1 vCPU / 2048MB RAM

Docker 이미지로 시작하기

누구든지 아래의 명령어를 통해 APIS Core Docker 이미지를 받을 수 있습니다 :

$ sudo docker pull apisplatform/apisj
...
Status: Downloaded newer image for apisplatform/apisj:latest

$ cd ~
$ mkdir apisData
$ sudo docker run --net=host -it --name apisj -v ~/apisData:/apis/apisData apisplatform/apisj /bin/bash
...
root@abcdef012345:/#

그 이후, 받은 이미지를 사용해 본인의 APIS Core Docker 컨테이너를 생성하고 관리할 수 있습니다.

또한, 블록체인 데이터와 키스토어 파일이 들어가 있는 ~/apisData 디렉토리를 확인할 수도 있습니다.

Preloaded 버전 Docker 이미지로 시작하기

빠르게 싱크를 받고자 하는 분들을 위해, APIS 팀에서는 미리 싱크된 버전을 다운로드할 수 있는 선택지를 제공합니다.

누구든지 아래의 명령어를 통해 미리 싱크된 APIS Core Docker 이미지(Preloaded)를 받을 수 있습니다 :

$ sudo docker pull apisplatform/apisj:preloaded
...
Status: Downloaded newer image for apisplatform/apisj:preloaded

$ cd ~
$ mkdir apisData
$ sudo docker run --net=host -it --name apisj -v ~/apisData:/apis/apisData apisplatform/apisj:preloaded /bin/bash
...
root@abcdef012345:/#

그 이후, 받은 이미지를 사용해 본인의 Preloaded 버전 APIS Core Docker 컨테이너를 생성하고 관리할 수 있습니다.

Preloaded 버전 AMI로 시작하기

APIS 팀은 아마존 웹 서비스(AWS)에서 사용할 수 있는 Preloaded 버전 APIS AMI(Amazon Machine Image)를 제공합니다.

누구나 이 APIS Preloaded AMI를 Amazon Marketplace에서 선택할 수 있습니다. 사용하려면 간단하게 AWS EC2 인스턴스를 생성할 때 APIS Preloaded AMI를 선택하면 됩니다.

APIS Preloaded AMI를 사용해 생성한 AWS instance에서는 이 명령어만 입력하면 됩니다 :

$ sudo docker restart apisj
$ sudo docker attach apisj
...
root@abcdef012345:/#

그 이후, 본인의 APIS Core Docker 컨테이너를 생성하고 관리할 수 있습니다.

APIS Core 구동

  1. apis-core 스크립트를 sh 명령어로 실행합니다

     root@abcdef012345:/# sh ./apis-core
    
  2. APIS Core 설정 패널이 나타납니다

     APIS Core Settings ==========
     v0.8.820
    
     [0]  Network             : Mainnet
     [1]  Max Peers           : 30
    
     [2]  Miner               : -
    
     [3]  masternode          : -
     [4]  Reward Recipient    : -
    
     [5]  RPC(WS) Enabled     : false
     [6]  RPC(WS) Port        : 44445
     [7]  RPC(WS) Max Connections: 1
     [8]  RPC(HTTP) Enabled   : false
     [9]  RPC(HTTP) Port      : 44446
     [A]  RPC(HTTP) nThreads  : 8
     [B]  RPC ID              : d4d761908d76981d5a4a8a7b8b5902a3
     [C]  RPC Password        : ec176fe186bee83944a9d848c4855d31
     [D]  RPC Allowed IP      : 127.0.0.1
     
    
     Input other key to start APIS Core
     Or if no key is entered, APIS Core will start automatically after 10 seconds.
     >> 
    
  3. [선택] PoS 채굴 설정하기 ('2' 입력)

     You can get rewards through APIS Block mining.
     You should input Private key of a miner to start mining.
     The chance of getting reward goes higher with the registered miner's balance.
     --
     Miner :  Not set
     --
    
     --
     [1]  Select miner from locked private key file
     [2]  Deactivate mining (Clear miner setting)
     [3]  Done                
     >> 
    
  4. 채굴자 지갑을 로드하세요 (PC 월렛에서 개인 키를 생성한 뒤 불러오는 방법을 권장합니다)

     Which address would you like to mining?
    
     [A]  Generate a new private key
     [B]  Import private key  
     [C]  Cancel              
    
     >> B
     Please input your Private key(Hex).
     >> d4e68558977bc0aaaaeced983c574bffd0e2d98123a7a687adbba58c8fbfffff
    
  5. 채굴자 지갑을 선택하세요

     Which address would you like to mining?
    
     [A]  Generate a new private key
     [B]  Import private key  
     [C]  Cancel              
    
     [1]  9f47869b3a469c27d8b3069c9a9fb2deb294580d (0 APIS)
     >> 1
     Please enter the password of [9f47869b3a469c27d8b3069c9a9fb2deb294580d]
     >> 
    
     ...
    
     You can get rewards through APIS Block mining.
     You should input Private key of a miner to start mining.
     The chance of getting reward goes higher with the registered miner's balance.
     --
     Miner :  9f47869b3a469c27d8b3069c9a9fb2deb294580d (0 APIS)
     --
    
     --
     [1]  Select miner from locked private key file
     [2]  Deactivate mining (Clear miner setting)
     [3]  Done                
     >> 
    
  6. [선택] 마스터노드 지갑 설정하기 ('3' 입력)

     APIS Core Settings ==========
     v0.8.820
    
     [0]  Network             : Mainnet
     [1]  Max Peers           : 30
    
     [2]  Miner               : 9f47869b3a469c27d8b3069c9a9fb2deb294580d (0 APIS)
    
     [3]  masternode          : -
     [4]  Reward Recipient    : -
    
     [5]  RPC(WS) Enabled     : false
     [6]  RPC(WS) Port        : 44445
     [7]  RPC(WS) Max Connections: 1
     [8]  RPC(HTTP) Enabled   : false
     [9]  RPC(HTTP) Port      : 44446
     [A]  RPC(HTTP) nThreads  : 8
     [B]  RPC ID              : d4d761908d76981d5a4a8a7b8b5902a3
     [C]  RPC Password        : ec176fe186bee83944a9d848c4855d31
     [D]  RPC Allowed IP      : 127.0.0.1
    
    
     Input other key to start APIS Core
    
     >> 3
    
  7. 마스터노드를 구성할 지갑을 로드하고, 선택할 수 있습니다.

     Which address would you like to masternode?
    
     [A]  Generate a new private key
     [B]  Import private key  
     [C]  Cancel              
    
     [1]  9f47869b3a469c27d8b3069c9a9fb2deb294580d (0 APIS)
     >> 1
     Please enter the password of [9f47869b3a469c27d8b3069c9a9fb2deb294580d]
     >> 
    
     ...
    
     You should input Private key of a masternode to staking.
     The balance of the Masternode must be exactly 50,000, 200,000, and 500,000 APIS.
     --
     Masternode :  9f47869b3a469c27d8b3069c9a9fb2deb294580d (0 APIS)
     --
    
     [1]  Select masternode from locked private key file
     [2]  Deactivate masternode (Clear masternode & recipient setting)
     [3]  Done                
     >> 
    
  8. 마스터노드 보상 수령할 지갑을 선택할 수 있습니다

     You should input address of a recipient to receive the Masternode's reward        instead.
     --
     Recipient :  Not set
     --
    
     [1]  Select recipient from locked private key file
     [2]  Deactivate masternode (Clear masternode & recipient setting)
     [3]  Done                
     >> 
    
     ...
    
     You should input address of a recipient to receive the Masternode's reward instead.
     --
     Recipient :  9f47869b3a469c27d8b3069c9a9fb2deb294580d (0 APIS)
     --
    
     [1]  Select recipient from locked private key file
     [2]  Deactivate masternode (Clear masternode & recipient setting)
     [3]  Done                
     >> 
    
  9. 필요하다면, RPC 설정을 업데이트하거나 APIS Core을 자동 업데이트하세요

     [5]  RPC(WS) Enabled     : false
     [6]  RPC(WS) Port        : 44445
     [7]  RPC(WS) Max Connections: 1
     [8]  RPC(HTTP) Enabled   : false
     [9]  RPC(HTTP) Port      : 44446
     [A]  RPC(HTTP) nThreads  : 8
     [B]  RPC ID              : d4d761908d76981d5a4a8a7b8b5902a3
     [C]  RPC Password        : ec176fe186bee83944a9d848c4855d31
     [D]  RPC Allowed IP      : 127.0.0.1
    

APIS Core 동작 확인

20:45:27.428 INFO  [ApisFactory.java:62]	  Starting APIS...
20:45:29.421 INFO  [Initializer.java:49]	  Running apis-mainnet.json, core version: ...
...

APIS Core 업데이트

  1. CTRL + C를 눌러 Docker 컨테이너 내에서 APIS Core를 중지합니다.

  2. exit을 입력해 Docker 컨테이너를 중지합니다.

     root@abcdef012345:/# exit
     exit
    
     username@ubuntu:~$
    
  3. 구 버전 컨테이너를 삭제합니다. (키스토어 파일과 블록 데이터는 삭제되지 않습니다. 하지만 파일을 백업해두는 것을 추천합니다)

     $ sudo docker rm apisj
    
  4. 업데이트된 Docker 이미지를 받은 뒤, 컨테이너를 다시 시작합니다.

     $ sudo docker pull apisplatform/apisj
     $ sudo docker run --net=host -it --name apisj -v ~/apisData:/apis/apisData apisplatform/apisj /bin/bash
     ...
     root@abcdef012345:/#
    
  5. apis-core 스크립트를 다시 실행시킵니다.

     root@abcdef012345:/# sh apis-core
    

APIS Core를 Preloaded 버전 APIS Core로 업데이트

  1. CTRL + C를 눌러 Docker 컨테이너 내에서 APIS Core를 중지합니다.

  2. exit을 입력해 Docker 컨테이너를 중지합니다.

     root@abcdef012345:/# exit
     exit
    
     username@ubuntu:~$
    
  3. 구 버전 컨테이너를 삭제합니다. (키스토어 파일과 블록 데이터는 삭제되지 않습니다. 하지만 파일을 백업해두는 것을 추천합니다)

     $ sudo docker rm apisj
    
  4. 업데이트된 Preloaded Docker 이미지를 받은 뒤, 컨테이너를 다시 시작합니다.

     $ sudo docker pull apisplatform/apisj:preloaded
     $ sudo docker run --net=host -it --name apisj -v ~/apisData:/apis/apisData apisplatform/apisj:preloaded /bin/bash
     ...
     root@abcdef012345:/#
    
  5. apis-core 스크립트를 다시 실행시킵니다.

     root@abcdef012345:/# sh apis-core
    

APIS Core 삭제

  1. CTRL + C를 눌러 Docker 컨테이너 내에서 APIS Core를 중지합니다.

  2. exit을 입력해 Docker 컨테이너를 중지합니다.

     root@abcdef012345:/# exit
     exit
    
     username@ubuntu:~$
    
  3. 구 버전 컨테이너를 삭제합니다.

     $ sudo docker rm apisj
    
  4. apisData 디렉토리를 삭제합니다. 이 디렉토리를 삭제하면 키스토어 파일과 블록 데이터가 삭제되니 주의하세요.

     $ sudo docker rm apisj
    

Credits

APIS 개발 팀 & The Oxchild Pte.Ltd.

Ryan이 작성함.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment