欢迎来到ethereumj
关于
ethereumj是以太坊协议的纯Java实现。有关以太坊及其目标的更多信息,请访问ethereum.org 。 以太坊白皮书提供了一个完整的概念性概述,而黄皮书提供了协议的正式定义。
运行EthereumJ
添加为您的Maven项目的依赖项:
<dependency> <groupId>org.ethereum</groupId> <artifactId>ethereumj-core</artifactId> <version>1.9.0-RELEASE</version> </dependency>
或您的Gradle项目:
repositories { mavenCentral() jcenter() maven { url "https://dl.bintray.com/ethereum/maven/" } } implementation "org.ethereum:ethereumj-core:1.9.+"
作为您自己项目的起点,请查看 https://github.com/ether-camp/ethereumj .starter
构建可执行JAR
git clone https://github.com/ethereum/ethereumj cd 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=<sample class>]
可选示例尝试:
./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
对于快照构建:
请注意,快照不稳定,目前正在开发中! 如果你还想尝试一下:
- 增加 https://oss.jfrog.org/libs-snapshot/ 作为构建脚本的存储库
- 添加依赖项
org.ethereum:ethereumj-core:${VERSION}
, 其中${VERSION}
类似于1.9.0-SNAPSHOT
这样的形式。
示例:
<repository> <id>jfrog-snapshots</id> <name>oss.jfrog.org</name> <url>https://oss.jfrog.org/libs-snapshot/</url> <snapshots><enabled>true</enabled></snapshots> </repository> <!-- ... --> <dependency> <groupId>org.ethereum</groupId> <artifactId>ethereumj-core</artifactId> <version>1.9.0-SNAPSHOT</version> </dependency>
将项目导入到IntelliJ IDEA:
> git clone https://github.com/ethereum/ethereumj > cd ethereumj > gradlew build
IDEA:
- File -> New -> 来自现有资源的项目...
- 选择ethereumj/build.gradle
- 对话框“Import Project from gradle”:按“OK”
- 在构建完成之后,运行 org.ethereum.Start , org.ethereum.samples.* 之一或创建自己的main。
配置EthereumJ
有关所有现有选项的参考,其描述和默认值,您可以参考默认配置 ethereumj.conf (您可以在库jar或源代码树中找到 ethereum -core/SRC /主/资源) 要覆盖需要的选项,您可以使用以下方法之一:
- 将选项放入&lt;工作目录&gt; /config/ethereumj.conf 文件
- 将 user.conf 放到您的类路径的根目录下(作为资源)
- 将您的选项放在任何文件中,并通过
-Dethereumj.conf.file=<config1>,<config2>
- 以编程方式使用
SystemProperties.CONFIG.override*()
- 通过覆盖 SpringSystemProperties bean 以编程方式使用
请注意,不需要将所有选项都放到您的自定义配置中,只需要将其覆盖即可。
特别感谢
YourKit绝对免费为我们提供了漂亮的分析器。
YourKit通过其全功能的Java Profiler支持开源项目。
YourKit,LLC是 YourKit Java Profiler 的创建者 和 YourKit .NET Profiler , 创新和智能工具来分析Java和.NET应用程序。
联系
通过 Gitter 与我们聊天
许可证
ethereumj是根据 LGPL-V3许可证发布的。