iT邦幫忙

2019 iT 邦幫忙鐵人賽

DAY 7
0
Blockchain

區塊鏈開發(Blockchain/DLT Application Development)系列 第 7

以太坊(Ethereum):環境建置 - Geth

推薦平台 Geth:

Geth - Ethereum node, Enode

建置環境

  • 公開鏈
    geth --mine --minerthread 2 --autodag –fast
    
  • 私有鏈
    • 設定創世塊 (Genesis Block)
      geth init genesis.json
      
    • 連接私有鏈
      geth --networkid 16888 --port 30303 --nodiscover --maxpeers 25 --nat "any" --rpc --rpccorsdomain "*" --rpcapi "eth,net,web3,debug" --mine --minerthreads 1 --autodag
      
    • 建立帳戶、部屬合約、進行交易、進行挖礦
    • 使用電子錢包

私有鏈設定

設定檔案

  • 創世塊:genesis.json
    {
        "difficulty": "0x0"
        ,"extraData": "0x16888"
        ,"gasLimit": "0x999999999"
        ,"mixhash": "ADDRESS"
        ,"nonce": "0x0"
        ,"timestamp": "0x0"
    }
    
  • 節點:static-nodes.json
    [
        "enode://ADDRESS@IP:PORT"
    ]
    

各種環境設定

Geth 指令

Enode

  • 進入本地端 geth 命令列控制介面
    geth attach
    
  • 加入 peer (於命令列控制介面)
    admin.addPeer("enode://ADDRESS@IP:PORT")
    
  • 設定 peer:static-nodes.json
    ["enode://ADDRESS@ IP:PORT"]
    

Account

  • 新增帳戶
    geth account new
    
  • 列出帳戶
    geth account list
    

上一篇
以太坊(Ethereum):環境建置 - Azure
下一篇
以太坊(Ethereum):交易與區塊
系列文
區塊鏈開發(Blockchain/DLT Application Development)30
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言