2020년 11월 26일 목요일

[EOSIO] EOS Node들을 위한 망구성



참고
  • https://eosio.stackexchange.com/questions/345/how-to-configure-block-producer-to-have-front-end-and-back-end-cluster-nodes

2020년 11월 25일 수요일

TINC(Peer-to-Peer VPN) 설정 방법 in Ubuntu 18.04

소개

TINC는 터널링 및 암호화를 사용하여 인터넷상의 호스트간에 보안 개인 네트워크를 만드는 VPN데몬

준비사항

2대의 서버, Ubuntu 18.04

구성

A 서버 -------------------------------------- B 서버

설치

1. 각 서버에 Tinc 설치
$ sudo apt update && sudo apt install tinc

2. VPN 작업 디렉토리 생성
$ sudo mkdir -p /etc/tinc/sample/hosts

3. 설정 파일들 만들기
- 각 서버에 "tinc.conf" 파일 생성
$ sudo vim /etc/tinc/sample/tinc.conf

-- A 서버
-------------------------
 Name = tinc_a
 Device = /dev/net/tun
 AddressFamily = ipv4
 Interface = tun0
-------------------------

-- B 서버
-------------------------
Name = tinc_b Device = /dev/net/tun AddressFamily = ipv4 Interface = tun0
 ConnectTo = tinc_a
-------------------------
  • Name - VPN에 사용될 고유한 이름 
  • Device - 가상 네트워크를 위한 장치 정의
  • AddressFamily - IP 주소 형식
  • Interface - 네트워크 인터페이스명
  • ConnectTo - 연결하려는 tinc 데몬명
- 각 서버에 hosts 설정 파일 생성
-- A 서버
$ sudo vim /etc/tinc/sample/hosts/tinc_a
------------------------- Address = 172.17.0.2 Subnet = 100.100.100.100 -------------------------
-- B 서버
$ sudo vim /etc/tinc/sample/hosts/tinc_b

-------------------------
Address = 172.17.0.3
Subnet = 100.100.100.200
-------------------------

- 각 서버의 vpn hosts 설정 파일에 public key 추가
$ sudo tincd -n sample -K 4096

VPN 제어 스크립트 생성

-- A 서버

$ sudo vim /etc/tinc/sample/tinc-up

-------------------------
#!/bin/sh ip link set $INTERFACE up ip addr add 100.100.100.100 dev $INTERFACE ip route add 100.100.100.0/24 dev $INTERFACE
-------------------------
$ sudo vim /etc/tinc/sample/tinc-down
-------------------------
#!/bin/sh ip route del 100.100.100.0/24 dev $INTERFACE ip addr del 100.100.100.100 dev $INTERFACE ip link set $INTERFACE down
-------------------------

-- B 서버

$ sudo vim /etc/tinc/sample/tinc-up

-------------------------
#!/bin/sh ip link set $INTERFACE up ip addr add 100.100.100.200 dev $INTERFACE ip route add 100.100.100.0/24 dev $INTERFACE
-------------------------
$ sudo vim /etc/tinc/sample/tinc-down
-------------------------
#!/bin/sh ip route del 100.100.100.0/24 dev $INTERFACE ip addr del 100.100.100.200 dev $INTERFACE ip link set $INTERFACE down
-------------------------
- 실행 권한 변경
$ sudo chmod -v +x /etc/tinc/sample/tinc-{up,down}

서비스 등록

$ sudo vim /etc/systemd/system/tinc.service

-------------------------
[Unit]
Description=Tinc net sample
After=network.target

[Service]
Type=simple
WorkingDirectory=/etc/tinc/sample
ExecStart=/sbin/tincd -n sample -D -d3
ExecReload=/sbin/tincd -n sample -kHUP
TimeoutStopSec=5
Restart=always
RestartSec=60

[Install]
WantedBy=multi-user.target
-------------------------

$ sudo systemctl enable tinc.service
$ sudo systemctl status tinc.service

Host 파일 교환

-- A 서버

$ scp /etc/tinc/sample/hosts/tinc_a user@172.17.0.2:/tmp/
$ ssh -t user@172.17.0.2 sudo mv -v /tmp/tinc_a /etc/tinc/sample/hosts/

-- B 서버

$ scp /etc/tinc/sample/hosts/tinc_b user@172.17.0.3:/tmp/
$ ssh -t user@172.17.0.3 sudo mv -v /tmp/tinc_b /etc/tinc/sample/hosts/

테스트

-- A 서버 & B 서버

$ sudo tincd -n sample -D -d3
$ sudo ip a
$ ping 100.100.100.***

참고

  • https://www.linode.com/docs/guides/how-to-set-up-tinc-peer-to-peer-vpn/

2020년 11월 21일 토요일

[EOSIO] EOSIO 빌드 및 설치

