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

相关文章

鸿蒙中Axios数据请求的封装和配置方法

《鸿蒙中Axios数据请求的封装和配置方法》:本文主要介绍鸿蒙中Axios数据请求的封装和配置方法,本文给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友参考下吧... 目录1.配置权限 应用级权限和系统级权限2.配置网络请求的代码3.下载在Entry中 下载AxIOS4.封装Htt

Spring中配置ContextLoaderListener方式

《Spring中配置ContextLoaderListener方式》:本文主要介绍Spring中配置ContextLoaderListener方式,具有很好的参考价值,希望对大家有所帮助,如有错误... 目录Spring中配置ContextLoaderLishttp://www.chinasem.cntene

python连接本地SQL server详细图文教程

《python连接本地SQLserver详细图文教程》在数据分析领域,经常需要从数据库中获取数据进行分析和处理,下面:本文主要介绍python连接本地SQLserver的相关资料,文中通过代码... 目录一.设置本地账号1.新建用户2.开启双重验证3,开启TCP/IP本地服务二js.python连接实例1.

浅谈配置MMCV环境,解决报错,版本不匹配问题

《浅谈配置MMCV环境,解决报错,版本不匹配问题》:本文主要介绍浅谈配置MMCV环境,解决报错,版本不匹配问题,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录配置MMCV环境,解决报错,版本不匹配错误示例正确示例总结配置MMCV环境,解决报错,版本不匹配在col

Nginx中配置HTTP/2协议的详细指南

《Nginx中配置HTTP/2协议的详细指南》HTTP/2是HTTP协议的下一代版本,旨在提高性能、减少延迟并优化现代网络环境中的通信效率,本文将为大家介绍Nginx配置HTTP/2协议想详细步骤,需... 目录一、HTTP/2 协议概述1.HTTP/22. HTTP/2 的核心特性3. HTTP/2 的优

Python 安装和配置flask, flask_cors的图文教程

《Python安装和配置flask,flask_cors的图文教程》:本文主要介绍Python安装和配置flask,flask_cors的图文教程,本文通过图文并茂的形式给大家介绍的非常详细,... 目录一.python安装:二,配置环境变量,三:检查Python安装和环境变量,四:安装flask和flas

Ubuntu中远程连接Mysql数据库的详细图文教程

《Ubuntu中远程连接Mysql数据库的详细图文教程》Ubuntu是一个以桌面应用为主的Linux发行版操作系统,这篇文章主要为大家详细介绍了Ubuntu中远程连接Mysql数据库的详细图文教程,有... 目录1、版本2、检查有没有mysql2.1 查询是否安装了Mysql包2.2 查看Mysql版本2.

Python3.6连接MySQL的详细步骤

《Python3.6连接MySQL的详细步骤》在现代Web开发和数据处理中,Python与数据库的交互是必不可少的一部分,MySQL作为最流行的开源关系型数据库管理系统之一,与Python的结合可以实... 目录环境准备安装python 3.6安装mysql安装pymysql库连接到MySQL建立连接执行S

SpringCloud动态配置注解@RefreshScope与@Component的深度解析

《SpringCloud动态配置注解@RefreshScope与@Component的深度解析》在现代微服务架构中,动态配置管理是一个关键需求,本文将为大家介绍SpringCloud中相关的注解@Re... 目录引言1. @RefreshScope 的作用与原理1.1 什么是 @RefreshScope1.

SpringBoot日志配置SLF4J和Logback的方法实现

《SpringBoot日志配置SLF4J和Logback的方法实现》日志记录是不可或缺的一部分,本文主要介绍了SpringBoot日志配置SLF4J和Logback的方法实现,文中通过示例代码介绍的非... 目录一、前言二、案例一:初识日志三、案例二:使用Lombok输出日志四、案例三:配置Logback一