OSDN Git Service

init doc
authorHAOYUatHZ <haoyu@protonmail.com>
Mon, 10 Jun 2019 14:06:22 +0000 (22:06 +0800)
committerHAOYUatHZ <haoyu@protonmail.com>
Mon, 10 Jun 2019 14:06:22 +0000 (22:06 +0800)
docs/cross-chain.md [new file with mode: 0644]
docs/跨链交易.md [new file with mode: 0644]

diff --git a/docs/cross-chain.md b/docs/cross-chain.md
new file mode 100644 (file)
index 0000000..18995e6
--- /dev/null
@@ -0,0 +1,201 @@
+# cross-chain transaction
+
+Related api:
+
++ `build-transaction` / `build-chain-transactions` 
++ `sign-transaction` / `sign-transactions`
++ `submit-transaction` / `submit-transactions`
++ `list-transactions`
+
+## mainchain(bytom) to sidechain(vapor)
+
+To build a mainchain-to-sidechain transaction, `build-transaction` is called by one or more federation members, using `cross_chain_in` action.
+
+### Parameters
+
+`Object`:
+
+- `String` - *base_transaction*, base data for the transaction, default is null.
+- `Integer` - *ttl*, integer of the time to live in milliseconds, it means utxo will be reserved(locked) for builded transaction in this time range, if the transaction will not to be submitted into block, it will be auto unlocked for build transaction again after this ttl time. it will be set to 5 minutes(300 seconds) defaultly when ttl is 0.
+- `Integer` - *time_range*, the block height at which this transaction will be allowed to be included in a block. If the block height of the main chain exceeds this value, the transaction will expire and no longer be valid.
+- `Arrary of Object` - *actions*:
+  - `Object`:
+    - `String` - *account_id* | *account_alias*, (type is spend_account) alias or ID of account.
+    - `String` - *asset_id* | *asset_alias*, (type is spend_account, issue, retire, control_program and control_address) alias or ID of asset.
+    - `Integer` - *amount*, (type is spend_account, issue, retire, control_program and control_address) the specified asset of the amount sent with this transaction.
+    - `String`- *type*, type of transaction, valid types: 'spend_account', 'issue', 'spend_account_unspent_output', 'control_address', 'control_program', 'retire'.
+    - `String` - *address*, (type is control_address) address of receiver, the style of address is P2PKH or P2SH.
+    - `String` - *control_program*, (type is control_program) control program of receiver.
+    - `String` - *use_unconfirmed*, (type is spend_account and spend_account_unspent_output) flag of use unconfirmed UTXO, default is false.
+
+#### Returns
+
+- `Object of build-transaction` - *transaction*, builded transaction.
+
+#### Example
+
+```js
+// Request
+curl -X POST build-transaction -d '{"base_transaction":null,"actions":[{"account_id":"0BF63M2U00A04","amount":20000000,"asset_id":"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","type":"spend_account"},{"amount":10000,"asset_id":"3152a15da72be51b330e1c0f8e1c0db669269809da4f16443ff266e07cc43680","type":"issue"},{"amount":10000,"asset_id":"3152a15da72be51b330e1c0f8e1c0db669269809da4f16443ff266e07cc43680","address":"bm1q50u3z8empm5ke0g3ngl2t3sqtr6sd7cepd3z68","type":"control_address"}],"ttl":0,"time_range": 43432}'
+```
+
+```js
+// Result
+{
+  "allow_additional_actions": false,
+  "local": true,
+  "raw_transaction": "07010000020161015fb6a63a3361170afca03c9d5ce1f09fe510187d69545e09f95548b939cd7fffa3ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80fc93afdf01000116001426bd1b851cf6eb8a701c20c184352ad8720eeee90100015d015bb6a63a3361170afca03c9d5ce1f09fe510187d69545e09f95548b939cd7fffa33152a15da72be51b330e1c0f8e1c0db669269809da4f16443ff266e07cc43680c03e0101160014489a678741ccc844f9e5c502f7fac0a665bedb25010003013effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80a2cfa5df0101160014948fb4f500e66d20fbacb903fe108ee81f9b6d9500013a3152a15da72be51b330e1c0f8e1c0db669269809da4f16443ff266e07cc43680dd3d01160014cd5a822b34e3084413506076040d508bb12232c70001393152a15da72be51b330e1c0f8e1c0db669269809da4f16443ff266e07cc436806301160014a3f9111f3b0ee96cbd119a3ea5c60058f506fb1900",
+  "signing_instructions": [
+    {
+      "position": 0,
+      "witness_components": [
+        {
+          "keys": [
+            {
+              "derivation_path": [
+                "010100000000000000",
+                "0500000000000000"
+              ],
+              "xpub": "ee9dd8affdef7e0cacd0fbbf310217c7f588156c28e414db74c27afaedd8f876cf54547a672b431ff06ee8a146207df9595638a041b55ada1a764a8b5b30bda0"
+            }
+          ],
+          "quorum": 1,
+          "signatures": null,
+          "type": "raw_tx_signature"
+        },
+        {
+          "type": "data",
+          "value": "62a73b6b7ffe52b6ad782b0e0efdc8309bf2f057d88f9a17d125e41bb11dbb88"
+        }
+      ]
+    },
+    {
+      "position": 1,
+      "witness_components": [
+        {
+          "keys": [
+            {
+              "derivation_path": [
+                "010100000000000000",
+                "0600000000000000"
+              ],
+              "xpub": "ee9dd8affdef7e0cacd0fbbf310217c7f588156c28e414db74c27afaedd8f876cf54547a672b431ff06ee8a146207df9595638a041b55ada1a764a8b5b30bda0"
+            }
+          ],
+          "quorum": 1,
+          "signatures": null,
+          "type": "raw_tx_signature"
+        },
+        {
+          "type": "data",
+          "value": "ba5a63e7416caeb945eefc2ce874f40bc4aaf6005a1fc792557e41046f7e502f"
+        }
+      ]
+    }
+  ]
+}
+```
+
+#### Following steps
+
+Then the federation members sign the transaction and submit it to a vapord node, using `sign-transaction` and `submit-transaction` respectively. The usages are as same as those for bytomd, see bytomd RPC document's [`sign-transaction`](https://github.com/Bytom/bytom/wiki/API-Reference#sign-transaction) and [`submit-transaction`](https://github.com/Bytom/bytom/wiki/API-Reference#submit-transaction) for detail.
+
+## list cross-chain transactions
+
+To list cross-chain transactions, `list-transactions` needs to be called by a vapord node.
+
+If 
+
+
+## sidechain(vapor) to mainchain(bytom)
+
+To build a sidechain-to-mainchain transaction, `build-transaction` is called by a vapor user, using `cross_chain_out` action.
+
+### Parameters
+
+`Object`:
+
+- `String` - *base_transaction*, base data for the transaction, default is null.
+- `Integer` - *ttl*, integer of the time to live in milliseconds, it means utxo will be reserved(locked) for builded transaction in this time range, if the transaction will not to be submitted into block, it will be auto unlocked for build transaction again after this ttl time. it will be set to 5 minutes(300 seconds) defaultly when ttl is 0.
+- `Integer` - *time_range*, the block height at which this transaction will be allowed to be included in a block. If the block height of the main chain exceeds this value, the transaction will expire and no longer be valid.
+- `Arrary of Object` - *actions*:
+  - `Object`:
+    - `String` - *account_id* | *account_alias*, (type is spend_account) alias or ID of account.
+    - `String` - *asset_id* | *asset_alias*, (type is spend_account, issue, retire, control_program and control_address) alias or ID of asset.
+    - `Integer` - *amount*, (type is spend_account, issue, retire, control_program and control_address) the specified asset of the amount sent with this transaction.
+    - `String`- *type*, type of transaction, valid types: 'spend_account', 'issue', 'spend_account_unspent_output', 'control_address', 'control_program', 'retire'.
+    - `String` - *address*, (type is control_address) address of receiver, the style of address is P2PKH or P2SH.
+    - `String` - *control_program*, (type is control_program) control program of receiver.
+    - `String` - *use_unconfirmed*, (type is spend_account and spend_account_unspent_output) flag of use unconfirmed UTXO, default is false.
+
+#### Returns
+
+- `Object of build-transaction` - *transaction*, builded transaction.
+
+#### Example
+
+```js
+// Request
+curl -X POST build-transaction -d '{"base_transaction":null,"actions":[{"account_id":"0BF63M2U00A04","amount":20000000,"asset_id":"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","type":"spend_account"},{"amount":10000,"asset_id":"3152a15da72be51b330e1c0f8e1c0db669269809da4f16443ff266e07cc43680","type":"issue"},{"amount":10000,"asset_id":"3152a15da72be51b330e1c0f8e1c0db669269809da4f16443ff266e07cc43680","address":"bm1q50u3z8empm5ke0g3ngl2t3sqtr6sd7cepd3z68","type":"control_address"}],"ttl":0,"time_range": 43432}'
+```
+
+```js
+// Result
+{
+  "allow_additional_actions": false,
+  "local": true,
+  "raw_transaction": "07010000020161015fb6a63a3361170afca03c9d5ce1f09fe510187d69545e09f95548b939cd7fffa3ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80fc93afdf01000116001426bd1b851cf6eb8a701c20c184352ad8720eeee90100015d015bb6a63a3361170afca03c9d5ce1f09fe510187d69545e09f95548b939cd7fffa33152a15da72be51b330e1c0f8e1c0db669269809da4f16443ff266e07cc43680c03e0101160014489a678741ccc844f9e5c502f7fac0a665bedb25010003013effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80a2cfa5df0101160014948fb4f500e66d20fbacb903fe108ee81f9b6d9500013a3152a15da72be51b330e1c0f8e1c0db669269809da4f16443ff266e07cc43680dd3d01160014cd5a822b34e3084413506076040d508bb12232c70001393152a15da72be51b330e1c0f8e1c0db669269809da4f16443ff266e07cc436806301160014a3f9111f3b0ee96cbd119a3ea5c60058f506fb1900",
+  "signing_instructions": [
+    {
+      "position": 0,
+      "witness_components": [
+        {
+          "keys": [
+            {
+              "derivation_path": [
+                "010100000000000000",
+                "0500000000000000"
+              ],
+              "xpub": "ee9dd8affdef7e0cacd0fbbf310217c7f588156c28e414db74c27afaedd8f876cf54547a672b431ff06ee8a146207df9595638a041b55ada1a764a8b5b30bda0"
+            }
+          ],
+          "quorum": 1,
+          "signatures": null,
+          "type": "raw_tx_signature"
+        },
+        {
+          "type": "data",
+          "value": "62a73b6b7ffe52b6ad782b0e0efdc8309bf2f057d88f9a17d125e41bb11dbb88"
+        }
+      ]
+    },
+    {
+      "position": 1,
+      "witness_components": [
+        {
+          "keys": [
+            {
+              "derivation_path": [
+                "010100000000000000",
+                "0600000000000000"
+              ],
+              "xpub": "ee9dd8affdef7e0cacd0fbbf310217c7f588156c28e414db74c27afaedd8f876cf54547a672b431ff06ee8a146207df9595638a041b55ada1a764a8b5b30bda0"
+            }
+          ],
+          "quorum": 1,
+          "signatures": null,
+          "type": "raw_tx_signature"
+        },
+        {
+          "type": "data",
+          "value": "ba5a63e7416caeb945eefc2ce874f40bc4aaf6005a1fc792557e41046f7e502f"
+        }
+      ]
+    }
+  ]
+}
+```
+
+#### Following steps
+
+Then the vapor user sign the transaction and submit it to a vapord node, using `sign-transaction` and `submit-transaction` respectively. The usages are as same as those for bytomd, see bytomd RPC document's [`sign-transaction`](https://github.com/Bytom/bytom/wiki/API-Reference#sign-transaction) and [`submit-transaction`](https://github.com/Bytom/bytom/wiki/API-Reference#submit-transaction) for detail.
\ No newline at end of file
diff --git a/docs/跨链交易.md b/docs/跨链交易.md
new file mode 100644 (file)
index 0000000..ad421f6
--- /dev/null
@@ -0,0 +1,7 @@
+# 跨链交易
+
+## 主链转侧链
+
+## 列出跨链交易
+
+## 侧链转主链
\ No newline at end of file