# Router **Repository Path**: ancelmo/router ## Basic Information - **Project Name**: Router - **Description**: 陆羽协议跨链路由 - **Primary Language**: Java - **License**: Apache-2.0 - **Default Branch**: develop - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 5 - **Created**: 2021-04-21 - **Last Updated**: 2022-05-24 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 陆羽协议 Router 此版本为插件调试版本,仅包含插件的加载和交易请求的透传的逻辑,可用此版本与插件进行快速的联调。(不支持路由间通信和与Account Manager通信) ## 配置 ### 配置路由 位于`src/test/resources/application.toml` 其中RPC端口为8250,为接下来测试时所用的端口。其它参数默认即可。 ### 配置插件 将编译生成的插件放置于 plugins 目录下 ``` bash mkdir plugins cp xxxxxx.jar plugins ``` ### 配置接入链 配置目录`src/test/resources/chains/` 下,文件夹名即为链名(如链名为hello的配置文件目录为:`src/test/resources/chains/hello`) 内部有三个配置文件: * plugin.toml:必配,总配置,配置链名和插件类型 * driver.toml:选配,driver的properties配置,不配则为空 * connection.tom:选配,driver的properties配置,不配则表示是远端资源,用remoteConnection进行初始化 **plugin.toml** ``` toml [common] name = 'hello' # 链名 type = 'Hello1.0' # 链类型,用哪个插件进行加载 ``` **driver.toml** ``` toml [aaaaa] # 任意定制,router读取后直接透,用作初始化Driver所需的proterties bbbb = "ccccc" ``` **connection.toml** ``` toml [bbbb] # 任意定制,router读取后直接透,用作初始化Connection所需的proterties eeee = "kkkkk" ``` ## 调试方法 **启动** 在IDE中启动 `src/test/java/org/luyu/router/ServiceRunner.java`的main() **查询资源** `POST` `http://localhost:8250/sys/listResources` ``` json { "version":"1", "data":{ "ignoreRemote": true } } ``` **发送交易** `POST` `localhost:8250/resource////sendTransaction` ``` json { "version":"1", "data":{ "path": "payment.hello.contract-1618385695131", "method": "set", "args": ["aaaa"], "nonce":123456, "key":"aabb", "luyuSign":"" } } ``` **查询状态** `POST` `localhost:8250/resource////call` ``` json { "version":"1", "data":{ "path": "payment.hello.contract-1618385695131", "method": "get", "args": ["bbb"], } } ```