以太坊的geth java api调用

匿名 (未验证) 提交于 2019-12-02 20:37:20
  • 安装了geth客户端,并且能运行起来
  • java开发环境
  • 我这里是Linux ,在geth目录下运行命令:
./geth --datadir /home/zzq/app/geth/data  --rpc --rpcaddr 192.168.137.134 --rpcapi "db,eth,net,web3,miner,personal"   console -dev
  • 如果是maven项目就好办了,直接写pom(如果不是只能一个个jar下载了)
<properties>         <geth.version>3.2.0</geth.version>     </properties> <!-- geth 依赖 -->         <dependency>             <groupId>org.web3j</groupId>             <artifactId>core</artifactId>             <version>${geth.version}</version>         </dependency>         <dependency>             <groupId>org.web3j</groupId>             <artifactId>geth</artifactId>             <version>${geth.version}</version>         </dependency>           <dependency>             <groupId>org.web3j</groupId>             <artifactId>parity</artifactId>             <version>${geth.version}</version>         </dependency>
  • 测试代码 GethClientServiceImpl.java
  • 这里面只有几个基础的操作(我是直接把service拷贝过来的看起来可能有点别扭,还请勿怪),其他的可以查阅官方的文档。

到这儿基本结束了,另外文章代码或者我理解有误的地方,希望能批评指出。

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!