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"
    
  • 相关阅读:
    PyQt4布局管理——绝对定位方式
    PyQt4 菜单栏 + 工具栏 + 状态栏 + 中心部件 生成一个文本编辑部件示例
    PyQt4工具栏
    PyQt4菜单栏
    PyQt4状态栏
    PyQt4将窗口放在屏幕中间
    PyQt4消息窗口
    PyQt4关闭窗口
    Mysql基础之 ALTER命令
    电脑开机后win系统运行异常慢,鼠标移动卡
  • 原文地址:https://www.cnblogs.com/sethxiong/p/15337917.html
Copyright © 2011-2022 走看看