web3sdk 怎么配置连接区块链节点

2024-09-03 08:58

本文主要是介绍web3sdk 怎么配置连接区块链节点,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

一、下载

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/beanshttp://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 怎么配置连接区块链节点的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!


原文地址:
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.chinasem.cn/article/1132573

相关文章

Redis Cluster模式配置

《RedisCluster模式配置》:本文主要介绍RedisCluster模式配置,本文给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友参考下吧... 目录分片 一、分片的本质与核心价值二、分片实现方案对比 ‌三、分片算法详解1. ‌范围分片(顺序分片)‌2. ‌哈希分片3. ‌虚

SpringBoot项目配置logback-spring.xml屏蔽特定路径的日志

《SpringBoot项目配置logback-spring.xml屏蔽特定路径的日志》在SpringBoot项目中,使用logback-spring.xml配置屏蔽特定路径的日志有两种常用方式,文中的... 目录方案一:基础配置(直接关闭目标路径日志)方案二:结合 Spring Profile 按环境屏蔽关

Maven 配置中的 <mirror>绕过 HTTP 阻断机制的方法

《Maven配置中的<mirror>绕过HTTP阻断机制的方法》:本文主要介绍Maven配置中的<mirror>绕过HTTP阻断机制的方法,本文给大家分享问题原因及解决方案,感兴趣的朋友一... 目录一、问题场景:升级 Maven 后构建失败二、解决方案:通过 <mirror> 配置覆盖默认行为1. 配置示

Springboot3+将ID转为JSON字符串的详细配置方案

《Springboot3+将ID转为JSON字符串的详细配置方案》:本文主要介绍纯后端实现Long/BigIntegerID转为JSON字符串的详细配置方案,s基于SpringBoot3+和Spr... 目录1. 添加依赖2. 全局 Jackson 配置3. 精准控制(可选)4. OpenAPI (Spri

maven私服配置全过程

《maven私服配置全过程》:本文主要介绍maven私服配置全过程,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录使用Nexus作为 公司maven私服maven 私服setttings配置maven项目 pom配置测试效果总结使用Nexus作为 公司maven私

springboot加载不到nacos配置中心的配置问题处理

《springboot加载不到nacos配置中心的配置问题处理》:本文主要介绍springboot加载不到nacos配置中心的配置问题处理,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑... 目录springboot加载不到nacos配置中心的配置两种可能Spring Boot 版本Nacos

Nacos注册中心和配置中心的底层原理全面解读

《Nacos注册中心和配置中心的底层原理全面解读》:本文主要介绍Nacos注册中心和配置中心的底层原理的全面解读,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录临时实例和永久实例为什么 Nacos 要将服务实例分为临时实例和永久实例?1.x 版本和2.x版本的区别

java连接opcua的常见问题及解决方法

《java连接opcua的常见问题及解决方法》本文将使用EclipseMilo作为示例库,演示如何在Java中使用匿名、用户名密码以及证书加密三种方式连接到OPCUA服务器,若需要使用其他SDK,原理... 目录一、前言二、准备工作三、匿名方式连接3.1 匿名方式简介3.2 示例代码四、用户名密码方式连接4

如何搭建并配置HTTPD文件服务及访问权限控制

《如何搭建并配置HTTPD文件服务及访问权限控制》:本文主要介绍如何搭建并配置HTTPD文件服务及访问权限控制的问题,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录一、安装HTTPD服务二、HTTPD服务目录结构三、配置修改四、服务启动五、基于用户访问权限控制六、

MySQL 表的内外连接案例详解

《MySQL表的内外连接案例详解》本文给大家介绍MySQL表的内外连接,结合实例代码给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友参考下吧... 目录表的内外连接(重点)内连接外连接表的内外连接(重点)内连接内连接实际上就是利用where子句对两种表形成的笛卡儿积进行筛选,我