Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions acb-sdk/pluginset/dioxide/offchain-plugin/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<div align="center">
<img alt="am logo" src="https://gw.alipayobjects.com/zos/bmw-prod/3ee4adc7-1960-4dbf-982e-522ac135a0c0.svg" width="250" >
<h1 align="center">Dioxide Plugin</h1>
<p align="center">
<a href="http://makeapullrequest.com">
<img alt="pull requests welcome badge" src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat">
</a>
</p>
</div>



| 说明 | 链接 |
|-------------------|-----------------|
| ⭐️ 参考的dioxid_python_sdk | [dioxide_python](https://github.com/1220292040/dioxide_python) |
| ✅ 测试通过的 dioxide | 2025.11.18更新版本,可联系dioxid_python仓库的Contributors获取 |

# 介绍

在本路径之下,实现了dioxide的异构链接入插件,包括链下插件及链上插件部分

- **offchain-plugin**:链下插件,使用maven管理的Java工程,使用jdk1.21和maven编译即可。基于[dioxide_python](https://github.com/1220292040/dioxide_python)开发,将必要的python_sdk逻辑转换为java_sdk逻辑,在团队提供的2025.11.18版本的链节点上测试通过。
- **onchain-plugin**:链上插件,使GCL语言开发,实现逻辑参考了ethereum2的链上插件。

# 用法

## 构建

在offchain-plugin下通过`mvn clean package -DskipTests`编译插件Jar包,可以在target下找到`dioxide-acb-plugin-1.0.0-plugin.jar`

## 使用

参考[插件服务](https://github.com/AntChainOpenLab/AntChainBridgePluginServer/blob/main/README.md)(PluginServer, PS)的使用,将Jar包放到指定路径,通过PS加载即可。

### 配置文件

当在AntChainBridge的Relayer服务注册dioxide时,需要指定PS和链类型(dioxide),同时需要提交一个dioxide链的配置。

dioxide链的配置文件`dioxide.json`主要包括节点网络连接信息和用户信息,配置文件大致如下:

```json
{
"rpcUrl": "http://127.0.0.1:62222/api",
"wsRpc": "ws://127.0.0.1:62222/api",
"privateKey": "WTKi+W99TEEt153Zt8isUznwXqYkA0aVWEbd7edk6AvivGov5hBLJLQbS2hk8bnC3FM8Et6+Axaw1uukce+ZEQ==",
"dappName": "ict001",
"isPreContractDeployed": false
}
```

- rpcUrl:dioxide链的HTTP协议的JSON-RPC接口地址
- wsPrc:dioxide链的WebSocket协议的JSON-RPC接口地址
- privateKey:base64格式的用户私钥,样例详见[dioxide_python](https://github.com/1220292040/dioxide_python)给出的account_test.py
- dappName:dapp是dioxide链上承载智能合约的载体,智能合约只能部署在某一个dapp地址下,一个dapp中可以部署多个智能合约,dapp地址的组成形式为<dapp_name>:<dapp>其中,dapp名字长度限制在4-8内,上述例子中"ict001"就是为长度为6的dapp_name
- isPreContractDeployed:部署跨链系统合约(AM合约和SDP合约)时,由于两个合约需要依赖一些自编写的库合约作为前置合约先部署上去,所以该字段一般填false


# 注意事项
- 目前仅支持SDPv1消息版本和跨链消息传输的基本功能,基于PTC的跨链消息验证功能有待开发。
141 changes: 141 additions & 0 deletions acb-sdk/pluginset/dioxide/offchain-plugin/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.alipay.antchain.bridge</groupId>
<artifactId>dioxide-acb-plugin</artifactId>
<version>1.0.0</version>

<properties>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
<dependency>
<groupId>com.alipay.antchain.bridge</groupId>
<artifactId>antchain-bridge-plugin-lib</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.alipay.antchain.bridge</groupId>
<artifactId>antchain-bridge-spi</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.30</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.83</version>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.8.20</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk18on</artifactId>
<version>1.78.1</version>
</dependency>
<dependency>
<groupId>black.ninia</groupId>
<artifactId>jep</artifactId>
<version>4.2.2</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.13</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-storage</artifactId>
<version>2.38.0</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.83_noneautotype</version>
<scope>compile</scope>
</dependency>
</dependencies>

<build>
<plugins>

<!-- 构建期生成 GCL Java 源码 -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>generate-gcl-java</id>
<!-- 注意:阶段改为 process-classes -->
<phase>process-classes</phase>
<goals>
<goal>java</goal>
</goals>
<configuration>
<mainClass>
com.alipay.antchain.bridge.plugins.dioxide.gcl.GclCodegen
</mainClass>

<!-- 关键 -->
<includeProjectDependencies>true</includeProjectDependencies>
<includePluginDependencies>true</includePluginDependencies>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<finalName>${project.artifactId}-${project.version}-plugin</finalName>
<appendAssemblyId>false</appendAssemblyId>
<attach>false</attach>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
</manifest>
<manifestEntries>
<Plugin-Class>com.alipay.antchain.bridge.plugins.lib.pf4j.DefaultPlugin</Plugin-Class>
</manifestEntries>
</archive>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
Loading