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

相关文章

MySQL 中的服务器配置和状态详解(MySQL Server Configuration and Status)

《MySQL中的服务器配置和状态详解(MySQLServerConfigurationandStatus)》MySQL服务器配置和状态设置包括服务器选项、系统变量和状态变量三个方面,可以通过... 目录mysql 之服务器配置和状态1 MySQL 架构和性能优化1.1 服务器配置和状态1.1.1 服务器选项

Nginx设置连接超时并进行测试的方法步骤

《Nginx设置连接超时并进行测试的方法步骤》在高并发场景下,如果客户端与服务器的连接长时间未响应,会占用大量的系统资源,影响其他正常请求的处理效率,为了解决这个问题,可以通过设置Nginx的连接... 目录设置连接超时目的操作步骤测试连接超时测试方法:总结:设置连接超时目的设置客户端与服务器之间的连接

SQL 中多表查询的常见连接方式详解

《SQL中多表查询的常见连接方式详解》本文介绍SQL中多表查询的常见连接方式,包括内连接(INNERJOIN)、左连接(LEFTJOIN)、右连接(RIGHTJOIN)、全外连接(FULLOUTER... 目录一、连接类型图表(ASCII 形式)二、前置代码(创建示例表)三、连接方式代码示例1. 内连接(I

SpringBoot+MyBatis-Flex配置ProxySQL的实现步骤

《SpringBoot+MyBatis-Flex配置ProxySQL的实现步骤》本文主要介绍了SpringBoot+MyBatis-Flex配置ProxySQL的实现步骤,文中通过示例代码介绍的非常详... 目录 目标 步骤 1:确保 ProxySQL 和 mysql 主从同步已正确配置ProxySQL 的

Spring Boot整合log4j2日志配置的详细教程

《SpringBoot整合log4j2日志配置的详细教程》:本文主要介绍SpringBoot项目中整合Log4j2日志框架的步骤和配置,包括常用日志框架的比较、配置参数介绍、Log4j2配置详解... 目录前言一、常用日志框架二、配置参数介绍1. 日志级别2. 输出形式3. 日志格式3.1 PatternL

MySql死锁怎么排查的方法实现

《MySql死锁怎么排查的方法实现》本文主要介绍了MySql死锁怎么排查的方法实现,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧... 目录前言一、死锁排查方法1. 查看死锁日志方法 1:启用死锁日志输出方法 2:检查 mysql 错误

配置springboot项目动静分离打包分离lib方式

《配置springboot项目动静分离打包分离lib方式》本文介绍了如何将SpringBoot工程中的静态资源和配置文件分离出来,以减少jar包大小,方便修改配置文件,通过在jar包同级目录创建co... 目录前言1、分离配置文件原理2、pom文件配置3、使用package命令打包4、总结前言默认情况下,

java如何通过Kerberos认证方式连接hive

《java如何通过Kerberos认证方式连接hive》该文主要介绍了如何在数据源管理功能中适配不同数据源(如MySQL、PostgreSQL和Hive),特别是如何在SpringBoot3框架下通过... 目录Java实现Kerberos认证主要方法依赖示例续期连接hive遇到的问题分析解决方式扩展思考总

Python中连接不同数据库的方法总结

《Python中连接不同数据库的方法总结》在数据驱动的现代应用开发中,Python凭借其丰富的库和强大的生态系统,成为连接各种数据库的理想编程语言,下面我们就来看看如何使用Python实现连接常用的几... 目录一、连接mysql数据库二、连接PostgreSQL数据库三、连接SQLite数据库四、连接Mo

oracle如何连接登陆SYS账号

《oracle如何连接登陆SYS账号》在Navicat12中连接Oracle11g的SYS用户时,如果设置了新密码但连接失败,可能是因为需要以SYSDBA或SYSOPER角色连接,解决方法是确保在连接... 目录oracle连接登陆NmOtMSYS账号工具问题解决SYS用户总结oracle连接登陆SYS账号