docs(*): add vuepress

This commit is contained in:
Aiden Xu 2020-07-03 15:15:57 +08:00
parent 8d24681e0e
commit 03aceae02d
33 changed files with 615 additions and 1 deletions

1
.gitignore vendored
View File

@ -17,7 +17,6 @@ cover.out
coverage.out
pid
scripts/prepare
docs/.vuepress/dist
logs
mock_*/
.fabric-samples

41
docs/.vuepress/config.js Normal file
View File

@ -0,0 +1,41 @@
module.exports = {
title: 'BitXHub文档',
description: 'BitXHub部署文档、使用文档、设计文档站',
themeConfig: {
sidebar: [
// {
// title: '版本信息',
// path: '/version/'
// },
{
title: '快速开始',
path: '/quick/'
},
// {
// title: '使用文档',
// path: '/usage/',
// children: [
// {
// title: '部署文档',
// path: '/usage/deploy',
// }
// ],
// },
{
title: 'FAQ',
path: '/faq/',
},
// {
// title: '开发文档',
// path: '/develop/',
// children: [
// {
// title: '共识模块开发',
// path: '/develop/order'
// }
// ]
// }
]
}
}

19
docs/.vuepress/dist/404.html vendored Normal file
View File

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>BitXHub文档</title>
<meta name="generator" content="VuePress 1.5.0">
<meta name="description" content="BitXHub部署文档、使用文档、设计文档站">
<link rel="preload" href="/assets/css/0.styles.95cd0039.css" as="style"><link rel="preload" href="/assets/js/app.d8b088b0.js" as="script"><link rel="preload" href="/assets/js/4.a9bf116c.js" as="script"><link rel="prefetch" href="/assets/js/10.bdb3f639.js"><link rel="prefetch" href="/assets/js/11.9e06e87f.js"><link rel="prefetch" href="/assets/js/12.42de9ed2.js"><link rel="prefetch" href="/assets/js/2.875e38d4.js"><link rel="prefetch" href="/assets/js/3.66a94b31.js"><link rel="prefetch" href="/assets/js/5.6451f157.js"><link rel="prefetch" href="/assets/js/6.86e06288.js"><link rel="prefetch" href="/assets/js/7.541bbe20.js"><link rel="prefetch" href="/assets/js/8.db2fda12.js"><link rel="prefetch" href="/assets/js/9.52ee0038.js">
<link rel="stylesheet" href="/assets/css/0.styles.95cd0039.css">
</head>
<body>
<div id="app" data-server-rendered="true"><div class="theme-container"><div class="theme-default-content"><h1>404</h1> <blockquote>There's nothing here.</blockquote> <a href="/" class="router-link-active">
Take me home.
</a></div></div><div class="global-ui"></div></div>
<script src="/assets/js/app.d8b088b0.js" defer></script><script src="/assets/js/4.a9bf116c.js" defer></script>
</body>
</html>

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8"?><svg xmlns="http://www.w3.org/2000/svg" width="12" height="13"><g stroke-width="2" stroke="#aaa" fill="none"><path d="M11.29 11.71l-4-4"/><circle cx="5" cy="5" r="4"/></g></svg>

After

Width:  |  Height:  |  Size: 216 B

View File

@ -0,0 +1 @@
(window.webpackJsonp=window.webpackJsonp||[]).push([[10],{356:function(t,e,n){"use strict";n.r(e);var s=n(43),l=Object(s.a)({},(function(){var t=this.$createElement;return(this._self._c||t)("ContentSlotsDistributor",{attrs:{"slot-key":this.$parent.slotKey}})}),[],!1,null,null,null);e.default=l.exports}}]);

View File

@ -0,0 +1 @@
(window.webpackJsonp=window.webpackJsonp||[]).push([[11],{358:function(t,e,n){"use strict";n.r(e);var s=n(43),l=Object(s.a)({},(function(){var t=this.$createElement;return(this._self._c||t)("ContentSlotsDistributor",{attrs:{"slot-key":this.$parent.slotKey}})}),[],!1,null,null,null);e.default=l.exports}}]);

View File

@ -0,0 +1 @@
(window.webpackJsonp=window.webpackJsonp||[]).push([[12],{357:function(t,e,n){"use strict";n.r(e);var s=n(43),l=Object(s.a)({},(function(){var t=this.$createElement;return(this._self._c||t)("ContentSlotsDistributor",{attrs:{"slot-key":this.$parent.slotKey}})}),[],!1,null,null,null);e.default=l.exports}}]);

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
(window.webpackJsonp=window.webpackJsonp||[]).push([[3],{317:function(t,e,n){},348:function(t,e,n){"use strict";var a=n(317);n.n(a).a},359:function(t,e,n){"use strict";n.r(e);var a={functional:!0,props:{type:{type:String,default:"tip"},text:String,vertical:{type:String,default:"top"}},render:function(t,e){var n=e.props,a=e.slots;return t("span",{class:["badge",n.type],style:{verticalAlign:n.vertical}},n.text||a().default)}},i=(n(348),n(43)),r=Object(i.a)(a,void 0,void 0,!1,null,"76a02c50",null);e.default=r.exports}}]);

View File

@ -0,0 +1 @@
(window.webpackJsonp=window.webpackJsonp||[]).push([[4],{350:function(t,e,s){"use strict";s.r(e);var n=["There's nothing here.","How did we get here?","That's a Four-Oh-Four.","Looks like we've got some broken links."],o={methods:{getMsg:function(){return n[Math.floor(Math.random()*n.length)]}}},i=s(43),h=Object(i.a)(o,(function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"theme-container"},[e("div",{staticClass:"theme-default-content"},[e("h1",[this._v("404")]),this._v(" "),e("blockquote",[this._v(this._s(this.getMsg()))]),this._v(" "),e("RouterLink",{attrs:{to:"/"}},[this._v("\n Take me home.\n ")])],1)])}),[],!1,null,null,null);e.default=h.exports}}]);

View File

