devops
위믹스(Wemix) 3.0 테스트넷 올리기 본문
위메이드의 메인넷, 위믹스 3.0를 올려보려고 한다.
requirements
- Golang
$ git clone https://github.com/wemixarchive/go-wemix.git
$ cd go-wemix && make
빌드가 완료되면 아래와 gwemix.tar.gz 파일이 build 디렉토리에 생성된다.
$ tar xvfz gwemix.tar.gz
압축을 풀면 아래와 같은 파일들이 생성되는데, gwemix.sh는 기본 디렉토리 경로가 /opt/ 기 때문에 /opt/wemix 디렉토리를 생성하고 아래 파일들을 옮긴다.
bin/gwemix
bin/gwemix.sh
bin/solc.sh
bin/logrot
conf/WemixGovernance.js
conf/genesis-template.json
conf/config.json.example
Setting up a Network
초기 네트워크를 세팅할때, bootnode 역할을 하는 하나의 노드만 블록을 생성한 후, governance contract를 만들어 배포하는 과정을 거쳐야 한다.
gwemix 바이너리 파일을 통해서 account와 nodekey를 생성하고 스크립트에 지정된 /opt/wemix 디렉토리에 keystore와 geth/nodekey 디렉토리를 생성하여 account와 nodekey를 넣어준다.
아래 명령어를 통해서 account와 nodekey를 생성한다. (최소 3개의 노드를 운영하는 것을 권장함, 노드당 하나의 어카운트를 매칭)
$ bin/gwemix wemix new-account --out <account-file-name>
$ bin/gwemix wemix new-nodekey --out <node-key-file-name>
노드 별로 /opt/wemix/geth에는 개별 nodekey를 넣고 /opt/wemix/keystore에는 개별 account를 넣어준다.
$ mkdir /opt/wemix/geth
$ mv nodekey1 /opt/wemix/geth
$ mkdir /opt/wemix/keystore
$ mv account1 /opt/wemix/keystore
그리고 config.json.example 파일에 초기 세팅 값들을 설정하여 genesis.json 파일을 생성하는 초기화 과정을 진행한다. 아래 <node-id> 는 노드키의 idv5 값을 넣는다.
members의 주소의 stake양은 초기 할당되는 balance값보다 적어야한다. 아래의 node1은 거버넌스 컨트랙트를 배포하는 역할을 하며, 배포 전에 유일하게 블록 생성하는 최초의 노드다.
## config.json
{
"extraData": "The beginning of Wemix3.0 testnet on July 1st, 2022",
"staker": "<address4>",
"ecosystem": "<address4>",
"maintenance": "<address4>",
"members": [
{
"addr": "<address1>",
"stake": 1500000000000000000000000,,
"name": "node1",
"id": "<node1-id>",
"ip": "10.1.0.112",
"port": 8589,
"bootnode": true
},
{
"addr": "<address2>",
"stake": 1500000000000000000000000,,
"name": "node2",
"id": "<node2-id>",
"ip": "10.1.0.123",
"port": 8589
},
{
"addr": "<address3>",
"stake": 1500000000000000000000000,,
"name": "node3",
"id": "<node3-id>",
"ip": "10.1.0.196",
"port": 8589
}
],
"accounts": [
{
"addr": "<address1>",
"balance": 2000000000000000000000000000000
},
{
"addr": "<address2>",
"balance": 2000000000000000000000000000000
},
{
"addr": "<address3>",
"balance": 2000000000000000000000000000000
},
{
"addr": "<address4>",
"balance": 2000000000000000000000000000000
}
]
}
$ bin/gwemix.sh init wemix config.json
제네시스 파일이 생성되면 노드를 실행시켜준다. (만약 위 명령어에서 gwemix를 찾지못한다는 에러가 발생한다면, wemix를 gwemix로 변경)
$ bin/gwemix.sh start
실행되면 연결할 추가 노드들을 위해 Governance contract를 배포한다. 아래의 account file은 처음 실행하는 node의 account파일이다.
$ bin/gwemix.sh init-gov wemix config.json <account-file> 1
거버넌스 컨트랙트 배포가 완료되면 console을 실행시켜서 배포가 잘되었는지 확인한다.
$ bin/gwemix.sh console
> admin.wemixInfo
config가 확인되면 console상에서 etcd 초기화를 진행한다.
> admin.etcdInit()
초기화가 마무리되면 아래 명령어를 통해서 etcd가 구성되었는지 확인하고, 나머지 non-blockproducer node를 실행하여 연결시키면 된다.
> admin.wemixInfo.etcd
Other Initial Nodes
$ mkdir /opt/wemix
$ cd /opt/wemix
$ mkdir geth
$ cp <node-key-file> geth/nodekey
$ mkdir keystore
$ chmod 0700 keystore
$ cp <account-files> keystore/
$ tar xvfz <dir>/wemix.tar.gz
# copy genesis.json
$ bin/gwemix.sh start
나머지 노드들도 같은 과정을 거치는데, 이미 생성한 genesis.json으로 노드를 올리면 된다.
'DevOps > Chain' 카테고리의 다른 글
Quorum 블록체인의 Tessera Config 구성 정리 (0) | 2023.01.31 |
---|---|
Quorum의 Private Transaction manager, Tessera 테세라란? (0) | 2023.01.26 |
Cosmos Blockchain의 State machine, Tendermint, ABCI (0) | 2023.01.10 |
Application Specific blockchain with Cosmos SDK (0) | 2023.01.10 |
Cosmos SDK란? (0) | 2023.01.10 |