Skip to content

Commit

Permalink
Merge pull request Qitmeer#60 from forchain/master
Browse files Browse the repository at this point in the history
qitmeer  transaction docs
  • Loading branch information
forchain authored Dec 5, 2020
2 parents 84d91fb + 70e3f26 commit 4534276
Show file tree
Hide file tree
Showing 13 changed files with 280 additions and 26 deletions.
2 changes: 1 addition & 1 deletion Document/content/JSON RPC API/_index.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ weight: 5
- [getRawTransaction](getrawtransaction)
- [getUtxo](getutxo)
- [sendRawTransaction](sendrawtransaction)
- [txSign](txSign)
- [txSign](txsign)



Expand Down
11 changes: 9 additions & 2 deletions Document/content/JSON RPC API/createRawTransaction/_index.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,19 @@ Returns a new transaction spending the provided inputs and sending to the provid

##### Request
```bash
curl --data '{"method":"createRawTransaction","params":[[{"Txid":"ddf99e004ed24d641ddc942272ed174b1c2ae0fb27cc0ed7e858e0a451e27633", "Vout":0}], {"RmG6xQsV7gnS4JZmoq5FgmyEbmUQRenrTCo":10000000000}],"jsonrpc":"2.0","id":1}' -s -k -u "test:test" -H 'Content-Type: application/json' http://127.0.0.1:1234 |jq .

curl -sku "test:test" -X POST -H 'Content-Type: application/json' --data '{"jsonrpc":"2.0","method":"createRawTransaction","params":[ [{"Txid":"cfd933e4590a3cfbcf94e9220c77834fe8a869414c51e3bd0ce5af23592e80f9", "Vout":1}], {"Tme9dVJ4GeWRninBygrA6oDwCAGYbBvNxY7":90000000}],"id":1}' http://127.0.0.1:18131 | jq

```

##### Response
```js
"01000000013376e251a4e058e8d70ecc27fbe02a1c4b17ed722294dc1d644dd24e009ef9dd00000000ffffffff0100e40b54020000001976a9146bd68046854813036fa042958e7f5ca29606e8d088ac00000000000000000100"
{
"jsonrpc": "2.0",
"id": 1,
"result": "0100000001f9802e5923afe50cbde3514c4169a8e84f83770c22e994cffb3c0a59e433d9cf01000000ffffffff01804a5d05000000001976a914a6b8fe2348fad076b7fd1b34b7e5b35db96dc2a088ac00000000000000001141cb5f0100"
}

```


31 changes: 21 additions & 10 deletions Document/content/JSON RPC API/getRawTransaction/_index.cn.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,31 @@
---
title: getRawTransaction
---
title: getRawTransaction
weight: 3
---

## getRawTransaction
### 函数名:getRawTransaction {txid}
### 说明:通过txid获取交易
- txid 交易id 为一个256位hash值。
- verbose 是否显示详细信息,默认为false
get raw transaction by ID

#### 实例
```
### Parameters
1. `txid: (hex string)` 256-bit transaction ID
2. `verbose: (bool , default=false)` When the verbose flag isn't set, simply return the serialized transaction as a hex-encoded string.

### Returns
#### verbose = true
`rawTx: (hex string)`

#### verbose = false
`Tx: (object)`

### Example
#### Request

```sh
curl -s -k -u test:test -X POST -H 'Content-Type: application/json' --data '{"jsonrpc":"2.0","method":"getRawTransaction","params":["c259a4dfb7eaaae92ab246f14762541581671135cd6030ac29d8c34cf77e9f32",true],"id":1}' https://127.0.0.1:18131

