运行 Ethereum-Harmony

半兽人 发表于: 2018-09-18   最后更新时间: 2020-03-18 09:27:12  
{{totalSubscript}} 订阅, 5,011 游览

screenshot

什么是Ethereum Harmony

EthereumJ是以太坊协议的纯Java实现。

开发者希望保持EthereumJ尽可能薄,EthereumJ仅仅包含了挖矿算法、vm等核心功能。而对于JSON-RPC支持和其他客户端功能,用Ethereum Harmony来完成的。

特性:

  • Ethereum 对等 JSON-RPC 2.0 标准 ;

  • 保持在文件系统中 私钥keys keystore 与 go-ethereum 兼容;

  • 提供在浏览器命令行终端;

  • Blockchain 规范追踪;

  • 监听peer连接;

  • 简易的 Ethereum 钱包;

  • 完整追踪合约存储;

环境准备

  • Java 8 (64 bit)

运行

  • git clone git@github.com:ether-camp/ethereum-harmony.git
  • cd ethereum-harmony
  • 运行: gradlew runMain (其他可选的环境)

游览器可以访问 http://localhost:8080
JSON-RPC 访问地址是 http://localhost:8545/rpchttp://localhost:8545

也提供了禁用不需要的功能,可以禁用任何应用程序模块:Web,合约,RPC。点击这里查看禁用。

只运行 RPC : gradlew runMain -PrpcOnly

(*) 可以使用 gradlew runMain -Dserver.port=9999 改变web端口。

命令行选项

环境 运行 ...
Main gradlew runMain Start server connecting to Main network
Ropsten gradlew runRopsten Start server connecting to Ropsten network
Classic gradlew runClassic Start server connecting to Ethereum Classic network
Private gradlew runPrivate Start server, no network connection, single miner running
Custom gradlew runCustom Start server connecting to custom network

运行一个自定义的网络(Run in a custom network)

  • git clone https://github.com/ether-camp/ethereum-harmony
  • cd ethereum-harmony
  • 使用自定义配置:
gradlew runCustom -Dethereumj.conf.file=/path/to/custom.conf
  • 也可以使用CLI传递参数的方式:
gradlew runCustom -Dpeer.networkId=10101 -DgenesisFile=/path/to/custom/genesis.json -Dpeer.discovery.enabled=false -Dpeer.active.0.url=enode://0f4a5f92835a4604ecd9639ddcfb86d2a2999ad9328bc088452efffe4a7c6cd0eaaef77c779dc56fc1d0f21cd578eeb92cb5@23.101.151.28:30303

注意: 自定义配置或CLI不替换的参数将默认从ethereumj.conf中获取.

自定义配置文件格式

格式和ethereumj.conf一致,还可以仅指定必要的配置参数。

例如:

  genesisFile = /path/to/custom/genesis.json
  database.dir = database-private

  peer {
    networkId = 10101
    listen.port = 50505

    discovery.enabled = false
    active = [
      {url = "enode://6ce05930c72abc632c58e2e4324f7c7ea478cec0ed4fa2528982cf34483094e9cbc9216e7aa349691242576d552a2a56aaeae426c5303ded677ce455ba1acd9d@13.84.180.240:30303"}
      {url = "enode://20c9ad97c081d63397d7b685a412227a40e23c8bdc6688c6f37e97cfbc22d2b4d1db1510d8f61e6a8866ad7f0e17c02b14182d37ea7c3c8b9c2683aeb6b733a1@52.169.14.227:30303"}
    ]
  }

  sync.fast.enabled = false

如果在不使用Gradle的情况下运行Harmony,请将-Dethereumj.conf.res=harmony.conf添加到命令行中,这样Harmony属性也将应用于系统的上下文。

如果您使用一些自定义资源文件作为配置,只需将-Dethereumj.conf.res=harmony.conf,custom.conf添加到java exec命令中,这样2个配置都会应用。

更新于 2020-03-18
在线,26分钟前登录

Jevon 3年前

Caused by: org.rocksdb.RocksDBException: Failed to create dir: C:\Users\Jevon\ethereumj\database\blockchain: No such file or directory

半兽人 -> Jevon 3年前
C:\Users\Jevon\ethereumj\database\blockchain

目录不存在

Jevon -> 半兽人 3年前

我手动建了 也不行;启动还是报错

Jevon -> 半兽人 3年前

微博私信你了,能否加个微信 沟通一下

半兽人 -> Jevon 3年前

这个错误 还是比较明显的吧。

Jevon -> 半兽人 3年前

我知道明细啊,他说没有目录我手动建了呢;

查看ethereumj更多相关的文章或提一个关于ethereumj的问题,也可以与我们一起分享文章