zoukankan      html  css  js  c++  java
  • ethereum-在Ubuntu上搭建私有链

    安装

    sudo apt-get install software-properties-common
    sudo add-apt-repository -y ppa:ethereum/ethereum
    sudo apt-get update
    sudo apt-get install ethereum

    genesis.json

    {
      "config": {
            "chainId": 2018,
            "homesteadBlock": 0,
            "eip155Block": 0,
            "eip158Block": 0
        },
      "alloc": {},
      "coinbase"   : "0x0000000000000000000000000000000000000000",
      "difficulty" : "0xffff",
      "extraData"  : "",
      "gasLimit"   : "0x8ac7230489e80000",
      "nonce"      : "0x0000000000000032",
      "mixhash"    : "0x0000000000000000000000000000000000000000000000000000000000000000",
      "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
      "timestamp"  : "0x00"
    }

    初始化

    geth --datadir ./tmpPrivate init ./genesis.json

    启动

    geth --datadir ./tmpPrivate --nodiscover --networkid 2018 --rpc --rpcaddr="0.0.0.0" --rpcport="8545" --rpcapi personal,db,eth,net,web3,miner --minerthreads 1 --rpccorsdomain "*" console 2>>.tmpPrivategeth.log

    通过privateKey创建账户

    personal.importRawKey("d77278e071eb1a5ced7c5076d25ff00060b67cb0c49f19008e9565a6e29fcabd","password")

    直接通过password创建账户
    personal.newAccount("password")

    查看本地账户

    eth.accounts

    开启挖矿

    miner.start(1);

    查询余额

    eth.getBalance(eth.accounts[0])

    以太币单位转换
    web3.fromWei(eth.getBalance(eth.accounts[0]), 'ether')

    https://github.com/ethereum/go-ethereum/wiki/Installation-Instructions-for-Ubuntu

  • 相关阅读:
    jquery 年月日分离
    Jquery实现常用的分类搜索跳转
    SQL Server 利用触发器对多表视图进行更新
    TEA XTEA XXTEA 学习笔记
    IDApro自带动调初探
    HECTFreverse部分writeup
    NCTF2021逆向WP(部分)
    buuctf[刮开有奖]writeup
    base64学习笔记
    深夜写文——致19岁的自己
  • 原文地址:https://www.cnblogs.com/holoyong/p/9055264.html
Copyright © 2011-2022 走看看