Skip to content
This repository was archived by the owner on Jan 13, 2025. It is now read-only.

Commit 9fd2f45

Browse files
bladechenshenglong.chensl
authored andcommitted
[project] first commit
1 parent e8ee932 commit 9fd2f45

File tree

35 files changed

+4000
-3
lines changed

35 files changed

+4000
-3
lines changed

LEGAL.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Legal Disclaimer
2+
3+
Within this source code, the comments in Chinese shall be the original, governing version. Any comment in other languages are for reference only. In the event of any conflict between the Chinese language version comments and other language version comments, the Chinese language version shall prevail.
4+
5+
法律免责声明
6+
7+
关于代码注释部分,中文注释为官方版本,其它语言注释仅做参考。中文注释可能与其它语言注释存在不一致,当中文注释与其它语言注释存在不一致时,请以中文注释为准。

LICENSE

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,15 +178,15 @@
178178
APPENDIX: How to apply the Apache License to your work.
179179

180180
To apply the Apache License to your work, attach the following
181-
boilerplate notice, with the fields enclosed by brackets "[]"
181+
boilerplate notice, with the fields enclosed by brackets "{}"
182182
replaced with your own identifying information. (Don't include
183183
the brackets!) The text should be enclosed in the appropriate
184184
comment syntax for the file format. We also recommend that a
185185
file or class name and description of purpose be included on the
186186
same "printed page" as the copyright notice for easier
187187
identification within third-party archives.
188188

189-
Copyright [yyyy] [name of copyright owner]
189+
Copyright {yyyy} {name of copyright owner}
190190

191191
Licensed under the Apache License, Version 2.0 (the "License");
192192
you may not use this file except in compliance with the License.
@@ -198,4 +198,4 @@
198198
distributed under the License is distributed on an "AS IS" BASIS,
199199
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200200
See the License for the specific language governing permissions and
201-
limitations under the License.
201+
limitations under the License.