```
输出
```
#### Response
```json
{
"hex": "0100000001dc7d54db024a1ef06e38b85ab01af2d60043e3d36b5411691224c05dcf36f63c01000000ffffffff02659ca300000000001976a91406e2097d585337cdd10aefa09994b511127af0bb88acf0e8cd6f230200001976a914fe27c90d4ed4de3269c0bb9ae1d7639865e3bf2888ac00000000000000008015fc5e016b48304502210090910aa0190a6571319b0b638bfbb593582575703abdd4f1a7f0da2812cda7d102205dae6fee28396bfeb8f1b814884d8d03ab0dd9f30b171d906c24914ba2f85b1a012103cd4fa2ea2688ac9e0a62584635244f572d22c13730d5576722d6571aabfddca8",
"txid": "c259a4dfb7eaaae92ab246f14762541581671135cd6030ac29d8c34cf77e9f32",
Expand Down
88 changes: 87 additions & 1 deletion Document/content/JSON RPC API/getUtxo/_index.en.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,90 @@
---
title: getUtxo
title: getUTXO
weight: 1
---

## getUTXO
Returns information about an unspent transaction output

### Parameters
1. `txid (string, required)` The hash of the transaction
2. `vout (numeric, required)` The index of the output
3. `includemempool (boolean, optional, default=true)` Include the mempool when true

### Returns
```json
{
"bestblock": "value", (string) The block hash that contains the transaction output
"confirmations": n, (numeric) The number of confirmations
"amount": n.nnn, (numeric) The transaction amount
"scriptPubKey": { (object) The public key script used to pay coins as a JSON object
"asm": "value", (string) Disassembly of the script
"hex": "value", (string) Hex-encoded bytes of the script
"reqSigs": n, (numeric) The number of required signatures
"type": "value", (string) The type of the script (e.g. 'pubkeyhash')
"addresses": ["value",...], (array of string) The qitmeer addresses associated with this script
},
"coinbase": true|false, (boolean) Whether or not the transaction is a coinbase
}
```

### Example
#### Request

```sh
curl -s -k -u test:test -X POST -H 'Content-Type: application/json' --data '{"jsonrpc":"2.0","method":"getRawTransaction","params":["c259a4dfb7eaaae92ab246f14762541581671135cd6030ac29d8c34cf77e9f32",true],"id":1}' https://127.0.0.1:18131

```
#### Response
```json
{
"hex": "0100000001dc7d54db024a1ef06e38b85ab01af2d60043e3d36b5411691224c05dcf36f63c01000000ffffffff02659ca300000000001976a91406e2097d585337cdd10aefa09994b511127af0bb88acf0e8cd6f230200001976a914fe27c90d4ed4de3269c0bb9ae1d7639865e3bf2888ac00000000000000008015fc5e016b48304502210090910aa0190a6571319b0b638bfbb593582575703abdd4f1a7f0da2812cda7d102205dae6fee28396bfeb8f1b814884d8d03ab0dd9f30b171d906c24914ba2f85b1a012103cd4fa2ea2688ac9e0a62584635244f572d22c13730d5576722d6571aabfddca8",
"txid": "c259a4dfb7eaaae92ab246f14762541581671135cd6030ac29d8c34cf77e9f32",
"txhash": "9b603ba3b17fd8491749ac366a5064d8b7b70be02568e405406a9acd70e971a8",
"size": 235,
"version": 1,
"locktime": 0,
"timestamp": "2020-07-01T12:48:00+08:00",
"expire": 0,
"vin": [
{
"txid": "3cf636cf5dc024126911546bd3e34300d6f21ab05ab8386ef01e4a02db547ddc",
"vout": 1,
"sequence": 4294967295,
"scriptSig": {
"asm": "304502210090910aa0190a6571319b0b638bfbb593582575703abdd4f1a7f0da2812cda7d102205dae6fee28396bfeb8f1b814884d8d03ab0dd9f30b171d906c24914ba2f85b1a01 03cd4fa2ea2688ac9e0a62584635244f572d22c13730d5576722d6571aabfddca8",
"hex": "48304502210090910aa0190a6571319b0b638bfbb593582575703abdd4f1a7f0da2812cda7d102205dae6fee28396bfeb8f1b814884d8d03ab0dd9f30b171d906c24914ba2f85b1a012103cd4fa2ea2688ac9e0a62584635244f572d22c13730d5576722d6571aabfddca8"
}
}
],
"vout": [
{
"amount": 10722405,
"scriptPubKey": {
"asm": "OP_DUP OP_HASH160 06e2097d585337cdd10aefa09994b511127af0bb OP_EQUALVERIFY OP_CHECKSIG",
"hex": "76a91406e2097d585337cdd10aefa09994b511127af0bb88ac",
"reqSigs": 1,
"type": "pubkeyhash",
"addresses": [
"TmPaUYQuUtfCysrYVHc4AdhpVHxw7EskHTP"
]
}
},
{
"amount": 2351222876400,
"scriptPubKey": {
"asm": "OP_DUP OP_HASH160 fe27c90d4ed4de3269c0bb9ae1d7639865e3bf28 OP_EQUALVERIFY OP_CHECKSIG",
"hex": "76a914fe27c90d4ed4de3269c0bb9ae1d7639865e3bf2888ac",
"reqSigs": 1,
"type": "pubkeyhash",
"addresses": [
"Tmn7vzzSrvAPNLtwpD5YjiWwVUBD74Hjdww"
]
}
}
],
"confirmations": 0
}

