Skip to content

Commit c4fb9cc

Browse files
committed
wallet docs
1 parent 45ddb07 commit c4fb9cc

29 files changed

+333
-24
lines changed

docs/.vitepress/config/en.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,16 +169,18 @@ function sidebarChain(): DefaultTheme.SidebarItem[] {
169169
{
170170
items: [
171171
{
172-
text: 'Project Introduction',
172+
text: 'Introduction',
173173
base: '/en/chain/',
174+
collapsed: false,
174175
items: [
175-
{ text: 'System Architecture', link: 'overview' },
176+
{ text: 'Overview', link: 'overview' },
176177
{ text: 'Functional Modules', link: 'core-module' }
177178
]
178179
},
179180
{
180-
text: 'Detailed Description of Functional Modules',
181+
text: 'Functional Modules Detail',
181182
base: '/en/chain/',
183+
collapsed: false,
182184
items: [
183185
{ text: 'RollUp and Proof System Layer', link: 'rollup-and-proof-system-abstraction' },
184186
{ text: 'Cross-Chain', link: 'cross-chain-abstraction' },
@@ -189,13 +191,15 @@ function sidebarChain(): DefaultTheme.SidebarItem[] {
189191
}, {
190192
text: 'Local Test Run',
191193
base: '/en/chain/',
194+
collapsed: false,
192195
items: [
193196
{ text: 'Local Startup Network', link: 'chain-setup' },
194197
{ text: 'Quick Start', link: 'start-test' },
195198
]
196199
}, {
197200
text: 'DappLink TestNet',
198201
base: '/en/chain/',
202+
collapsed: false,
199203
items: [
200204
{ text: 'Introduction', link: 'dapplink-testnet' },
201205
{ text: 'RPC', link: 'rpc-url' },

docs/.vitepress/config/zh.ts

Lines changed: 58 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -136,36 +136,73 @@ function sidebarDappLink(): DefaultTheme.SidebarItem[] {
136136
function sidebarWallet(): DefaultTheme.SidebarItem[] {
137137
return [
138138
{
139-
text: '一键发钱包',
140139
items: [
141-
{ text: '系统架构', link: 'overview' },
142-
{ text: '核心功能模块', link: 'dapplink-wallet' },
143140
{
144-
text: '项目组件',
141+
text: '项目介绍',
142+
base: '/zh/wallet/',
143+
collapsed: false,
144+
items: [
145+
{ text: '概述', link: 'overview' },
146+
{ text: '核心功能', link: 'core-function' }
147+
]
148+
},
149+
{
150+
text: '项目核心功能模块',
145151
base: '/zh/wallet/',
152+
collapsed: false,
153+
items: [
154+
{ text: '统一签名服务业务流程', link: 'signature' },
155+
{ text: '中心化钱包业务流程', link: 'centralized-wallet' },
156+
{ text: '去中心化钱包业务', link: 'decentralized-wallet' },
157+
{ text: 'MPC 网络', link: 'tss' }
158+
]
159+
},
160+
{
161+
text: '交易所钱包业务流详细介绍',
162+
base: '/zh/wallet/centralized/',
163+
collapsed: false,
164+
items: [
165+
{ text: '商户信息提交', link: 'business-submit' },
166+
{ text: '商户 ID 配置', link: 'business-id-config' },
167+
{ text: '业务方配置 Token', link: 'set-chain-token' },
168+
{ text: '批量地址生成', link: 'batch-generate-address' },
169+
{ text: '充值业务', link: 'deposit-flow' },
170+
{ text: '提现业务', link: 'withdraw-flow' },
171+
{ text: '归集业务', link: 'collection-flow' },
172+
{ text: '热转冷', link: 'hot-to-cold' },
173+
{ text: '冷转热', link: 'cold-to-hot' },
174+
{ text: '回滚业务', link: 'fallback' },
175+
{ text: '服务部署方式', link: 'service-deploy' },
176+
]
177+
},
178+
{
179+
text: '去中心化钱包业务流详细介绍',
180+
base: '/zh/wallet/setup',
181+
collapsed: false,
146182
items: [
147183
{ text: '统一浏览器代码库', link: 'chain-explorer-api' },
148-
{ text: '统一 RPC 接口服务', link: 'wallet-chain-node' },
149-
{ text: '密钥托管工具', link: 'key-locker' },
150-
{ text: '门限共享秘密算法的底层库', link: 'dapplink-secret' },
151-
{ text: '行情聚合器物', link: 'skyeye' },
152-
{ text: '交易系统', link: 'trade' },
153-
{ text: '离线签名 SDK', link: 'wallet-sdk' },
154-
{ text: 'MPC 网络', link: 'tss' },
155-
{ text: '跨链质押项目', link: 'linklayer' },
156-
{ text: 'HD 钱包后端服务服务', link: 'hailstone' },
157-
{ text: '统一充值,提现,归集,转冷,风控的钱包服务', link: 'wallet-scanner' },
158-
{ text: '中心化钱包业务组件', link: 'centralized-wallet-servicer' }
159184
]
160-
}, {
185+
},
186+
{
187+
text: 'PayFi 技术解决方案',
188+
base: '/zh/wallet/setup',
189+
collapsed: false,
190+
items: [
191+
{ text: '统一浏览器代码库', link: 'chain-explorer-api' },
192+
]
193+
},
194+
{
161195
text: '本地运行测试',
162196
base: '/zh/wallet/setup',
197+
collapsed: false,
163198
items: [
164199
{ text: '统一浏览器代码库', link: 'chain-explorer-api' },
165200
]
166-
}, {
201+
},
202+
{
167203
text: '使用 DappLink 测试网络测试',
168204
base: '/zh/wallet/setup',
205+
collapsed: false,
169206
items: [
170207
{ text: '统一浏览器代码库', link: 'chain-explorer-api' },
171208
]
@@ -182,6 +219,7 @@ function sidebarChain(): DefaultTheme.SidebarItem[] {
182219
{
183220
text: '项目介绍',
184221
base: '/zh/chain/',
222+
collapsed: false,
185223
items: [
186224
{ text: '概述', link: 'overview' },
187225
{ text: '功能模块', link: 'core-module' }
@@ -190,6 +228,7 @@ function sidebarChain(): DefaultTheme.SidebarItem[] {
190228
{
191229
text: '功能模块详细',
192230
base: '/zh/chain/',
231+
collapsed: false,
193232
items: [
194233
{ text: 'RollUp 和证明系统抽象', link: 'rollup-and-proof-system-abstraction' },
195234
{ text: '跨链抽象', link: 'cross-chain-abstraction' },
@@ -200,13 +239,15 @@ function sidebarChain(): DefaultTheme.SidebarItem[] {
200239
}, {
201240
text: '本地运行测试',
202241
base: '/zh/chain/',
242+
collapsed: false,
203243
items: [
204244
{ text: '本地启动网络', link: 'chain-setup' },
205245
{ text: '开始使用', link: 'start-test' },
206246
]
207247
}, {
208248
text: 'DappLink 测试网络测试',
209249
base: '/zh/chain/',
250+
collapsed: false,
210251
items: [
211252
{ text: '测试网络介绍', link: 'dapplink-testnet' },
212253
{ text: 'RPC 链接', link: 'rpc-url' },
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
# 中心化钱包业务流程
2+
3+
![dapplink-wallet-3](images/dapplink-wallet-3.png)
4+
5+
- 地址生成流程
6+
- 业务方按照需求调度签名机生成密钥对,私钥存储在签名机里面,公钥通过接口返回
7+
- 业务调用 gRPC 接口,传入公钥列表,生成地址,multichain-sync-utxo/multichain-sync-account 调度底层服务根据公钥生成地址,并返回地址列表给到业务方。
8+
- 扫链业务流程
9+
- 充值时:synchronizer 服务监听区块解析交易处理入库
10+
- 充值:出金地址是外部地址,入金地址是交易所用户地址
11+
- 提现:出金地址是热钱包地址,入金地址是外部地址
12+
- 归集:出金地址是用户地址,入金地址是热钱包地址
13+
- 热转温:出金地址是热钱包地址,入金地址是温钱包地址
14+
- 温转热:出金地址是温钱包地址,入金地址是热钱包地址
15+
- 提现
16+
- 调用 multichain-sync 的 BuildUnSignTransaction, 构建 32 个字节的 MessageHash
17+
- 使用 MessageHash 去签名机里面进行签名,返回来 signature
18+
- 使用交易的 requestId 和签名发送到 multichain-sync, 构建的完整的并发送到区块网络
19+
- multichain-sync 的提现任务不断扫交易并发送到区块链,发送完成之后通知业务层,交易已发送
20+
- 扫到提现交易之后再次通知业务层提现成功
21+
- 归集, 热转温和温转热业务逻辑和提现差不多流程
22+
23+
## 一.统一 RPC 服务 Gateway
24+
![dapplink-wallet-4](images/dapplink-wallet-4.png)
25+
26+
## 二.wallet-chain-utxo 实现的接口
27+
```
28+
GetSupportChains(req *utxo.SupportChainsRequest) (*utxo.SupportChainsResponse, error)
29+
ConvertAddress(req *utxo.ConvertAddressRequest) (*utxo.ConvertAddressResponse, error)
30+
ValidAddress(req *utxo.ValidAddressRequest) (*utxo.ValidAddressResponse, error)
31+
GetFee(req *utxo.FeeRequest) (*utxo.FeeResponse, error)
32+
GetAccount(req *utxo.AccountRequest) (*utxo.AccountResponse, error)
33+
GetUnspentOutputs(req *utxo.UnspentOutputsRequest) (*utxo.UnspentOutputsResponse, error)
34+
GetBlockByNumber(req *utxo.BlockNumberRequest) (*utxo.BlockResponse, error)
35+
GetBlockByHash(req *utxo.BlockHashRequest) (*utxo.BlockResponse, error)
36+
GetBlockHeaderByHash(req *utxo.BlockHeaderHashRequest) (*utxo.BlockHeaderResponse, error)
37+
GetBlockHeaderByNumber(req *utxo.BlockHeaderNumberRequest) (*utxo.BlockHeaderResponse, error)
38+
SendTx(req *utxo.SendTxRequest) (*utxo.SendTxResponse, error)
39+
GetTxByAddress(req *utxo.TxAddressRequest) (*utxo.TxAddressResponse, error)
40+
GetTxByHash(req *utxo.TxHashRequest) (*utxo.TxHashResponse, error)
41+
BuildUnSignTransaction(req *utxo.UnSignTransactionRequest) (*utxo.UnSignTransactionResponse, error)
42+
BuildSignedTransaction(req *utxo.SignedTransactionRequest) (*utxo.SignedTransactionResponse, error)
43+
DecodeTransaction(req *utxo.DecodeTransactionRequest) (*utxo.DecodeTransactionResponse, error)
44+
VerifySignedTransaction(req *utxo.VerifyTransactionRequest) (*utxo.VerifyTransactionResponse, error)
45+
```
46+
- GetSupportChains: 可以查询是否支持这条链
47+
- ConvertAddress: 公钥导出地址
48+
- ValidAddress:判断地址格式是否正确
49+
- GetFee: 预估手续费
50+
- GetAccount:获取账户相关的信息,例如:余额
51+
- GetUnspentOutputs:获取未花费的输入输出列表
52+
- GetBlockByNumber:根据区块号获取区块的信息,包含交易列表,若传空,获取到的是最新区块,若传入区块数,获取到的区块的信息
53+
- GetBlockByHash:根据区块哈希获取区块的信息,包含交易列表
54+
- GetBlockHeaderByHash:根据区块哈希获取区块头信息
55+
- GetBlockHeaderByNumber:根据区块号获取区块头信息
56+
- SendTx:广播签名的交易
57+
- GetTxByAddress: 根据地址获取该地址相关的交易记录
58+
- GetTxByHash:根据 TxHash 获取交易详情
59+
- BuildUnSignTransaction:根据交易数据生成待签名的 32 字节的 MessageHash
60+
- BuildSignedTransaction: 用签名机返回的 signature 和交易信息一起构建出完整的交易
61+
- DecodeTransaction:将 rawTx decode 出原始的交易
62+
- VerifySignedTransaction:签名的交易的验证
63+
64+
## 三.wallet-chain-account 实现的接口
65+
```
66+
type IChainAdaptor interface {
67+
GetSupportChains(req *account.SupportChainsRequest) (*account.SupportChainsResponse, error)
68+
ConvertAddress(req *account.ConvertAddressRequest) (*account.ConvertAddressResponse, error)
69+
ValidAddress(req *account.ValidAddressRequest) (*account.ValidAddressResponse, error)
70+
GetBlockByNumber(req *account.BlockNumberRequest) (*account.BlockResponse, error)
71+
GetBlockByHash(req *account.BlockHashRequest) (*account.BlockResponse, error)
72+
GetBlockHeaderByHash(req *account.BlockHeaderHashRequest) (*account.BlockHeaderResponse, error)
73+
GetBlockHeaderByNumber(req *account.BlockHeaderNumberRequest) (*account.BlockHeaderResponse, error)
74+
GetAccount(req *account.AccountRequest) (*account.AccountResponse, error)
75+
GetFee(req *account.FeeRequest) (*account.FeeResponse, error)
76+
SendTx(req *account.SendTxRequest) (*account.SendTxResponse, error)
77+
GetTxByAddress(req *account.TxAddressRequest) (*account.TxAddressResponse, error)
78+
GetTxByHash(req *account.TxHashRequest) (*account.TxHashResponse, error)
79+
GetBlockByRange(req *account.BlockByRangeRequest) (*account.BlockByRangeResponse, error)
80+
BuildUnSignTransaction(req *account.UnSignTransactionRequest) (*account.UnSignTransactionResponse, error)
81+
BuildSignedTransaction(req *account.SignedTransactionRequest) (*account.SignedTransactionResponse, error)
82+
DecodeTransaction(req *account.DecodeTransactionRequest) (*account.DecodeTransactionResponse, error)
83+
VerifySignedTransaction(req *account.VerifyTransactionRequest) (*account.VerifyTransactionResponse, error)
84+
GetExtraData(req *account.ExtraDataRequest) (*account.ExtraDataResponse, error)
85+
}
86+
```
87+
- GetSupportChains: 可以查询是否支持这条链
88+
- ConvertAddress: 公钥到处地址
89+
- ValidAddress:判断地址格式是否正确
90+
- GetFee: 预估手续费
91+
- GetAccount:获取账户相关的信息,例如:余额
92+
- GetBlockByNumber:根据区块号获取区块的信息,包含交易列表,若传空,获取到的是最新区块,若传入区块数,获取到的区块的信息
93+
- GetBlockByHash:根据区块哈希获取区块的信息,包含交易列表
94+
- GetBlockHeaderByHash:根据区块哈希获取区块头信息
95+
- GetBlockHeaderByNumber:根据区块号获取区块头信息
96+
- GetBlockByRange: 根据 star 和 end 区块号获取这些区块区间的区块信息
97+
- SendTx:广播签名的交易
98+
- GetTxByAddress: 根据地址获取该地址相关的交易记录
99+
- GetTxByHash:根据 TxHash 获取交易详情
100+
- BuildUnSignTransaction:根据交易数据生成待签名的 32 字节的 MessageHash
101+
- BuildSignedTransaction: 用签名机返回的 signature 和交易信息一起构建出完整的交易
102+
- DecodeTransaction:将 rawTx decode 出原始的交易
103+
- VerifySignedTransaction:签名的交易的验证
104+
- GetExtraData: 预留接口
105+
106+
## 四.multichain-sync-account/utxo 服务
107+
```
108+
service BusinessMiddleWireServices {
109+
rpc businessRegister(BusinessRegisterRequest) returns (BusinessRegisterResponse) {}
110+
rpc exportAddressesByPublicKeys(ExportAddressesRequest) returns (ExportAddressesResponse) {}
111+
rpc buildUnSignTransaction(UnSignWithdrawTransactionRequest) returns(UnSignWithdrawTransactionResponse){}
112+
rpc buildSignedTransaction(SignedWithdrawTransactionRequest) returns(SignedWithdrawTransactionResponse){}
113+
rpc setTokenAddress(SetTokenAddressRequest) returns (SetTokenAddressResponse) {}
114+
}
115+
```
116+
- businessRegister:第三方业务需要进行注册,注册到系统之后才能使用整个钱包服务
117+
- exportAddressesByPublicKeys:根据公钥批量生成地址
118+
- createUnSignTransaction: 根据交易数据生成待签名的 32 字节的 MessageHash
119+
- buildUnSignTransaction: 用签名机返回的 signature 和交易信息一起构建出完整的交易
120+
- setTokenAddress: 业务根据自己的需求配置需要支持的 token
121+
122+
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)