运行EthereumJ
作为依赖项添加到Maven项目:
org.ethereum
ethereumj-core
1.8.1-RELEASE
或者你的Gradle项目:repositories {
mavenCentral()
jcenter()
maven { url "https://dl.bintray.com/ethereum/maven/" }
}
compile "org.ethereum:ethereumj-core:1.8.+"
作为你项目的起点,任何一个项目都可以以下列方式启动:git clone https://github.com/ether-camp/ethereumj.starter./gradlew run
检查你的本地区块链如何同步使用:curl -w "\n" -X GET http://localhost:8080/bestBlock
构建可执行的JARgit clone https://github.com/ethereum/ethereumjcd ethereumj
cp ethereumj-core/src/main/resources/ethereumj.conf ethereumj-core/src/main/resources/user.conf
vim ethereumj-core/src/main/resources/user.conf # adjust user.conf to your needs./gradlew clean fatJar
java -jar ethereumj-core/build/libs/ethereumj-core-*-all.jar
从命令行运行:> git clone https://github.com/ethereum/ethereumj> cd ethereumj
> ./gradlew run [-PmainClass=]
可以运行任意一个测试示例:./gradlew run -PmainClass=org.ethereum.samples.BasicSample
./gradlew run -PmainClass=org.ethereum.samples.FollowAccount
./gradlew run -PmainClass=org.ethereum.samples.PendingStateSample
./gradlew run -PmainClass=org.ethereum.samples.PriceFeedSample
./gradlew run -PmainClass=org.ethereum.samples.PrivateMinerSample
./gradlew run -PmainClass=org.ethereum.samples.TestNetSample
./gradlew run -PmainClass=org.ethereum.samples.TransactionBomb
快照构建
请注意,快照不稳定,目前正在开发中!如果你还想尝试一下:添加依赖项org.ethereum:ethereumj-core:${VERSION},${VERSION}位置的值是1.9.0-SNAPSHOT。
示例如下:
jfrog-snapshots
oss.jfrog.org
https://oss.jfrog.org/libs-snapshot/
true
org.ethereum
ethereumj-core
1.9.0-SNAPSHOT
将项目导入IntelliJ IDEA:> git clone https://github.com/ethereum/ethereumj
> cd ethereumj
> gradlew build
IDEA:File -> New -> Project from existing sources......
选择 ethereumj/build.gradle
对话框“Import Project from gradle”:点击“ok”
在构建之后运行org.ethereum.Start,org.ethereum.samples.*之一或创建自己的主程序。
配置EthereumJ
有关所有现有选项,其描述和默认值的参考,你可以参考默认配置ethereumj.conf(你可以在jar库或源代码ethereum-core/src/main/resources目录中找到它),要重新设置所需的选项,你可以使用以下方法之一:把你的选项放到/config/ethereumj.conf文件中
把user.conf放到classpath的启动目录中(作为一个资源)
将你的选项放在任何文件中并通过它提供-Dethereumj.conf.file=
编程通过SystemProperties.CONFIG.override*()使用
编程重写Spring SystemPropertiesbean来使用
作者:编程狂魔
链接:https://www.jianshu.com/p/2991cf37b74f