EOSIO 빌드 by Shell Scripts

빌드 환경

HW: 4Core CPU, 8GB (테스트환경)
OS: Ubuntu 18.04

EOSIO 소스 다운로드

$ mkdir -p ~/eosio && cd ~/eosio
$ git clone --recursive https://github.com/EOSIO/eos

(옵션) Submodules 업데이트

- "--recursive" 옵션 없이 clone을 했다면 아래 명령어 실행해야 함
$ cd ~/eosio/eos
$ git submodule update --init --recursive

EOSIO 바이너리 빌드

- "/home/eosio/eos/2.0"에 설치
$ sudo mkdir -p /home/eosio
$ sudo chown ${USER}:${USER} /home/eosio

$ cd ~/eosio/eos
$ ./scripts/eosio_build.sh -i /home/eosio/eos/2.0

EOSIO 설치

$ cd ~/eosio/eos
$ sudo ./scripts/eosio_install.sh

EOSIO 삭제

$ cd ~/eosio/eos
$ sudo ./scripts/eosio_uninstall.sh

EOSIO 바이너리 테스트

$ cd ~/eosio/eos/build
$ make test

참고

  • https://developers.eos.io/manuals/eos/latest/install/build-from-source/shell-scripts/index

2020년 9월 18일 금요일

[EOSIO] genesis.json 설명 (BP들의 투표를 위한 블록체인 환경정보)

샘플파일

========================================================================
{
  "initial_timestamp": "2018-03-02T12:00:00.000",
  "initial_key": "EOS8Znrtgwt8TfpmbVpTKvA2oB8Nqey625CLN8bCN3TEbgx86Dsvr",
  "initial_configuration": {
    "max_block_net_usage": 1048576,
    "target_block_net_usage_pct": 1000,
    "max_transaction_net_usage": 524288,
    "base_per_transaction_net_usage": 12,
    "net_usage_leeway": 500,
    "context_free_discount_net_usage_num": 20,
    "context_free_discount_net_usage_den": 100,
    "max_block_cpu_usage": 100000,
    "target_block_cpu_usage_pct": 500,
    "max_transaction_cpu_usage": 50000,
    "min_transaction_cpu_usage": 100,
    "max_transaction_lifetime": 3600,
    "deferred_trx_expiration_window": 600,
    "max_transaction_delay": 3888000,
    "max_inline_action_size": 4096,
    "max_inline_action_depth": 4,
    "max_authority_depth": 6
  },
  "initial_chain_id": "0000000000000000000000000000000000000000000000000000000000000000"
}
========================================================================
[출처] https://github.com/EOSIO/eos/blob/master/tutorials/bios-boot-tutorial/genesis.json

설명

  • max_block_net_usage
    • 블록에 대한 명령어의 최대 순 사용량
  • target_block_net_usage_pct
    • 최대 순 사용량의 목표 백분율 (1 % == 100, 100 % = 10,000)
  • max_transaction_net_usage
    • 계정 한도에 관계없이 체인이 허용하는 객관적으로 측정 된 최대 순 사용량
  • base_per_transaction_net_usage
    • 부수적 인 비용을 충당하기 위해 거래에 대해 청구되는 순 사용량의 기본 금액
  • net_usage_leeway
  • context_free_discount_net_usage_num
    • 문맥없는 데이터의 순 사용에 대한 할인 분자
  • context_free_discount_net_usage_den
    • 문맥없는 데이터의 순 사용에 대한 할인 분모
  • max_block_cpu_usage
    • 블록에 대해 청구 가능한 최대 CPU 사용량 (마이크로 초)
  • target_block_cpu_usage_pct
    • 최대 CPU 사용량의 목표 백분율 (1 % == 100, 100 % = 10,000)
  • max_transaction_cpu_usage
    • 계정 한도에 관계없이 체인이 허용하는 청구 가능한 최대 CPU 사용량 (마이크로 초)
  • min_transaction_cpu_usage
    • 체인에 필요한 최소 청구 가능 CPU 사용량 (마이크로 초)
  • max_transaction_lifetime
    • 입력 트랜잭션의 만료가 처음 포함 된 블록의 시간보다 앞서있을 수있는 최대 시간 (초)
  • deferred_trx_expiration_window
    • 지연된 트랜잭션이 만료 될 때까지 처음 실행할 수있는 시간 (초)
  • max_transaction_delay
    • 권한 확인에 의해 지연 요구 사항으로 부과 될 수있는 최대 시간 (초)
  • max_inline_action_size
    • 인라인 작업의 최대 허용 크기 (바이트)
  • max_inline_action_depth
    • 인라인 작업 전송에 대한 재귀 깊이 제한
  • max_authority_depth
    • 권한이 충족되는지 확인하기위한 재귀 깊이 제한