zoukankan      html  css  js  c++  java
  • 02. 最佳实践

    参考

    https://geth.ethereum.org/docs/getting-started/dev-mode

    在开发模式下启动 Geth

    您可以使用该--datadir选项指定一个数据目录来维护两次运行之间的状态,否则,数据库是临时的并且在内存中:

    mkdir test-chain-dir
    

    对于本指南,在开发模式下启动 geth,并启用RPC以便您可以将其他应用程序连接到 geth。在本指南中,我们使用基于 Web 的以太坊 IDE Remix,因此也允许其域接受跨域请求。

    geth --datadir test-chain-dir --http --dev --http.corsdomain "https://remix.ethereum.org,http://remix.ethereum.org"
    

    从另一个终端窗口连接到节点上的 IPC 控制台:

    geth attach <IPC_LOCATION>
    

    一旦 geth 在开发模式下运行,您就可以像当 geth 以其他方式运行时一样与它进行交互。

    例如,创建一个测试帐户:

    > personal.newAccount()
    

    并将以太币从 coinbase 转移到新账户:

    > eth.sendTransaction({from:eth.coinbase, to:eth.accounts[1], value: web3.toWei(0.05, "ether")})
    

    并查看账户余额:

    > eth.getBalance(eth.accounts[1])
    

    如果你想用真实的区块时间测试你的 dapps,请在使用参数--dev.period启动开发模式时使用该选项--dev.period 14

    geth --datadir test-chain-dir --http --http.addr 0.0.0.0 --dev.period 14 --http.corsdomain "https://remix.ethereu
    m.org,http://remix.ethereum.org"
    

    宿主机无法访问容器

    添加 --http.addr 0.0.0.0

    geth --datadir test-chain-dir --http --http.addr 0.0.0.0 --dev --http.corsdomain "https://remix.ethereum.org,http://remix.ethereum.org"
    
  • 相关阅读:
    tensorflow 学习笔记 多层感知机
    tensorflow 学习笔记(转)
    python学习笔记 map&&reduce
    java中的接口和php的接口的区别
    php中的内存划分
    workerman stop失败
    Java中的内存划分
    php和java语法区别
    Docker:Swarm + Stack 一站式部署容器集群
    docker 配置私有仓库
  • 原文地址:https://www.cnblogs.com/sethxiong/p/15337917.html
Copyright © 2011-2022 走看看