전에는 서버에서 단순 Parity 작동에 대해서 알아봤는데 이번에는 그 서버를 노드로 삼고, 인터넷이 안되는 망에서 그 노드에 접근하여 sync정보를 가져오는 것을 알아본다.

 

노드 서버는 인터넷이 되므로 해킹위험이 있어 노드에 슬레이브 서버를 연결해서 많이 사용한다.

 

앞서 노드 서버에서는 아래 명령어를 가동하여 작동시켰다. 

$./parity --no-warp --no-ws --no-jsonrpc --no-ipc --port=30301 --chain=ethereum --base-path=/WALLETDATAS/ethereum --db-path=/WALLETDATAS/ethereum/chains > /WALLETDATAS/ethereum/debug.log --log-file=/var/log/ethereum/parity.log 2>&1

개인적으로 --no-warp를 적어주는 것이 좋다. 아니면 아래처럼 스냅샷찍다가 멈춰버리는 경우가 잦다.

 

 

노드서버의 아이피와 포트는 172.16.0.131:30301로 둔다.

 

그리고 슬레이브 서버 아이피는 10.26.10.118로 둔다.

 

1. TOML파일 설정

basepath 안에 eth-config.toml 파일에 아래와 같이 값을 입력한다.

 

author를 공란으로 두면 에러가 뜨므로 자신의 아이피를 적는다.

# 뒤에 것들은 적용되지 않는 코드이므로 무시해도 된다.

 

eth-config.toml

# This config should be placed in following path:
#   %UserProfile%\AppData\Roaming\Parity\Ethereum\config.toml

[parity]
# Local Development Chain
#chain = "mainnet"
# Blockchain and settings will be stored in D:\blocks/Parity\Ethereum.
#base_path = "D:\\blocks/Parity\\Ethereum"
# Parity databases will be stored in D:\blocks\Parity\Ethereum\chains.
#db_path = "D:\\blocks\\Parity\\Ethereum\\chains"

#[ui]
# Wallet will be accessible on port 8181.
#port = 8180

[account]
# From: [conco,test] you'll be able to send tranasactions without password.
#unlock = [0x6E27B320EdAae409438BDB05AC636f51fc920BA4, " "]

[network]
# Parity will listen for connections on port 30301.
#reserved_only = true
#reserved_peers = "./myPrivateNetwork.txt"
port = 30301

[rpc]
port = 10110
interface = "0.0.0.0"
hosts = ["all"]
apis = ["web3", "eth", "net", "parity", "traces", "rpc", "parity_accounts","personal"]

[websockets]
# UI won't work and WebSockets server will be not available.
#웹소켓을 안쓰니 안적어도 무방
port = 11010
#disable = true

[ipc]
# You won't be able to use IPC to interact with Parity.
#disable = true
#path = "D:\\blocks\\Parity\\Ethereum\\chains\\jsonrpc.ipc"
# Only selected APIs will be exposed over this interface.
#apis = ["web3", "eth", "net", "parity", "parity_accounts", "traces", "rpc"]

#[footprint]
# Increase performance on HDD.
#db_compaction = "hdd"

[mining]
#아래 지갑주소는 본인의 주소로 입력한다.
author = "0x00e3F02bb8aaE3927Fcd4fa89caD35730aEE0E58" 

[misc]
#log_file = "C:\\ETHLOG\\Ethereum.log"

위를 요약하면 노드의 30301포트 네트워크로 접속하여 10110포트로 쏴준다는 뜻이다.

따라서 지갑에 접속할 때 10.26.10.118 Host의 10110 port로 접속하면 된다.

 

2. enode 설정

노드에 연결을 하려면 enode 값이 필요하다.

노드서버를 실행시키면 나오는 enode값을 저장해두고 basepath에 txt 문서를 하나 만들어 enode값을 입력한다.

여기서 myPrivateNetwork.txt 파일을 만들어 그안에 아래 코드를 저장한다.

enode://ef2d9aaea37b14746688fedf9695cda53ef4ffdd123f74a0022610e93a00e7ce03564fca51b10befad86dff2ebc5d7b704a2537a51a9322a401127adef35072f@172.26.10.130:30301

 

3. 패리티 실행

아래처럼 입력하여 슬레이브를 실행한다.

--reserved-peers 명령어를 통해서 프라이빗한 네트워크를 생성한다.

그리고 -c 를 붙여 toml파일에 설정값을 적용시킨다. -c가 아닌 --config로 써도 된다.

 

$./parity --no-persistent-txqueue --no-warp --port=30301 --chain=ethereum --base-path=/WALLETDATAS/ethereum --db-path=/WALLETDATAS/ethereum/chains > /WALLETDATAS/ethereum/debug.log --reserved-peers ./myPrivateNetwork.txt --reserved-only -c /WALLETDATAS/ethereum/eth-config.toml

 

이렇게 sync가 맞춰진다면 성공이다.

 

sync 완료 후 10.26.10.118:10110 으로 통신을 하여 이더리움 작업을 할 수 있다.

 

만약 노드없이 하나의 HOST에서만 실행하려고 한다면 위에 프라이빗 네트워크 부분을 빼면된다.

+ Recent posts