본문 바로가기
노마드 노트

윈도우용 프라이빗 이더리움 셋팅 방법 알아보자

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

셋팅방법
1. https://geth.ethereum.org/downloads/
[최신버전은 버그가 있어 그 아래 버전 1.9.25 다운받았습니다.]
2. geth 폴더 생성
3. genesis.json 폴더 안에 적용할것! C:\geth\
4. 시작-> 실행 -> cmd 
5. cd D:\geth\
6. geth --datadir test0630 init genesis.json
7. geth --allow-insecure-unlock --networkid 119 --datadir test0630 --rpc --rpcport 8545 --rpccorsdomain "*" --rpcapi "admin,eth,miner,net,txpool,web3,personal" console
[networkid 같은경우 제네시스 파일에 숫자 똑같이 적어주기]
[geth 옛날버전에는personal 존재 해야하나 최신버전에서는 명령어로 입력해도 출력은 된다.]
8. 시작 -> 실행 -> cmd
9. geth attach http://localhost:8545

계정만들기
10. personal.newAccount("1234")
[지갑과 함께 C:\geth\test0630\keystore 폴더에 파일이 생긴것을 볼수 있다.]

계정 확인 하기
11. eth.accounts or eth.accounts[0] or eth.coinbase

계정 마이너 적용 및 마이너 시작 및 멈춤 하기
12. miner.setEtherbase(eth.accounts[0]) [miner.start() miner.stop()]

지갑 이더 확인 명령어
13. eth.getBalance(eth.accounts[0])

블록넘버 명령어
14. eth.blockNumber

이더 확인 하고 싶을때
web3.fromWei(110000000000000000000,"ether")
web3.toWei(110)

해시레이트 확인 : 연산 처리능력을 측정하는 단위로 해시 속도를 의미한다.
eth.hashrate

계정 이더 확인 하기
web3.fromWei(eth.getBalance(eth.accounts[2]))

계정간 이더 전송하기
personal.unlockAccount(eth.accounts[1], "1234", 10)
eth.sendTransaction({from:eth.accounts[1], to:eth.accounts[2], value:web3.toWei(1)})
eth.sendTransaction({from:eth.accounts[1], to:eth.accounts[2], value:web3.toWei(1), data:web3.toHex("Hello World!")})
[https://codebeautify.org/hex-string-converter]
eth.sendTransaction({from:"0xe53f3f356178e0c07b19bbb8c7c23a39bbf4b310", to:"0x16b200744a740b0ca4379d57fc1b468d83a0382e", value:web3.toWei(10,"ether"), data:web3.toHex("Hello World!")})
eth.sendTransaction({from:eth.accounts[0], to:eth.accounts[1], value:web3.toWei(10,"ether"), data:web3.toHex("Hello World!")})
eth.sendTransaction({from:eth.accounts[0], to:eth.accounts[1], value:web3.toWei(10,"ether"), data:"0x68656c6c6f20776f726c6421"})

 

genesis.json 파일 생성하기

{
        "config": {
                "chainId": 119,
                "homesteadBlock": 0,
                "eip155Block": 0,
                "eip158Block": 0,
                "eip150Block": 0
        },

        "difficulty" : "0x20000",
        "gasLimit"   : "0x2fefd8",
        "alloc"      : {},
        "coinbase"   : "0x0000000000000000000000000000000000000000",
        "extraData"  : "",
        "nonce"      : "0x0000000000000000",
        "mixhash"    : "0x0000000000000000000000000000000000000000000000000000000000000000",
        "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
        "timestamp"  : "0x00"
}

 

genesis.json 파일 생성하기 2

{
        "config": {
                "chainId": 1234,
                "homesteadBlock": 1,
                "eip150Block": 2,
                "eip155Block": 3,
                "eip158Block": 3,
                "byzantiumBlock": 4,
                "constantinopleBlock": 5,
                "ethash": {}
        },

        "nonce": "0x00",
        "timestamp": "0x00",
        "extraData": "0x0000000000000000000000000000000000000000000000000000000000000000",
        "gasLimit": "0x47b760",
        "difficulty": "0x50000",
        "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
        "coinbase": "0x0000000000000000000000000000000000000000",
        "alloc": {},
        "number": "0x0",
        "gasUsed": "0x0",
        "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000"
}

 

 

728x90

댓글0