README.md

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
<div align="center">
2+
<img alt="am logo" src="https://gw.alipayobjects.com/zos/bmw-prod/3ee4adc7-1960-4dbf-982e-522ac135a0c0.svg" width="250" >
3+
<h1 align="center">Antchain Bridge Plugin Server</h1>
4+
<p align="center">
5+
<a href="http://makeapullrequest.com">
6+
<img alt="pull requests welcome badge" src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat">
7+
</a>
8+
</p>
9+
</div>
10+
11+
# Introduction
12+
13+
Antchain Bridge 插件服务(PluginServer, PS)用于管理异构链插件、完成与中继通信的工作。
14+
15+
- **插件管理能力**
16+
17+
在开发者完成一个异构链插件开发之后,将该插件打包放到PS的指定路径之下,启动PS即可加载该插件,PS将完成插件和区块链桥接组件(Blockchain Bridge Component, BBC)对象的管理等工作,PS还提供了CLI工具完成诸如插件重新加载、停止等工作。
18+
19+
- **与中继通信**
20+
21+
将PS注册到一个中继之后,PS会作为一个RPC Server为中继提供服务,PS和中继之间会建立双向认证的TLS连接,确保身份互认和安全性,中继会发送请求要求PS完成BBC对象初始化等工作,并调用BBC的接口,完成与异构链的交互。
22+
23+
# Architecture
24+
25+
下面介绍了中继服务的整体架构。
26+
27+
**以下插件BCOS和插件ChainMaker均为展示用例,代表不同的异构插件实现*
28+
29+
<img src="https://intranetproxy.alipay.com/skylark/lark/0/2023/jpeg/13456461/1677744080321-3622114c-52c2-432c-9ceb-0f3d07c290e4.jpeg" style="zoom:33%;" />
30+
31+
# Get Started
32+
33+
## Build
34+
35+
进入代码的根目录,运行mvn编译即可:
36+
37+
```shell
38+
mvn clean package
39+
```
40+
41+
产生的安装包在`ps-bootstrap/target/plugin-server-0.1.0-SNAPSHOT.tar.gz`
42+
43+
## Configuration
44+
45+
在获得安装包之后,执行解压缩操作,这里以`plugin-server-0.1.0-SNAPSHOT.tar.gz`为例。
46+
47+
```
48+
tar -zxf plugin-server-0.1.0-SNAPSHOT.tar.gz
49+
```
50+
51+
进入解压后的目录,可以看到:
52+
53+
```
54+
cd plugin-server/
55+
tree .
56+
.
57+
├── README.md
58+
├── bin
59+
│   ├── init_tls_certs.sh
60+
│   ├── print.sh
61+
│   ├── start.sh
62+
│   └── stop.sh
63+
├── config
64+
│   └── application.yml
65+
└── lib
66+
   └── ps-bootstrap-0.1.0-SNAPSHOT.jar
67+
68+
69+
3 directories, 7 files
70+
```
71+
72+
首先,初始化PS的TLS秘钥和证书,该脚本将会在项目根目录下创建文件夹`certs`,下面存储了私钥`server.key`、证书`server.crt`、信任的证书`trust.crt`
73+
74+
```
75+
./bin/init_tls_certs.sh
76+
```
77+
78+
然后,在和中继建立连接之前,中继的运维人员应该将中继的证书发送给了您,比如`relayer.crt`,您需要将这个证书添加到`trust.crt`中。
79+
80+
```
81+
cat relayer.crt >> trust.crt
82+
```
83+
84+
最后修改您的配置文件,将证书目录配置进去。
85+
86+
```
87+
vi config/application.yml
88+
```
89+
90+
依次替换`grpc.server.security.certificate-chain``grpc.server.security.private-key``grpc.server.security.trustCertCollection`的配置项。
91+
下面给出一个例子,示例中诸如`/path/to/certs/server.crt`的具体配置属性值请替换为您的实际路径,`file:`保留:
92+
93+
```yaml
94+
grpc:
95+
server:
96+
security:
97+
# server certificate
98+
certificate-chain: file:/path/to/certs/server.crt
99+
# server key
100+
private-key: file:/path/to/certs/server.key
101+
# Mutual Certificate Authentication
102+
trustCertCollection: file:/path/to/certs/trust.crt
103+
```
104+
105+
然后修改插件库路径,PS将加载这个路径下的插件。修改配置项`pluginserver.plugin.repo`,比如:
106+
107+
```yaml
108+
pluginserver:
109+
plugin:
110+
# where to load the hetero-chain plugins
111+
repo: /path/to/plugins
112+
```
113+
114+
将您的插件都放到这个路径下即可。
115+
116+
## Run
117+
118+
在解压包根目录之下,运行一下命令即可:
119+
120+
```
121+
./bin/start.sh
122+
```
123+
124+
看到下面的输出即启动成功:
125+
126+
```
127+
___ __ ______ __ _ ____ _ __
128+
/ | ____ / /_ / ____// /_ ____ _ (_)____ / __ ) _____ (_)____/ /____ _ ___
129+
/ /| | / __ \ / __// / / __ \ / __ `// // __ \ / __ |/ ___// // __ // __ `// _ \
130+
/ ___ | / / / // /_ / /___ / / / // /_/ // // / / / / /_/ // / / // /_/ // /_/ // __/
131+
/_/ |_|/_/ /_/ \__/ \____//_/ /_/ \__,_//_//_/ /_/ /_____//_/ /_/ \__,_/ \__, / \___/
132+
/____/
133+
134+
[ INFO ]_[ 2023-03-30 15:11:27.1680160287 ] : start plugin-server now...
135+
[ INFO ]_[ 2023-03-30 15:11:27.1680160287 ] : plugin-server started successfully
136+
```
137+
138+
可以通过`bin/stop.sh`关闭服务。
139+
140+
日志文件存储在`log`目录之下。
141+
142+
## Run Test
143+
144+
在运行测试之前,请使用`ps-bootstrap/src/main/resources/scripts/init_tls_certs.sh`生成证书,并将`server.key`和`server.crt` 放到`ps-bootstrap/src/test/resources`之下,运行下述命令即可运行测试用例:
145+
146+
```
147+
mvn test
148+
```
149+
150+
# CLI Usage
151+
152+
敬请期待
153+

0 commit comments

Comments
 (0)