@ -0,0 +1 @@
(window.webpackJsonp=window.webpackJsonp||[]).push([[5],{351:function(t,s,e){"use strict";e.r(s);var i=e(43),n=Object(i.a)({},(function(){var t=this.$createElement,s=this._self._c||t;return s("ContentSlotsDistributor",{attrs:{"slot-key":this.$parent.slotKey}},[s("h1",{attrs:{id:"bitxhub文档"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#bitxhub文档"}},[this._v("#")]),this._v(" BitXHub文档")])])}),[],!1,null,null,null);s.default=n.exports}}]);

View File

@ -0,0 +1 @@
(window.webpackJsonp=window.webpackJsonp||[]).push([[6],{352:function(t,e,n){"use strict";n.r(e);var s=n(43),l=Object(s.a)({},(function(){var t=this.$createElement;return(this._self._c||t)("ContentSlotsDistributor",{attrs:{"slot-key":this.$parent.slotKey}})}),[],!1,null,null,null);e.default=l.exports}}]);

View File

@ -0,0 +1 @@
(window.webpackJsonp=window.webpackJsonp||[]).push([[7],{353:function(t,e,n){"use strict";n.r(e);var s=n(43),l=Object(s.a)({},(function(){var t=this.$createElement;return(this._self._c||t)("ContentSlotsDistributor",{attrs:{"slot-key":this.$parent.slotKey}})}),[],!1,null,null,null);e.default=l.exports}}]);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

17
docs/.vuepress/dist/develop/index.html vendored Normal file
View File

@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>BitXHub文档</title>
<meta name="generator" content="VuePress 1.5.0">
<meta name="description" content="BitXHub部署文档、使用文档、设计文档站">
<link rel="preload" href="/assets/css/0.styles.95cd0039.css" as="style"><link rel="preload" href="/assets/js/app.d8b088b0.js" as="script"><link rel="preload" href="/assets/js/2.875e38d4.js" as="script"><link rel="preload" href="/assets/js/6.86e06288.js" as="script"><link rel="prefetch" href="/assets/js/10.bdb3f639.js"><link rel="prefetch" href="/assets/js/11.9e06e87f.js"><link rel="prefetch" href="/assets/js/12.42de9ed2.js"><link rel="prefetch" href="/assets/js/3.66a94b31.js"><link rel="prefetch" href="/assets/js/4.a9bf116c.js"><link rel="prefetch" href="/assets/js/5.6451f157.js"><link rel="prefetch" href="/assets/js/7.541bbe20.js"><link rel="prefetch" href="/assets/js/8.db2fda12.js"><link rel="prefetch" href="/assets/js/9.52ee0038.js">
<link rel="stylesheet" href="/assets/css/0.styles.95cd0039.css">
</head>
<body>
<div id="app" data-server-rendered="true"><div class="theme-container"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/" class="home-link router-link-active"><!----> <span class="site-name">BitXHub文档</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <!----></div></header> <div class="sidebar-mask"></div> <aside class="sidebar"><!----> <ul class="sidebar-links"><li><a href="/quick/" class="sidebar-link">快速开始</a></li><li><a href="/faq/" class="sidebar-link">FAQ</a></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"></div> <footer class="page-edit"><!----> <!----></footer> <!----> </main></div><div class="global-ui"></div></div>
<script src="/assets/js/app.d8b088b0.js" defer></script><script src="/assets/js/2.875e38d4.js" defer></script><script src="/assets/js/6.86e06288.js" defer></script>
</body>
</html>

17
docs/.vuepress/dist/develop/order.html vendored Normal file
View File

@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>BitXHub文档</title>
<meta name="generator" content="VuePress 1.5.0">
<meta name="description" content="BitXHub部署文档、使用文档、设计文档站">
<link rel="preload" href="/assets/css/0.styles.95cd0039.css" as="style"><link rel="preload" href="/assets/js/app.d8b088b0.js" as="script"><link rel="preload" href="/assets/js/2.875e38d4.js" as="script"><link rel="preload" href="/assets/js/7.541bbe20.js" as="script"><link rel="prefetch" href="/assets/js/10.bdb3f639.js"><link rel="prefetch" href="/assets/js/11.9e06e87f.js"><link rel="prefetch" href="/assets/js/12.42de9ed2.js"><link rel="prefetch" href="/assets/js/3.66a94b31.js"><link rel="prefetch" href="/assets/js/4.a9bf116c.js"><link rel="prefetch" href="/assets/js/5.6451f157.js"><link rel="prefetch" href="/assets/js/6.86e06288.js"><link rel="prefetch" href="/assets/js/8.db2fda12.js"><link rel="prefetch" href="/assets/js/9.52ee0038.js">
<link rel="stylesheet" href="/assets/css/0.styles.95cd0039.css">
</head>
<body>
<div id="app" data-server-rendered="true"><div class="theme-container"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/" class="home-link router-link-active"><!----> <span class="site-name">BitXHub文档</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <!----></div></header> <div class="sidebar-mask"></div> <aside class="sidebar"><!----> <ul class="sidebar-links"><li><a href="/quick/" class="sidebar-link">快速开始</a></li><li><a href="/faq/" class="sidebar-link">FAQ</a></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"></div> <footer class="page-edit"><!----> <!----></footer> <!----> </main></div><div class="global-ui"></div></div>
<script src="/assets/js/app.d8b088b0.js" defer></script><script src="/assets/js/2.875e38d4.js" defer></script><script src="/assets/js/7.541bbe20.js" defer></script>
</body>
</html>

22
docs/.vuepress/dist/faq/index.html vendored Normal file

File diff suppressed because one or more lines are too long

17
docs/.vuepress/dist/index.html vendored Normal file
View File

@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>BitXHub文档 | BitXHub文档</title>
<meta name="generator" content="VuePress 1.5.0">
<meta name="description" content="BitXHub部署文档、使用文档、设计文档站">
<link rel="preload" href="/assets/css/0.styles.95cd0039.css" as="style"><link rel="preload" href="/assets/js/app.d8b088b0.js" as="script"><link rel="preload" href="/assets/js/2.875e38d4.js" as="script"><link rel="preload" href="/assets/js/5.6451f157.js" as="script"><link rel="prefetch" href="/assets/js/10.bdb3f639.js"><link rel="prefetch" href="/assets/js/11.9e06e87f.js"><link rel="prefetch" href="/assets/js/12.42de9ed2.js"><link rel="prefetch" href="/assets/js/3.66a94b31.js"><link rel="prefetch" href="/assets/js/4.a9bf116c.js"><link rel="prefetch" href="/assets/js/6.86e06288.js"><link rel="prefetch" href="/assets/js/7.541bbe20.js"><link rel="prefetch" href="/assets/js/8.db2fda12.js"><link rel="prefetch" href="/assets/js/9.52ee0038.js">
<link rel="stylesheet" href="/assets/css/0.styles.95cd0039.css">
</head>
<body>
<div id="app" data-server-rendered="true"><div class="theme-container"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/" aria-current="page" class="home-link router-link-exact-active router-link-active"><!----> <span class="site-name">BitXHub文档</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <!----></div></header> <div class="sidebar-mask"></div> <aside class="sidebar"><!----> <ul class="sidebar-links"><li><a href="/quick/" class="sidebar-link">快速开始</a></li><li><a href="/faq/" class="sidebar-link">FAQ</a></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"><h1 id="bitxhub文档"><a href="#bitxhub文档" class="header-anchor">#</a> BitXHub文档</h1></div> <footer class="page-edit"><!----> <!----></footer> <!----> </main></div><div class="global-ui"></div></div>
<script src="/assets/js/app.d8b088b0.js" defer></script><script src="/assets/js/2.875e38d4.js" defer></script><script src="/assets/js/5.6451f157.js" defer></script>
</body>
</html>

111
docs/.vuepress/dist/quick/index.html vendored Normal file
View File

@ -0,0 +1,111 @@
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>BitXHub文档</title>
<meta name="generator" content="VuePress 1.5.0">
<meta name="description" content="BitXHub部署文档、使用文档、设计文档站">
<link rel="preload" href="/assets/css/0.styles.95cd0039.css" as="style"><link rel="preload" href="/assets/js/app.d8b088b0.js" as="script"><link rel="preload" href="/assets/js/2.875e38d4.js" as="script"><link rel="preload" href="/assets/js/9.52ee0038.js" as="script"><link rel="prefetch" href="/assets/js/10.bdb3f639.js"><link rel="prefetch" href="/assets/js/11.9e06e87f.js"><link rel="prefetch" href="/assets/js/12.42de9ed2.js"><link rel="prefetch" href="/assets/js/3.66a94b31.js"><link rel="prefetch" href="/assets/js/4.a9bf116c.js"><link rel="prefetch" href="/assets/js/5.6451f157.js"><link rel="prefetch" href="/assets/js/6.86e06288.js"><link rel="prefetch" href="/assets/js/7.541bbe20.js"><link rel="prefetch" href="/assets/js/8.db2fda12.js">
<link rel="stylesheet" href="/assets/css/0.styles.95cd0039.css">
</head>
<body>
<div id="app" data-server-rendered="true"><div class="theme-container"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/" class="home-link router-link-active"><!----> <span class="site-name">BitXHub文档</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <!----></div></header> <div class="sidebar-mask"></div> <aside class="sidebar"><!----> <ul class="sidebar-links"><li><a href="/quick/" aria-current="page" class="active sidebar-link">快速开始</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/quick/#部署fabric网络" class="sidebar-link">部署Fabric网络</a></li><li class="sidebar-sub-header"><a href="/quick/#部署跨链合约" class="sidebar-link">部署跨链合约</a></li><li class="sidebar-sub-header"><a href="/quick/#启动跨链网关" class="sidebar-link">启动跨链网关</a></li><li class="sidebar-sub-header"><a href="/quick/#跨链转账" class="sidebar-link">跨链转账</a></li></ul></li><li><a href="/faq/" class="sidebar-link">FAQ</a></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"><p>我们提供了脚本来快速启动两条Fabric应用链A和B跨链网关和中继链。</p> <h2 id="部署fabric网络"><a href="#部署fabric网络" class="header-anchor">#</a> 部署Fabric网络</h2> <p>在运行跨链网络之前必要的软件如Golang和Docker可以根据官网自行安装。确保 $GAPTH $GOBIN等环境变量已经正确设置。</p> <p>以上的软件依赖安装之后我们提供了脚本来安装启动两个简单的Fabric网络。</p> <p>下载部署fabric网络脚本ffn.sh</p> <div class="language-shell extra-class"><pre class="language-shell"><code><span class="token function">wget</span> https://github.com/meshplus/goduck/raw/master/scripts/quick_start/ffn.sh
</code></pre></div><p>启动fabric网络</p> <p><strong>注意:</strong> 脚本运行过程中按照提示进行确认即可。</p> <div class="language-shell extra-class"><pre class="language-shell"><code><span class="token function">bash</span> ffn.sh down // 如果本地已经有Fabric网络运行需要先关闭如果没有可以不运行该命令
<span class="token function">bash</span> ffn.sh up //启动两条fabric应用链A和B
</code></pre></div><p><strong>注意:</strong> 命令执行完,会在当前目录生成<code>crypto-config</code><code>crypto-configB</code>文件夹,后面的<code>chaincode.sh</code><code>fabric_pier.sh</code>需要在执行目录下存在上述文件。</p> <h2 id="部署跨链合约"><a href="#部署跨链合约" class="header-anchor">#</a> 部署跨链合约</h2> <p>下载操作<code>chaincode</code>的脚本chaincode.sh</p> <div class="language-shell extra-class"><pre class="language-shell"><code><span class="token function">wget</span> https://raw.githubusercontent.com/meshplus/goduck/master/scripts/quick_start/chaincode.sh
</code></pre></div><p>拷贝<code>crypto-config</code><code>crypto-configB</code>到当前目录,执行以下命令:</p> <div class="language-shell extra-class"><pre class="language-shell"><code>// -c指定fabric cli的配置文件默认为config.yaml
// 应用链A部署chaincode
<span class="token function">bash</span> chaincode.sh <span class="token function">install</span>
//应用链B部署chaincode
<span class="token function">bash</span> chaincode.sh <span class="token function">install</span> -c <span class="token string">'configB.yaml'</span>
</code></pre></div><p>该命令会在指定fabric网络中部署<code>broker</code>, <code>transfer</code><code>data_swapper</code>三个<code>chaincode</code></p> <p>部署完成后,通过以下命令检查是否部署成功:</p> <div class="language-shell extra-class"><pre class="language-shell"><code>// 上一步的脚本默认初始化了一个有10000余额的账号Alicetransfer chaincode
// -c指定fabric cli的config.yaml配置文件
// 查看应用链A中Alice的余额
<span class="token function">bash</span> chaincode.sh get_balance -c <span class="token string">'config.yaml'</span>
****************************************************************************************************
***** <span class="token operator">|</span> Response<span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span>: //peer0.org2.example.com
***** <span class="token operator">|</span> <span class="token operator">|</span> Payload: <span class="token number">10000</span>
***** <span class="token operator">|</span> Response<span class="token punctuation">[</span><span class="token number">1</span><span class="token punctuation">]</span>: //peer1.org2.example.com
***** <span class="token operator">|</span> <span class="token operator">|</span> Payload: <span class="token number">10000</span>
****************************************************************************************************
//查看应用链B中Alice的余额
<span class="token function">bash</span> chaincode.sh get_balance -c <span class="token string">'configB.yaml'</span>
****************************************************************************************************
***** <span class="token operator">|</span> Response<span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span>: //peer0.org2.example1.com
***** <span class="token operator">|</span> <span class="token operator">|</span> Payload: <span class="token number">10000</span>
***** <span class="token operator">|</span> Response<span class="token punctuation">[</span><span class="token number">1</span><span class="token punctuation">]</span>: //peer1.org2.example1.com
***** <span class="token operator">|</span> <span class="token operator">|</span> Payload: <span class="token number">10000</span>
****************************************************************************************************
</code></pre></div><h1 id="启动bitxhub"><a href="#启动bitxhub" class="header-anchor">#</a> 启动BitXHub</h1> <p>BitXHub依赖于<a href="https://golang.org/" target="_blank" rel="noopener noreferrer">golang<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a><a href="https://github.com/tmux/tmux/wiki" target="_blank" rel="noopener noreferrer">tmux<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a>,需要提前进行安装。</p> <p>使用下面的命令克隆项目:</p> <div class="language-shell extra-class"><pre class="language-shell"><code><span class="token function">git</span> clone git@github.com:meshplus/bitxhub.git
</code></pre></div><p>BitXHub还依赖于一些小工具使用下面的命令进行安装</p> <div class="language-shell extra-class"><pre class="language-shell"><code><span class="token builtin class-name">cd</span> bitxhub
<span class="token function">git</span> checkout c3d850d3d4cb8742310bb8e2614e18cb075a3dc1
<span class="token function">bash</span> scripts/prepare.sh
</code></pre></div><p>最后运行下面的命令即可运行一个四节点的BitXHub中继链</p> <div class="language-shell extra-class"><pre class="language-shell"><code><span class="token function">make</span> cluster
</code></pre></div><p><strong>注意:</strong> <code>make cluster</code>启动会使用<code>tmux</code>进行分屏,所以在命令执行过程中,最好不要进行终端切换。</p> <h2 id="启动跨链网关"><a href="#启动跨链网关" class="header-anchor">#</a> 启动跨链网关</h2> <p>下载相关的脚本fabric_pier.sh</p> <div class="language-shell extra-class"><pre class="language-shell"><code><span class="token function">wget</span> https://github.com/meshplus/goduck/raw/master/scripts/quick_start/fabric_pier.sh
</code></pre></div><p>执行以下命令即可启动跨链网关:</p> <div class="language-shell extra-class"><pre class="language-shell"><code>//启动跨链网关连接应用链A和BitXHub
// -r: 跨链网关启动目录,默认为.pier目录
// -c: fabric组织证书目录默认为crypto-config
// -g: 指定fabric cli连接的配置文件默认为config.yaml
// -p: 跨链网关的启动端口默认为8987
// -b: 中继链GRPC地址默认为localhost:60011
// -o: pprof端口默认为44555
<span class="token function">bash</span> fabric_pier.sh start -r <span class="token string">'.pier'</span> -c <span class="token string">'crypto-config'</span> -g <span class="token string">'config.yaml'</span> -p <span class="token number">8987</span> -b <span class="token string">'localhost:60011'</span> -o <span class="token number">44555</span>
//启动跨链网关连接应用链B和BitXHub
<span class="token function">bash</span> fabric_pier.sh start -r <span class="token string">'.pierB'</span> -c <span class="token string">'crypto-configB'</span> -g <span class="token string">'configB.yaml'</span> -p <span class="token number">8988</span> -b <span class="token string">'localhost:60011'</span> -o <span class="token number">44556</span>
</code></pre></div><p>在该目录下通过以下命令可以得到该跨链网关对应应用链的ID</p> <div class="language-shell extra-class"><pre class="language-shell"><code>//应用链A的ID
<span class="token function">bash</span> fabric_pier.sh <span class="token function">id</span> -r <span class="token string">'.pier'</span>
//应用链B的ID
<span class="token function">bash</span> fabric_pier.sh <span class="token function">id</span> -r <span class="token string">'.pierB'</span>
</code></pre></div><p><strong>注意:</strong> 后面跨链交易命令需要该值</p> <h2 id="跨链转账"><a href="#跨链转账" class="header-anchor">#</a> 跨链转账</h2> <p>使用<strong>部署跨链合约</strong>章节中下载的<code>chaincode.sh</code>进行相关<code>chaincode</code>调用。</p> <ol><li>查询Alice余额</li></ol> <div class="language-shell extra-class"><pre class="language-shell"><code>// 查询应用链A中Alice的余额
// -c指定fabric cli的config.yaml配置文件
<span class="token function">bash</span> chaincode.sh get_balance -c <span class="token string">'config.yaml'</span>
****************************************************************************************************
***** <span class="token operator">|</span> Response<span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span>: //peer0.org2.example.com
***** <span class="token operator">|</span> <span class="token operator">|</span> Payload: <span class="token number">10000</span>
***** <span class="token operator">|</span> Response<span class="token punctuation">[</span><span class="token number">1</span><span class="token punctuation">]</span>: //peer1.org2.example.com
***** <span class="token operator">|</span> <span class="token operator">|</span> Payload: <span class="token number">10000</span>
****************************************************************************************************
// 查询应用链B中Alice的余额
<span class="token function">bash</span> chaincode.sh get_balance -c <span class="token string">'configB.yaml'</span>
****************************************************************************************************
***** <span class="token operator">|</span> Response<span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span>: //peer0.org2.example1.com
***** <span class="token operator">|</span> <span class="token operator">|</span> Payload: <span class="token number">10000</span>
***** <span class="token operator">|</span> Response<span class="token punctuation">[</span><span class="token number">1</span><span class="token punctuation">]</span>: //peer1.org2.example1.com
***** <span class="token operator">|</span> <span class="token operator">|</span> Payload: <span class="token number">10000</span>
****************************************************************************************************
</code></pre></div><ol start="2"><li>发送一笔跨链转账</li></ol> <p>下面的命令会将应用链A中Alice的一块钱转移到应用链B中Alice</p> <div class="language-shell extra-class"><pre class="language-shell"><code>// -c指定fabric cli的config.yaml配置文件
// -t: 目的链的ID应用链B的ID
<span class="token function">bash</span> chaincode.sh interchain_transfer -c <span class="token string">'config.yaml'</span> -t <span class="token operator">&lt;</span>target_appchain_id<span class="token operator">&gt;</span>
</code></pre></div><ol start="3"><li>查询余额</li></ol> <p>分别在两条链上查询Alice余额</p> <div class="language-shell extra-class"><pre class="language-shell"><code>// 查询应用链A中Alice的余额发现余额少了一块钱
// -c指定fabric cli的config.yaml配置文件
<span class="token function">bash</span> chaincode.sh get_balance -c <span class="token string">'config.yaml'</span>
****************************************************************************************************
***** <span class="token operator">|</span> Response<span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span>: //peer0.org2.example.com
***** <span class="token operator">|</span> <span class="token operator">|</span> Payload: <span class="token number">9999</span>
***** <span class="token operator">|</span> Response<span class="token punctuation">[</span><span class="token number">1</span><span class="token punctuation">]</span>: //peer1.org2.example.com
***** <span class="token operator">|</span> <span class="token operator">|</span> Payload: <span class="token number">9999</span>
****************************************************************************************************
// 查询应用链B中Alice的余额发现余额多了一块钱
<span class="token function">bash</span> chaincode.sh get_balance -c <span class="token string">'configB.yaml'</span>
****************************************************************************************************
***** <span class="token operator">|</span> Response<span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span>: //peer0.org2.example1.com
***** <span class="token operator">|</span> <span class="token operator">|</span> Payload: <span class="token number">10001</span>
***** <span class="token operator">|</span> Response<span class="token punctuation">[</span><span class="token number">1</span><span class="token punctuation">]</span>: //peer1.org2.example1.com
***** <span class="token operator">|</span> <span class="token operator">|</span> Payload: <span class="token number">10001</span>
****************************************************************************************************
</code></pre></div><p><strong>注意:</strong> <code>chaincode.sh</code>调用不同的fabric需要不同的<code>config.yaml</code>,注意区分。</p></div> <footer class="page-edit"><!----> <!----></footer> <div class="page-nav"><p class="inner"><!----> <span class="next"><a href="/faq/">
FAQ
</a>
</span></p></div> </main></div><div class="global-ui"></div></div>
<script src="/assets/js/app.d8b088b0.js" defer></script><script src="/assets/js/2.875e38d4.js" defer></script><script src="/assets/js/9.52ee0038.js" defer></script>
</body>
</html>

17
docs/.vuepress/dist/usage/deploy.html vendored Normal file
View File

@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>BitXHub文档</title>
<meta name="generator" content="VuePress 1.5.0">
<meta name="description" content="BitXHub部署文档、使用文档、设计文档站">
<link rel="preload" href="/assets/css/0.styles.95cd0039.css" as="style"><link rel="preload" href="/assets/js/app.d8b088b0.js" as="script"><link rel="preload" href="/assets/js/2.875e38d4.js" as="script"><link rel="preload" href="/assets/js/11.9e06e87f.js" as="script"><link rel="prefetch" href="/assets/js/10.bdb3f639.js"><link rel="prefetch" href="/assets/js/12.42de9ed2.js"><link rel="prefetch" href="/assets/js/3.66a94b31.js"><link rel="prefetch" href="/assets/js/4.a9bf116c.js"><link rel="prefetch" href="/assets/js/5.6451f157.js"><link rel="prefetch" href="/assets/js/6.86e06288.js"><link rel="prefetch" href="/assets/js/7.541bbe20.js"><link rel="prefetch" href="/assets/js/8.db2fda12.js"><link rel="prefetch" href="/assets/js/9.52ee0038.js">
<link rel="stylesheet" href="/assets/css/0.styles.95cd0039.css">
</head>
<body>
<div id="app" data-server-rendered="true"><div class="theme-container"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/" class="home-link router-link-active"><!----> <span class="site-name">BitXHub文档</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <!----></div></header> <div class="sidebar-mask"></div> <aside class="sidebar"><!----> <ul class="sidebar-links"><li><a href="/quick/" class="sidebar-link">快速开始</a></li><li><a href="/faq/" class="sidebar-link">FAQ</a></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"></div> <footer class="page-edit"><!----> <!----></footer> <!----> </main></div><div class="global-ui"></div></div>
<script src="/assets/js/app.d8b088b0.js" defer></script><script src="/assets/js/2.875e38d4.js" defer></script><script src="/assets/js/11.9e06e87f.js" defer></script>
</body>
</html>

17
docs/.vuepress/dist/usage/index.html vendored Normal file
View File

@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>BitXHub文档</title>
<meta name="generator" content="VuePress 1.5.0">
<meta name="description" content="BitXHub部署文档、使用文档、设计文档站">
<link rel="preload" href="/assets/css/0.styles.95cd0039.css" as="style"><link rel="preload" href="/assets/js/app.d8b088b0.js" as="script"><link rel="preload" href="/assets/js/2.875e38d4.js" as="script"><link rel="preload" href="/assets/js/10.bdb3f639.js" as="script"><link rel="prefetch" href="/assets/js/11.9e06e87f.js"><link rel="prefetch" href="/assets/js/12.42de9ed2.js"><link rel="prefetch" href="/assets/js/3.66a94b31.js"><link rel="prefetch" href="/assets/js/4.a9bf116c.js"><link rel="prefetch" href="/assets/js/5.6451f157.js"><link rel="prefetch" href="/assets/js/6.86e06288.js"><link rel="prefetch" href="/assets/js/7.541bbe20.js"><link rel="prefetch" href="/assets/js/8.db2fda12.js"><link rel="prefetch" href="/assets/js/9.52ee0038.js">
<link rel="stylesheet" href="/assets/css/0.styles.95cd0039.css">
</head>
<body>
<div id="app" data-server-rendered="true"><div class="theme-container"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/" class="home-link router-link-active"><!----> <span class="site-name">BitXHub文档</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <!----></div></header> <div class="sidebar-mask"></div> <aside class="sidebar"><!----> <ul class="sidebar-links"><li><a href="/quick/" class="sidebar-link">快速开始</a></li><li><a href="/faq/" class="sidebar-link">FAQ</a></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"></div> <footer class="page-edit"><!----> <!----></footer> <!----> </main></div><div class="global-ui"></div></div>
<script src="/assets/js/app.d8b088b0.js" defer></script><script src="/assets/js/2.875e38d4.js" defer></script><script src="/assets/js/10.bdb3f639.js" defer></script>
</body>
</html>

17
docs/.vuepress/dist/version/index.html vendored Normal file
View File

@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>BitXHub文档</title>
<meta name="generator" content="VuePress 1.5.0">
<meta name="description" content="BitXHub部署文档、使用文档、设计文档站">
<link rel="preload" href="/assets/css/0.styles.95cd0039.css" as="style"><link rel="preload" href="/assets/js/app.d8b088b0.js" as="script"><link rel="preload" href="/assets/js/2.875e38d4.js" as="script"><link rel="preload" href="/assets/js/12.42de9ed2.js" as="script"><link rel="prefetch" href="/assets/js/10.bdb3f639.js"><link rel="prefetch" href="/assets/js/11.9e06e87f.js"><link rel="prefetch" href="/assets/js/3.66a94b31.js"><link rel="prefetch" href="/assets/js/4.a9bf116c.js"><link rel="prefetch" href="/assets/js/5.6451f157.js"><link rel="prefetch" href="/assets/js/6.86e06288.js"><link rel="prefetch" href="/assets/js/7.541bbe20.js"><link rel="prefetch" href="/assets/js/8.db2fda12.js"><link rel="prefetch" href="/assets/js/9.52ee0038.js">
<link rel="stylesheet" href="/assets/css/0.styles.95cd0039.css">
</head>
<body>
<div id="app" data-server-rendered="true"><div class="theme-container"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/" class="home-link router-link-active"><!----> <span class="site-name">BitXHub文档</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <!----></div></header> <div class="sidebar-mask"></div> <aside class="sidebar"><!----> <ul class="sidebar-links"><li><a href="/quick/" class="sidebar-link">快速开始</a></li><li><a href="/faq/" class="sidebar-link">FAQ</a></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"></div> <footer class="page-edit"><!----> <!----></footer> <!----> </main></div><div class="global-ui"></div></div>
<script src="/assets/js/app.d8b088b0.js" defer></script><script src="/assets/js/2.875e38d4.js" defer></script><script src="/assets/js/12.42de9ed2.js" defer></script>
</body>
</html>

1
docs/README.md Normal file
View File

@ -0,0 +1 @@
# BitXHub文档

0
docs/develop/README.md Normal file
View File

0
docs/develop/order.md Normal file
View File

101
docs/faq/README.md Normal file
View File

@ -0,0 +1,101 @@
# 产品问题
## 【跨链技术】
### 1. 跨链的必要性
**一是技术层面,区块链技术在单链架构下本身存在着性能、容量不足等问题**。单链由于受到目前共识速度的限制,节点的执行性能无法做到线性扩展,这限制了高交易吞吐量低延迟的商业场景的应用。除此之外,随着区块链运行时间的增长,其存储容量也将逐渐增长,且这种数据增长的速度甚至会超过单链存储介质的容量上限。目前的区块链共识算法、存储结构、和安全机制不同导致链与链之间缺乏统一的互联互通机制,这极大限制了区块链技术和应用生态的健康发展。
**二是业务层面存在跨区块链业务的资产交换和信息交换需求**。在资产交换方面,一些区块链事实上仍处于互相隔离的状态,它们之间的资产交换主要依靠中心化的交易所来完成,中心化的交换方式既不安全规则也不透明。 而信息交换由于涉及链与链之间的数据同步和相应的跨链调用,实现更为复杂,目前各个区块链应用之间互通壁垒极高,无法有效地进行链上信息共享。
### 2. 跨链技术的可行性
目前区块链行业已经出现了很多的跨链技术产品,主要采用公证人机制(notary schemes)、侧链/中继(sidechains/relays)、哈希锁定(Hash-locking)等技术,已经在公链的场景中有很多应用例如:闪电网络,去中心化交易所等。
联盟链场景中采用类似技术及其增强技术,解决联盟链跨链需求,目前的产品已经能够解决跨链中的关键问题:
1. 跨链交易的验证问题,如何确认记录交易发生的区块得到了足够的确认,即交易事务中各分布式网络间的数据一致性问题;
2. 跨链事务的原子性问题,如何管理跨链事务中的各子交易确保跨链事务整体完整的原子性,即跨链事务的发生只存在两中状态完成或失败;
3. 不同区块链之间的协议适配问题,如何对采用不同架构与协议的区块链之间进行适配,需要跨链协议中设计可以兼容多种异构区块链的数据结构、命名规范以及通信方式等。
## 【产品功能】
### 1. 产品简介
趣链科技跨链技术平台BitXHub提出了一套完整的通用跨链传输协议IBTP(Inter-Blokcchain Transfer Protocol), 能够完美支持和兼容任意区块链系统实现异构区块链的无缝连接。BitXHub采用先进的中继+网关的组合技术,解决了跨链中的交易捕获、传输以及验证的核心难题,所有关键技术均具有完全自主知识产权。同时,平台具备完善的跨链接口管理、异构链成员治理、联盟权限管控等联盟跨链专用机制,是目前业界最完备的异构联盟链跨链技术平台,已经在金融、政务等业务场景中进行了相关应用验证。
### 2. 实现原理
BitXHub提出一种可扩展的适应不同异构区块链系统之间的跨链方案通过设计可插拔的跨链网关技术实现区块链网络间的的协议转换并支持异构区块链之间的交易验证该方案支持异构区块链之间交易的可信验证和可靠传递。
应用基于插件机制的跨链网关,实现异构应用链的快速适配与统一管理,以动态加载插件的形式随时加入平台;应用基于智能合约的异构交易验证技术,将交易验证规则进行全生命周期的管理,实现统一、高效的跨链交易合法性验证;应用基于可信事件的跨链传输协议,消除异构区块链之间技术机制的差异性,实现跨链交易格式的通用化与标准化,达成区块链平台在应用级别的可扩展性。
<img width="681" alt="image" src="https://user-images.githubusercontent.com/44690871/78634606-e3e52080-78d6-11ea-90a8-ea4947df3979.png">
### 3. 跨链交易基本流程
1. SDK 调用 具体的业务链A的合约方法
2. 合约方法被执行抛出跨链事件T1
3. 业务链A的跨链网关监听到T1, 将其转换成IBTP结构提交到中继链BitXHub上
4. BitXHub 依据相关规则对T1进行验证以及路由
5. 业务链B的跨链网关接受到T1并根据IBTP结构进行解析转换成业务链B可识别的交易Tb
6. B的跨链网关将Tb提交到业务链B上进行执行
### 4. 跨链效率
跨链的完整流程所需时间:**T = Ta + Thub + Tb**
其中**Thub**是中继链的验证和共识所需的时间,可达到 5000TPS 左右;**Ta**和**Tb**分别是应用链A和应用链B的执行时间其性能取决于应用链本身的执行效率。
### 5. 社区版与商业版有何区别?
社区版和商业版都支持基础功能:
- 中继服务(跨链交易验证与路由、跨链成员管理)
- 网关服务(跨链交易捕获、解析与调用)
- SDK组件GO、JAVA
其他对比如下:
<img width="661" alt="image" src="https://user-images.githubusercontent.com/44690871/78636698-696acf80-78db-11ea-9722-4eedf567665c.png">
### 6. 跨链平台目前适配了哪几种应用链?
目前已适配趣链区块链平台和Hyperledger Fabric其他类型区块链包括公链可以按需通过插件形式灵活接入。社区版目前已提供Fabric的插件。
### 7. 所有跨链交易都会经过中继链处理,是否会存在数据安全性问题?如何实现不同业务链跨链时的数据隔离和隐私性?
中继链中的所有交易均以IBTP协议的数据结构进行存储、验证
| 参数 | 说明 |
| ------ | ------ |
| From | 来源链ID |
| To | 目的链ID |
| Version | 协议版本号 |
| Index | 跨链交易索引 |
| Payload | 跨链调用内容编码 |
| Timestamp | 跨链事件发生的时间戳 |
| Proof | 跨链交易证明 |
| Extra | 自定义字段 |
其中的Payload是跨链交易的核心内容BitXHub通过多种方式保证其安全性
- 采用特殊的编码机制,仅跨链双方可解;
- 采用加密的方式,仅跨链双方持有秘钥;
- 链上权限控制,非相关方无法读取相应交易(之后将核心代码开源以保证可信);
- 采用类似隐私交易的机制仅相关控制的BitXHub节点中保存相关方跨链交易
### 8. 跨链转账交易如何保证事务性?如何做回滚或补偿呢?
目前社区版本暂不支持主要方案是跨链网关结合中继链中存储的跨链交易状态信息共同保障预计于2020年9月上线敬请期待
### 9. 通过DataSwapper相互传递的数据如何保证真实性呢
- 验证引擎会对跨链交易、跨链交易执行结果采用SPV证明机制进行验证来确保跨链交易和跨链交易的执行都是真实在链中发生的。
- 应用链中跨链的接口必须按照规定实现验证引擎会对比跨链调用的接口以及通过SPV机制验证调用接口执行后返回的数据的有效性。
# 技术问题
## 【跨链准备】
### 1. 中继链由谁维护?如何搭建?
中继链本身就是一条联盟链,作为去中心化的可信中介,推荐的搭建方案是由参与跨链的各方共同维护节点来搭建中继链。
### 2. 跨链网关应该部署在哪里?
跨链网关部署是由应用链方决定的跨链网关只负责跨链交易的收集、跨链真实性凭证收集和跨链交易执行整个跨链操作的可信是通过验证引擎对IBTP的验证实现的如果跨链网关篡改数据中继链的验证引擎将不会验证通过。
### 3. 对于未适配应用链需要做哪些开发工作,改造的工作量是多少?
应用链适配工作包括:
1. 根据我们提供的模板撰写跨链路由合约broker, 主要一方面将自己的合约某些方法提供给其他方使用;二是提供接受来自其他方的交换的信息或资产接口
2. 对于需要跨链的方法,添加调用跨链的逻辑,就是调用我们提供的跨链合约接口
3. 部署跨链网关常见区块链无需改造特殊的区块链只需要提供和区块链相关的SDK基本就可以
4. 将应用链的信息注册到BitXHub中如链的ID节点数量共识算法类型等
5. 根据应用链的共识机制编写交易的验证规则,详见[验证规则编写文档](https://github.com/meshplus/bitxhub/wiki/验证引擎规则编写)
## 【跨链操作】
### 1. Fabric没有token在跨链转账时使用的是什么资产模型
wiki中给出的例子是一个模拟资产操作的一个合约对资产模型没做特定的假设。
### 2. 对于已经存在业务的应用链,是不是需要更改原来的业务合约才能兼容新的资产类型?
对于已有的业务合约需要进行一定的改造,即实现规定的几个接口,详见[业务合约改造文档](https://github.com/meshplus/bitxhub/wiki/跨链合约编写文档#改造业务合约)

192
docs/quick/README.md Normal file
View File

@ -0,0 +1,192 @@
我们提供了脚本来快速启动两条Fabric应用链A和B跨链网关和中继链。
## 部署Fabric网络
在运行跨链网络之前必要的软件如Golang和Docker可以根据官网自行安装。确保 $GAPTH $GOBIN等环境变量已经正确设置。
以上的软件依赖安装之后我们提供了脚本来安装启动两个简单的Fabric网络。
下载部署fabric网络脚本ffn.sh
```shell
wget https://github.com/meshplus/goduck/raw/master/scripts/quick_start/ffn.sh
```
启动fabric网络
**注意:** 脚本运行过程中按照提示进行确认即可。
```shell
bash ffn.sh down // 如果本地已经有Fabric网络运行需要先关闭如果没有可以不运行该命令
bash ffn.sh up //启动两条fabric应用链A和B
```
**注意:** 命令执行完,会在当前目录生成`crypto-config`和`crypto-configB`文件夹,后面的`chaincode.sh`和 `fabric_pier.sh`需要在执行目录下存在上述文件。
## 部署跨链合约
下载操作`chaincode`的脚本chaincode.sh
```shell
wget https://raw.githubusercontent.com/meshplus/goduck/master/scripts/quick_start/chaincode.sh
```
拷贝`crypto-config`和`crypto-configB`到当前目录,执行以下命令:
```shell
// -c指定fabric cli的配置文件默认为config.yaml
// 应用链A部署chaincode
bash chaincode.sh install
//应用链B部署chaincode
bash chaincode.sh install -c 'configB.yaml'
```
该命令会在指定fabric网络中部署`broker`, `transfer` 和`data_swapper`三个`chaincode`
部署完成后,通过以下命令检查是否部署成功:
```shell
// 上一步的脚本默认初始化了一个有10000余额的账号Alicetransfer chaincode
// -c指定fabric cli的config.yaml配置文件
// 查看应用链A中Alice的余额
bash chaincode.sh get_balance -c 'config.yaml'
****************************************************************************************************
***** | Response[0]: //peer0.org2.example.com
***** | | Payload: 10000
***** | Response[1]: //peer1.org2.example.com
***** | | Payload: 10000
****************************************************************************************************
//查看应用链B中Alice的余额
bash chaincode.sh get_balance -c 'configB.yaml'
****************************************************************************************************
***** | Response[0]: //peer0.org2.example1.com
***** | | Payload: 10000
***** | Response[1]: //peer1.org2.example1.com
***** | | Payload: 10000
****************************************************************************************************
```
# 启动BitXHub
BitXHub依赖于[golang](https://golang.org/) 和[tmux](https://github.com/tmux/tmux/wiki),需要提前进行安装。
使用下面的命令克隆项目:
```shell
git clone git@github.com:meshplus/bitxhub.git
```
BitXHub还依赖于一些小工具使用下面的命令进行安装
```shell
cd bitxhub
git checkout c3d850d3d4cb8742310bb8e2614e18cb075a3dc1
bash scripts/prepare.sh
```
最后运行下面的命令即可运行一个四节点的BitXHub中继链
```shell
make cluster
```
**注意:** `make cluster`启动会使用`tmux`进行分屏,所以在命令执行过程中,最好不要进行终端切换。
## 启动跨链网关
下载相关的脚本fabric_pier.sh
```shell
wget https://github.com/meshplus/goduck/raw/master/scripts/quick_start/fabric_pier.sh
```
执行以下命令即可启动跨链网关:
```shell
//启动跨链网关连接应用链A和BitXHub
// -r: 跨链网关启动目录,默认为.pier目录
// -c: fabric组织证书目录默认为crypto-config
// -g: 指定fabric cli连接的配置文件默认为config.yaml
// -p: 跨链网关的启动端口默认为8987
// -b: 中继链GRPC地址默认为localhost:60011
// -o: pprof端口默认为44555
bash fabric_pier.sh start -r '.pier' -c 'crypto-config' -g 'config.yaml' -p 8987 -b 'localhost:60011' -o 44555
//启动跨链网关连接应用链B和BitXHub
bash fabric_pier.sh start -r '.pierB' -c 'crypto-configB' -g 'configB.yaml' -p 8988 -b 'localhost:60011' -o 44556
```
在该目录下通过以下命令可以得到该跨链网关对应应用链的ID
```shell
//应用链A的ID
bash fabric_pier.sh id -r '.pier'
//应用链B的ID
bash fabric_pier.sh id -r '.pierB'
```
**注意:** 后面跨链交易命令需要该值
## 跨链转账
使用**部署跨链合约**章节中下载的`chaincode.sh`进行相关`chaincode`调用。
1. 查询Alice余额
```shell
// 查询应用链A中Alice的余额
// -c指定fabric cli的config.yaml配置文件
bash chaincode.sh get_balance -c 'config.yaml'
****************************************************************************************************
***** | Response[0]: //peer0.org2.example.com
***** | | Payload: 10000
***** | Response[1]: //peer1.org2.example.com
***** | | Payload: 10000
****************************************************************************************************
// 查询应用链B中Alice的余额
bash chaincode.sh get_balance -c 'configB.yaml'
****************************************************************************************************
***** | Response[0]: //peer0.org2.example1.com
***** | | Payload: 10000
***** | Response[1]: //peer1.org2.example1.com
***** | | Payload: 10000
****************************************************************************************************
```
2. 发送一笔跨链转账
下面的命令会将应用链A中Alice的一块钱转移到应用链B中Alice
```shell
// -c指定fabric cli的config.yaml配置文件
// -t: 目的链的ID应用链B的ID
bash chaincode.sh interchain_transfer -c 'config.yaml' -t <target_appchain_id>
```
3. 查询余额
分别在两条链上查询Alice余额
```shell
// 查询应用链A中Alice的余额发现余额少了一块钱
// -c指定fabric cli的config.yaml配置文件
bash chaincode.sh get_balance -c 'config.yaml'
****************************************************************************************************
***** | Response[0]: //peer0.org2.example.com
***** | | Payload: 9999
***** | Response[1]: //peer1.org2.example.com
***** | | Payload: 9999
****************************************************************************************************
// 查询应用链B中Alice的余额发现余额多了一块钱
bash chaincode.sh get_balance -c 'configB.yaml'
****************************************************************************************************
***** | Response[0]: //peer0.org2.example1.com
***** | | Payload: 10001
***** | Response[1]: //peer1.org2.example1.com
***** | | Payload: 10001
****************************************************************************************************
```
**注意:** `chaincode.sh`调用不同的fabric需要不同的`config.yaml`,注意区分。

0
docs/usage/README.md Normal file
View File

0
docs/usage/deploy.md Normal file
View File

0
docs/version/README.md Normal file
View File