본문 바로가기
복붙 노트

프라이빗 블록체인 이더리움 멀티 서버 셋팅 방법

by 태천인(이영훈) 2021. 7. 16.
728x90

셋팅방법
1. geth 폴더 생성
2. geth2 폴더 생성
3. geth3 폴더 생성
[1번 2번 3번 제네시스는 동일해야한다.]
4. genesis.json 폴더 안에 적용할것! C:\geth\

5. 시작-> 실행 -> cmd 
6. cd D:\geth\
7. geth --datadir test0630 init genesis.json
8. geth --allow-insecure-unlock --networkid 119 --datadir test0630 --rpc --rpcport 8545 --rpccorsdomain "*" --rpcapi "admin,eth,miner,net,txpool,web3,personal" console

9. 시작-> 실행 -> cmd 
10. cd D:\geth2\
11. geth --datadir test0630 init genesis.json
12. geth --ipcdisable --allow-insecure-unlock --networkid 119 --datadir test0630 --port 30304 --rpc --rpcport 8546 --rpccorsdomain "*" --rpcapi "admin,eth,miner,net,txpool,web3,personal" console

13. 시작-> 실행 -> cmd 
14. cd D:\geth3\
15. geth --datadir test0630 init genesis.json
16. geth --ipcdisable --allow-insecure-unlock --networkid 119 --datadir test0630 --port 30305 --rpc --rpcport 8547 --rpccorsdomain "*" --rpcapi "admin,eth,miner,net,txpool,web3,personal" console
[참고 --nodiscover 사용해도 안해도 된다.]

시작-> 실행 -> cmd -> geth attach http://localhost:8545
personal.newAccount("1234")
admin.nodeInfo.enode
[첫번째 이노드 기억하기]
admin.addPeer("두분째이노드")
admin.addPeer("세번째이노드")
admin.peers
miner.start() and miner.stop()
net.peerCount

시작-> 실행 -> cmd -> geth attach http://localhost:8546
personal.newAccount("1234")
admin.nodeInfo.enode
[두번째 이노드 기억하기]
admin.addPeer("첫번째이노드")
admin.addPeer("세번째이노드")
admin.peers
miner.start() and miner.stop()
net.peerCount

시작-> 실행 -> cmd -> geth attach http://localhost:8547
personal.newAccount("1234")
admin.nodeInfo.enode
[세번째 이노드 기억하기]
admin.addPeer("두번째이노드")
admin.addPeer("세번째이노드")
admin.peers
miner.start() and miner.stop()
net.peerCount

[첫번째 서버 지갑]
> eth.accounts[0]
web3.fromWei(eth.getBalance(eth.accounts[0]))

[두번째 서버 지갑]
> eth.accounts[0]
web3.fromWei(eth.getBalance(eth.accounts[0]))

[새번째 서버 지갑]
> eth.accounts[0]
web3.fromWei(eth.getBalance(eth.accounts[0]))

//테스트로 해보기
personal.unlockAccount("첫번째 지갑주소", "taecheonin", 0)
eth.sendTransaction({from:"첫번째 지갑주소", to:"세번째지갑주소", value:web3.toWei(1,"ether")});
eth.getTransaction("햇시")
eth.getBlock(블록넘버)
web3.fromWei(eth.getBalance(eth.accounts[0]))

728x90

댓글


aaaa