이더리움 프로그래밍 환경 구축

in #ethereum6 years ago

이더리움 프로그래밍 환경 구축
지난 시간에 설치한 우분투 위에 이더리움 프로그래밍 환경을 구축하도록 합니다.

기본 환경 구축하기

  1. Geth를 아래와 같이 git을 이용해서 다운받습니다. 현재 최신 버전은 1.8.3입니다.

이더리움 엔진 구동

  1. 새로운 account 생성을 geth를 실행하고 아래와 같이 입력합니다.
  • geth --datadir "./ethereum" account new
  1. 최초의 제네시스 파일을 생성합니다.
    geth --datadir "./ethereum" init "genesis.json"
    *************** genesis.json ******************
    {
    "config": {
    "chainId": 30,
    "homesteadBlock": 0,
    "eip155Block": 0,
    "eip158Block": 0
    },
    "nonce": "0x0000000000000033",
    "timestamp": "0x0",
    "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "gasLimit": "0x8000000",
    "difficulty": "0x100",
    "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "coinbase": "0x3333333333333333333333333333333333333333",
    "alloc": {
    "0x1892ab9ece91733a7a81fc7240a40c4c19d0a517": {"balance": "10000000000000000000"}
    }
    }

  2. 아래와 같이 geth를 실행합니다.
    geth --datadir "./ethereum" --rpc --rpcaddr 0.0.0.0 --rpcport "8552" --rpcapi "admin,db,eth,debug,miner,net,shh,txpool,personal,web3" --port 3030 --nodiscover --networkid 30 console

  3. 전송을 위해 새로운 account를 생성합니다. 이번에는 geth에서 사용하는 명령어입니다.

  • personal.newAccount("Susie")
  • eth.accounts //생성된 2개의 account를 확인합니다.

["0x1892ab9ece91733a7a81fc7240a40c4c19d0a517", "0xd00ab1c0e22cbc2a2cc52d97eaca1f85be896b05"]

  1. 앞에 제네시스 파일 생성시 ethereum account에 선지급한 보상의 반영을 위해 아래와 같이 마이닝을 구동합니다.
  • miner.start() // 종료는 miner.stop(), 마이닝을 구동한 후 블록의 확인은 eth.blockNumber
  1. ethereum 계정에서 susie 계정을 돈을 옮기기 위해 먼저 ethereum 계정을 unlock 합니다.
  • personal.unlockAccount(eth.accounts[0])
  • eth.sendTransaction({from:eth.accounts[0], to:eth.accounts[1], value:web3.toWei(0.5,"ether")})
    eth.pendingTransactions

위와 같이 순서대로 진행하시면 기본적으로 이더리움 프로그래밍을 위한 기본 환경이 구축됩니다.

Sort:  

Congratulations @jjarinbaji! You received a personal award!

1 Year on Steemit

Click here to view your Board of Honor

Support SteemitBoard's project! Vote for its witness and get one more award!

Congratulations @jjarinbaji! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 2 years!

You can view your badges on your Steem Board and compare to others on the Steem Ranking

Vote for @Steemitboard as a witness to get one more award and increased upvotes!

Coin Marketplace

STEEM 0.18
TRX 0.15
JST 0.029
BTC 62260.20
ETH 2431.98
USDT 1.00
SBD 2.64