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

相关文章

nginx 负载均衡配置及如何解决重复登录问题

《nginx负载均衡配置及如何解决重复登录问题》文章详解Nginx源码安装与Docker部署,介绍四层/七层代理区别及负载均衡策略,通过ip_hash解决重复登录问题,对nginx负载均衡配置及如何... 目录一:源码安装:1.配置编译参数2.编译3.编译安装 二,四层代理和七层代理区别1.二者混合使用举例

Java JDK1.8 安装和环境配置教程详解

《JavaJDK1.8安装和环境配置教程详解》文章简要介绍了JDK1.8的安装流程,包括官网下载对应系统版本、安装时选择非系统盘路径、配置JAVA_HOME、CLASSPATH和Path环境变量,... 目录1.下载JDK2.安装JDK3.配置环境变量4.检验JDK官网下载地址:Java Downloads

C#连接SQL server数据库命令的基本步骤

《C#连接SQLserver数据库命令的基本步骤》文章讲解了连接SQLServer数据库的步骤,包括引入命名空间、构建连接字符串、使用SqlConnection和SqlCommand执行SQL操作,... 目录建议配合使用:如何下载和安装SQL server数据库-CSDN博客1. 引入必要的命名空间2.

Linux下进程的CPU配置与线程绑定过程

《Linux下进程的CPU配置与线程绑定过程》本文介绍Linux系统中基于进程和线程的CPU配置方法,通过taskset命令和pthread库调整亲和力,将进程/线程绑定到特定CPU核心以优化资源分配... 目录1 基于进程的CPU配置1.1 对CPU亲和力的配置1.2 绑定进程到指定CPU核上运行2 基于

Spring Boot spring-boot-maven-plugin 参数配置详解(最新推荐)

《SpringBootspring-boot-maven-plugin参数配置详解(最新推荐)》文章介绍了SpringBootMaven插件的5个核心目标(repackage、run、start... 目录一 spring-boot-maven-plugin 插件的5个Goals二 应用场景1 重新打包应用

Java中读取YAML文件配置信息常见问题及解决方法

《Java中读取YAML文件配置信息常见问题及解决方法》:本文主要介绍Java中读取YAML文件配置信息常见问题及解决方法,本文给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要... 目录1 使用Spring Boot的@ConfigurationProperties2. 使用@Valu

Jenkins分布式集群配置方式

《Jenkins分布式集群配置方式》:本文主要介绍Jenkins分布式集群配置方式,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录1.安装jenkins2.配置集群总结Jenkins是一个开源项目,它提供了一个容易使用的持续集成系统,并且提供了大量的plugin满

Java通过驱动包(jar包)连接MySQL数据库的步骤总结及验证方式

《Java通过驱动包(jar包)连接MySQL数据库的步骤总结及验证方式》本文详细介绍如何使用Java通过JDBC连接MySQL数据库,包括下载驱动、配置Eclipse环境、检测数据库连接等关键步骤,... 目录一、下载驱动包二、放jar包三、检测数据库连接JavaJava 如何使用 JDBC 连接 mys

SpringBoot线程池配置使用示例详解

《SpringBoot线程池配置使用示例详解》SpringBoot集成@Async注解,支持线程池参数配置(核心数、队列容量、拒绝策略等)及生命周期管理,结合监控与任务装饰器,提升异步处理效率与系统... 目录一、核心特性二、添加依赖三、参数详解四、配置线程池五、应用实践代码说明拒绝策略(Rejected

Qt使用QSqlDatabase连接MySQL实现增删改查功能

《Qt使用QSqlDatabase连接MySQL实现增删改查功能》这篇文章主要为大家详细介绍了Qt如何使用QSqlDatabase连接MySQL实现增删改查功能,文中的示例代码讲解详细,感兴趣的小伙伴... 目录一、创建数据表二、连接mysql数据库三、封装成一个完整的轻量级 ORM 风格类3.1 表结构