```

52 changes: 45 additions & 7 deletions Document/content/JSON RPC API/sendRawTransaction/_index.cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,55 @@ title: sendRawTransaction
weight: 3
---

## sendRawTransaction
### 函数名:sendRawTransaction {sign_raw_tx} {allow_high_fee}
### 说明:发送交易
### sendRawTransaction
发送交易

- sign_raw_tx:签名后的交易
- allow_high_fee:允许的最大交易费
#### 参数
1. `hexTx: (hex string)` 已签名的交易十进制数据
2. `allowHighFees: (bool, default=false)` 是否允许高额交易费

#### 实例:
#### 返回
##### `(hex string)`

#### 错误

1. 签名错误
* 示例
```json
{
"code": -32000,
"message": "Rule Error : Rejected transaction c69ea9d7457379984d5a0af0568f296289ec791bbd522d2f6057924ed12b8089: failed to validate input c69ea9d7457379984d5a0af0568f296289ec791bbd522d2f6057924ed12b8089:0 which references output {cfd933e4590a3cfbcf94e9220c77834fe8a869414c51e3bd0ce5af23592e80f9 0} - verify failed (input script bytes 47304402203aa2f8bcfac55e76b84320a119dcd73955e2c644abe590b8ce99abaf7bf51f5902205e973da66669d80009d6f5d848dd0bed50abf1b69acd43eda02bdb6cfdd0157f012102e8d120c3c729e636fe2909b02c65c025cb7f3f57d9891f4f566dd4724e82eb92, prev output script bytes 76a914844d0a82845bccd469afc5cb78d8ffaa3142edea88ac)"
}

```

2. exceed high fee
* 示例
```json
{
"code": -32000,
"message": "Deserialization Error : rejected: failed to process transaction 0766b6dfd578952f52842cc4fb72f95f40258ee8aadff41897567a82c2b92e71: transaction 0766b6dfd578952f52842cc4fb72f95f40258ee8aadff41897567a82c2b92e71 has 420995400 fee which is above the allowHighFee check threshold amount of 20100000 (= 201 byte * 10000 AtomMEER/kB * 10000)"
}

```


#### 示例

##### 请求
```bash
curl -sku "test:test" -X POST -H 'Content-Type: application/json' --data '{"jsonrpc":"1.0","method":"sendRawTransaction","params":["0100000001f9802e5923afe50cbde3514c4169a8e84f83770c22e994cffb3c0a59e433d9cf01000000ffffffff01804a5d05000000001976a914a6b8fe2348fad076b7fd1b34b7e5b35db96dc2a088ac00000000000000001141cb5f016b483045022100b8ab0acf7f282e167669e3f20920c81b06554bc1fd5b41c4dd44ab4f3319a92f02200b664f920c77a7d8ac695380c22ec3131e2bd8f27617f84883fe9cf6d6bea0a1012102e8d120c3c729e636fe2909b02c65c025cb7f3f57d9891f4f566dd4724e82eb92", true],"id":1}' http://127.0.0.1:18131 | jq

```

sendRawTransaction 0100000001ff5d53a7070fa9f0a9d12af729d2cbaf355ef1173c106a84cf9ef3a46bff03b202000000ffffffff01005504790a0000001976a914627777996288556166614462639988446255776688ac000000000000000001000000000000000000000000ffffffff6b483045022100dced4d67dd74647d0036077ee5b435838934377b1d296dd9da852772911e3be2022063dd346bd812a894968b8acacead7e7beff48947657a82f1e8f9c38876d4c905012103aba0a09f5b44138a46a2e5d26b8659923d84c4ba9437e22c3828cac43d0edb49 true
##### 返回
```js
{
"jsonrpc": "2.0",
"id": 1,
"result": "0766b6dfd578952f52842cc4fb72f95f40258ee8aadff41897567a82c2b92e71"
}


```

53 changes: 53 additions & 0 deletions Document/content/JSON RPC API/sendRawTransaction/_index.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,56 @@
title: sendRawTransaction
weight: 3
---

### sendRawTransaction
send raw transactions

#### Parameters
1. `hexTx: (hex string)` hex string of signed transaction
2. `allowHighFees: (bool, default=false)` if allows high fee

#### Returns
##### `(hex string)`

#### Errors

1. Signature failed
* Example
```json
{
"code": -32000,
"message": "Rule Error : Rejected transaction c69ea9d7457379984d5a0af0568f296289ec791bbd522d2f6057924ed12b8089: failed to validate input c69ea9d7457379984d5a0af0568f296289ec791bbd522d2f6057924ed12b8089:0 which references output {cfd933e4590a3cfbcf94e9220c77834fe8a869414c51e3bd0ce5af23592e80f9 0} - verify failed (input script bytes 47304402203aa2f8bcfac55e76b84320a119dcd73955e2c644abe590b8ce99abaf7bf51f5902205e973da66669d80009d6f5d848dd0bed50abf1b69acd43eda02bdb6cfdd0157f012102e8d120c3c729e636fe2909b02c65c025cb7f3f57d9891f4f566dd4724e82eb92, prev output script bytes 76a914844d0a82845bccd469afc5cb78d8ffaa3142edea88ac)"
}

