首页 / 区块链 / web3sdk 怎么配置连接区块链节点
web3sdk 怎么配置连接区块链节点
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了web3sdk 怎么配置连接区块链节点,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含3901字,纯文字阅读大概需要6分钟。
内容图文
一、下载
https://github.com/FISCO-BCOS/web3sdk
git clone https://github.com/FISCO-BCOS/web3sdk.git
二、构建
cd web3sdk
./gradlew build
三、拷贝节点证书到dist/conf/
# 拷贝证书(设SDK证书位于~/fisco/nodes/127.0.0.1/sdk目录)
$ cp -r ~/fisco/nodes/127.0.0.1/sdk/* conf
四、新增和修改配置文件applicationContext.xml
<?xml version="1.0" encoding="UTF-8" ?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
<bean id="encryptType"
class="org.fisco.bcos.web3j.crypto.EncryptType">
<constructor-arg value="0" /> <!-- 0:standard 1:guomi -->
</bean>
<bean id="groupChannelConnectionsConfig"
class="org.fisco.bcos.channel.handler.GroupChannelConnectionsConfig">
<!-- SSL certificate configuration -->
<property name="caCert" value="ca.crt" />
<property name="sslCert" value="sdk.crt" />
<property name="sslKey" value="sdk.key" />
<!-- GM SSL certificate configuration -->
<property name="gmCaCert" value="gmca.crt" />
<property name="gmEnSslCert" value="gmensdk.crt" />
<property name="gmEnSslKey" value="gmensdk.key" />
<property name="gmSslCert" value="gmsdk.crt" />
<property name="gmSslKey" value="gmsdk.key" />
<property name="allChannelConnections">
<list>
<bean id="group1"
class="org.fisco.bcos.channel.handler.ChannelConnections">
<property name="groupId" value="1" />
<property name="connectionsStr">
<list>
<value>192.168.64.129:20200</value>
<value>192.168.64.130:20200</value>
<value>192.168.64.131:20200</value>
<value>192.168.64.132:20200</value>
</list>
</property>
</bean>
<bean id="group2"
class="org.fisco.bcos.channel.handler.ChannelConnections">
<property name="groupId" value="2" />
<property name="connectionsStr">
<list>
<value>127.0.0.1:20202</value>
<value>127.0.0.1:20203</value>
</list>
</property>
</bean>
</list>
</property>
</bean>
<bean id="channelService"
class="org.fisco.bcos.channel.client.Service"
depends-on="groupChannelConnectionsConfig">
<property name="groupId" value="1" />
<property name="agencyName" value="agencyA" />
<property name="allChannelConnections"
ref="groupChannelConnectionsConfig"></property>
<!-- If you want to enable topic authentication, please uncomment the following configuration. -->
<!-- <property name="topic2KeyInfo" ref="amopVerifyTopicToKeyInfo"></property>-->
</bean>
<!-- If you want to enable topic authentication, please uncomment the following configuration. -->
<!--
<bean class="org.fisco.bcos.channel.handler.AMOPVerifyTopicToKeyInfo" id="amopVerifyTopicToKeyInfo">
<property name="topicToKeyInfo">
<map>
<entry key="helloworld00000001" value-ref="AMOPVerifyKeyInfo_helloworld00000001" />
</map>
</property>
</bean>
-->
<!-- If you are a topic producer, you need to configure the publicKey property.
Each authenticated consumer holds a different public-private key pair.
Please list the public key files of all the authenticated consumers.
-->
<!--
<bean class="org.fisco.bcos.channel.handler.AMOPVerifyKeyInfo" id="AMOPVerifyKeyInfo_helloworld00000001">
<property name="publicKey">
<list>
<value>classpath:$consumer_public_key_1.pem$</value>
<value>classpath:$consumer_public_key_2.pem$</value>
</list>
</property>
</bean>
-->
<!-- If you are a topic consumer, you need to configure the privateKey property.
This private key will authenticate you to the corresponding topic producer.
-->
<!--
<bean class="org.fisco.bcos.channel.handler.AMOPVerifyKeyInfo" id="AMOPVerifyKeyInfo_helloworld00000001">
<property name="privateKey" value="classpath:$consumer_private_key.pem$"></property>
</bean>
-->
</beans>
五、在dist文件下运行程序
java -cp conf/:lib/*:apps/* org.fisco.bcos.channel.test.parallel.parallelok.PerformanceDT 1 transfer 100000 4000 user 2
https://github.com/FISCO-BCOS/java-sdk-demo/blob/main/docs/README_CN.md
https://fisco-bcos-documentation.readthedocs.io/zh_CN/latest/docs/tutorial/stress_testing.html
内容总结
以上是互联网集市为您收集整理的web3sdk 怎么配置连接区块链节点全部内容,希望文章能够帮你解决web3sdk 怎么配置连接区块链节点所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。