```

2. exceed high fee
* example
```json
{
"code": -32000,
"message": "Deserialization Error : rejected: failed to process transaction 0766b6dfd578952f52842cc4fb72f95f40258ee8aadff41897567a82c2b92e71: transaction 0766b6dfd578952f52842cc4fb72f95f40258ee8aadff41897567a82c2b92e71 has 420995400 fee which is above the allowHighFee check threshold amount of 20100000 (= 201 byte * 10000 AtomMEER/kB * 10000)"
}

```


#### Example

##### Request
```bash
curl -sku "test:test" -X POST -H 'Content-Type: application/json' --data '{"jsonrpc":"1.0","method":"sendRawTransaction","params":["0100000001f9802e5923afe50cbde3514c4169a8e84f83770c22e994cffb3c0a59e433d9cf01000000ffffffff01804a5d05000000001976a914a6b8fe2348fad076b7fd1b34b7e5b35db96dc2a088ac00000000000000001141cb5f016b483045022100b8ab0acf7f282e167669e3f20920c81b06554bc1fd5b41c4dd44ab4f3319a92f02200b664f920c77a7d8ac695380c22ec3131e2bd8f27617f84883fe9cf6d6bea0a1012102e8d120c3c729e636fe2909b02c65c025cb7f3f57d9891f4f566dd4724e82eb92", true],"id":1}' http://127.0.0.1:18131 | jq

```

##### Response
```js
{
"jsonrpc": "2.0",
"id": 1,
"result": "0766b6dfd578952f52842cc4fb72f95f40258ee8aadff41897567a82c2b92e71"
}


```

38 changes: 38 additions & 0 deletions Document/content/JSON RPC API/txSign/_index.en.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@

---
title: txSign
weight: 1
---

### test_txSign
sign raw transactions

#### Prerequisite
test module enabled
```sh
modules=test
```


#### Parameters
1. `privkeyStr: (hex string)` private key
2. `rawTxStr: (hex string)` raw transaction

#### Returns
##### `(array of string)` list of tip hashes

#### Example

##### Request
```bash
curl -sku "test:test" -X POST -H 'Content-Type: application/json' --data '{"jsonrpc":"1.0","method":"test_txSign","params":["ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", "0100000001f9802e5923afe50cbde3514c4169a8e84f83770c22e994cffb3c0a59e433d9cf01000000ffffffff01804a5d05000000001976a914a6b8fe2348fad076b7fd1b34b7e5b35db96dc2a088ac00000000000000001141cb5f0100"],"id":1}' http://127.0.0.1:18131 | jq
```

##### Response
```js
{
"jsonrpc": "2.0",
"id": 1,
"result": "0100000001f9802e5923afe50cbde3514c4169a8e84f83770c22e994cffb3c0a59e433d9cf01000000ffffffff01804a5d05000000001976a914a6b8fe2348fad076b7fd1b34b7e5b35db96dc2a088ac00000000000000001141cb5f016b483045022100b8ab0acf7f282e167669e3f20920c81b06554bc1fd5b41c4dd44ab4f3319a92f02200b664f920c77a7d8ac695380c22ec3131e2bd8f27617f84883fe9cf6d6bea0a1012102e8d120c3c729e636fe2909b02c65c025cb7f3f57d9891f4f566dd4724e82eb92"
}
```
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: createAccount
weight: 3
---

## ui_createAccount
## wallet_createAccount
creates the next account and returns its account number. The
name must be unique to the account. In order to support automatic seed
restoring, new accounts may not be created when all of the previous 100
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: createAddress
weight: 3
---

## ui_createAddress
## wallet_createAddress
returns the next external chained address for a wallet.

### Parameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ weight: 3
---

### wallet_dumpPrivKey
创建地址
导出地址的私钥

#### Parameters
1. `addr: (string)` 地址


#### Returns


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
title: dumpPrivKey
weight: 3
---

### wallet_dumpPrivKey
dump a single address private key

#### Parameters
1. `addr: (string)` address


#### Returns


#### Example
##### Request

```json
{"id":1574829854509,"method":"wallet_dumpPrivKey","params":["Tmh3je9zbnHAvPfwwHhQsFSJmKkeRTtKqmV"]}
```
##### Response
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: unlock
weight: 3
---

## Unlock
## wallet_unlock
unlocks the wallet's address manager and relocks it after timeout has
expired. If the wallet is already unlocked and the new passphrase is
correct, the current timeout is replaced with the new one. The wallet will
Expand Down

0 comments on commit 4534276

Please sign in to comment.