Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

R4R: Update English doc for record module #593

Merged
merged 2 commits into from
Nov 14, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 21 additions & 74 deletions docs/modules/record/README.md
Original file line number Diff line number Diff line change
@@ -1,85 +1,32 @@
# Record User Guide
# iriscli record

## Basic Function Description
## Description

1. On-Chain record for the text data
2. On-Chain record for the text file (TODO)
3. On-Chain governance for the record params (TODO)
Record allows you to submit, query and download your records on chain.

## Interaction Process

### Record process

1. Any users can initiate a record request. It will cost you some tokens. If there’s no record of the data on the existing chains, the request will be completed successfully and the relevant metadata will be recorded onchain. And you will be returned a record ID to confirm your ownership of the data.
2. If any others initiate a record request for the same data, the request will be directly rejected and it will hint that the relevant record data has already existed.
3. Any users can search/download onchain based on the record ID.
4. At present, the maximum amount of stored data at most 1K Bytes. In the future, the dynamic adjustment of parameters will be implemented in conjunction with the governance module.

## Usage Scenarios

### Build Usage Scenarios

```
rm -rf iris
rm -rf .iriscli
iris init gen-tx --name=x --home=iris
iris init --gen-txs --chain-id=record-test -o --home=iris
iris start --home=iris
```

### Usage Scenarios of Record on Chains

Scenario 1: Record the data through cli

```
# Specify the text data which needs to be recorded by --onchain-data

iriscli record submit --description="test" --onchain-data=x --from=x --fee=0.04iris

# Result
Committed at block 4 (tx hash: F649D5465A28842B50CAE1EE5950890E33379C45, response: {Code:0 Data:[114 101 99 111 114 100 58 97 98 57 100 57 57 100 48 99 102 102 54 53 51 100 99 54 101 56 53 52 53 99 56 99 99 55 50 101 53 53 51 51 100 101 97 97 97 49 50 53 53 50 53 52 97 100 102 100 54 98 48 48 55 52 101 50 56 54 57 54 54 49 98] Log:Msg 0: Info: GasWanted:200000 GasUsed:3857 Tags:[{Key:[97 99 116 105 111 110] Value:[115 117 98 109 105 116 45 114 101 99 111 114 100]} {Key:[111 119 110 101 114 65 100 100 114 101 115 115] Value:[102 97 97 49 109 57 51 99 103 57 54 51 56 121 115 104 116 116 100 109 119 54 57 97 121 118 51 103 106 53 102 116 116 109 108 120 51 99 102 121 107 109]} {Key:[114 101 99 111 114 100 45 105 100] Value:[114 101 99 111 114 100 58 97 98 57 100 57 57 100 48 99 102 102 54 53 51 100 99 54 101 56 53 52 53 99 56 99 99 55 50 101 53 53 51 51 100 101 97 97 97 49 50 53 53 50 53 52 97 100 102 100 54 98 48 48 55 52 101 50 56 54 57 54 54 49 98]} {Key:[99 111 109 112 108 101 116 101 67 111 110 115 117 109 101 100 84 120 70 101 101 45 105 114 105 115 45 97 116 116 111] Value:[2 189 149 142 250 208 0]}] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0})
{
"tags": {
"action": "submit-record",
"completeConsumedTxFee-iris-atto": "\u0002\ufffd\ufffd\ufffd\ufffd\ufffd\u0000",
"ownerAddress": "faa1m93cg9638yshttdmw69ayv3gj5fttmlx3cfykm",
"record-id": "record:ab9d99d0cff653dc6e8545c8cc72e5533deaaa1255254adfd6b0074e2869661b"
}
}

# Query the Status of the Records
iriscli record query --record-id=x

# Download the Record
iriscli record download --record-id=x --file-name="download"
## Usage

```shell
iriscli record [command]
```

Scenario 2: Query the transactions including recorded data onchain through cli
## Available Commands

```
# Query the status of the records onchain
iriscli tendermint txs --tag "action='submit-record'"
```
| Name | Description |
| ------------------------| --------------------------------------------------------------|
| [query](query.md) | Query specified record |
| [download](download.md) | Download related data with unique record ID to specified file |
| [submit](submit.md) | Submit a new record |

## Details of cli
## Flags

```
iriscli record submit --description="test" --onchain-data=x --chain-id="record-test" --from=x --fee=0.04iris
```
| Name, shorthand | Default | Description | Required |
| --------------- | ------- | --------------- | -------- |
| --help, -h | | help for record | |

* `--onchain-data` The data needs to be recorded


```
iriscli record query --record-id=x --chain-id="record-test"
```
## Extended description

* `--record-id` Record ID to be queried


```
iriscli record download --record-id=x --file-name="download" --chain-id="record-test"
```

* `--file-name` The filename of recorded data, in the directory specified by `--home`
1. Any users can initiate a record request. It will cost you some tokens. If there’s no record of the data on the existing chains, the request will be completed successfully and the relevant metadata will be recorded onchain. And you will be returned a record ID to confirm your ownership of the data.
2. If any others initiate a record request for the same data, the request will be directly rejected and it will hint that the relevant record data has already existed.
3. Any users can search/download on chain based on the record ID.
4. At present, the maximum amount of stored data at most 1K Bytes. In the future, the dynamic adjustment of parameters will be implemented in conjunction with the governance module.
40 changes: 40 additions & 0 deletions docs/modules/record/download.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# iriscli record download

## Description

Download related data with unique record ID to specified file

## Usage

```
iriscli record download [record ID] [flags]
```

## Flags

| Name, shorthand | Default | Description | Required |
| --------------- | -------------------------- | ----------------------------------------------------------------- | -------- |
| --chain-id | | [string] Chain ID of tendermint node | Yes |
| --file-name | | [string] Download file name | Yes |
| --height | most recent provable block | [int] block height to query | |
| --help, -h | | help for download | |
| --indent | | Add indent to JSON response | |
| --ledger | | Use a connected Ledger device | |
| --node | tcp://localhost:26657 | [string] \<host>:\<port> to tendermint rpc interface for this chain | |
| --record-id | | [string] record ID | |
| --trust-node | true | Don't verify proofs for responses | |

## Examples

### Download a record

```shell
iriscli record download --chain-id=test --record-id=MyRecordID --file-name="download.txt"
```

After that, you will get download file under iriscli home directory with the specfied record ID info.

```txt
[ONCHAIN] Downloading ~/.iriscli/download.txt from blockchain directly...
[ONCHAIN] Download file from blockchain complete.
```
46 changes: 46 additions & 0 deletions docs/modules/record/query.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# iriscli record query

## Description

Query details of the existing record

## Usage

```
iriscli record query [flags]
```

## Flags

| Name, shorthand | Default | Description | Required |
| --------------- | -------------------------- | ----------------------------------------------------------------- | -------- |
| --chain-id | | [string] Chain ID of tendermint node | Yes |
| --height | most recent provable block | block height to query | |
| --help, -h | | help for query | |
| --indent | | Add indent to JSON response | |
| --ledger | | Use a connected Ledger device | |
| --node | tcp://localhost:26657 | [string] \<host>:\<port> to tendermint rpc interface for this chain | |
| --record-id | | [string] Record ID for query | Yes |
| --trust-node | true | Don't verify proofs for responses | |

## Examples

### Query a record

```shell
iriscli record query --chain-id=test --record-id=MyRecordID
```

After that, you will get detail info for the record which has the specfied record ID.

```txt
{
"submit_time": "2018-11-13 15:31:36",
"owner_addr": "faa122uzzpugtrzs09nf3uh8xfjaza59xvf9rvthdl",
"record_id": "record:ab5602bac13f11737e8798dd57869c468194efad2db37625795f1efd8d9d63c6",
"description": "description",
"data_hash": "ab5602bac13f11737e8798dd57869c468194efad2db37625795f1efd8d9d63c6",
"data_size": "24",
"data": "this is my on chain data"
}
```
61 changes: 61 additions & 0 deletions docs/modules/record/submit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# iriscli record submit

## Description

Submit a record on chain

## Usage

```
iriscli record submit [flags]
```

## Flags

| Name, shorthand | Default | Description | Required |
| --------------- | -------------------------- | ------------------------------------------------------------------------------------------- | -------- |
| --account-number | | [int] AccountNumber number to sign the tx | |
| --async | | Broadcast transactions asynchronously | |
| --chain-id | | [string] Chain ID of tendermint node | Yes |
| --description | description | [string] Uploaded file description | |
| --dry-run | | Ignore the --gas flag and perform a simulation of a transaction, but don't broadcast it | |
| --fee | | [string] Fee to pay along with transaction | Yes |
| --from | | [string] Name of private key with which to sign | Yes |
| --from-addr | | [string] Specify from address in generate-only mode | |
| --gas string | 200000 | Gas limit to set per-transaction; set to "simulate" to calculate required gas automatically | |
| --gas-adjustment | 1 | [float] Adjustment factor to be multiplied against the estimate returned by the tx simulation; if the gas limit is set manually this flag is ignored | |
| --generate-only | | Build an unsigned transaction and write it to STDOUT | |
| -h, --help | | help for submit | |
| --indent | | Add indent to JSON response | |
| --json | | return output in json format | |
| --ledger | | Use a connected Ledger device | |
| --memo | | [string] Memo to send along with transaction | |
| --node | tcp://localhost:26657 | [string] \<host>:\<port> to tendermint rpc interface for this chain | |
| --onchain-data | | [string] on chain data source | Yes |
| --print-response | | return tx response (only works with async = false) | |
| --sequence | | [int] Sequence number to sign the tx | |
| --trust-node | true | Don't verify proofs for responses | |

## Examples

### Submit a record

```shell
iriscli record submit --chain-id="test" --onchain-data="this is my on chain data" --from=node0 --fee=0.1iris
```

After that, you're done with submitting a new record, but remember to back up your record id, it's the only way to retrieve your on chain record.

```txt
Password to sign with 'node0':
Committed at block 72 (tx hash: 7CCC8B4018D4447E6A496923944870E350A1A3AF9E15DB15B8943DAD7B5D782B, response: {Code:0 Data:[114 101 99 111 114 100 58 97 98 53 54 48 50 98 97 99 49 51 102 49 49 55 51 55 101 56 55 57 56 100 100 53 55 56 54 57 99 52 54 56 49 57 52 101 102 97 100 50 100 98 51 55 54 50 53 55 57 53 102 49 101 102 100 56 100 57 100 54 51 99 54] Log:Msg 0: Info: GasWanted:200000 GasUsed:4090 Tags:[{Key:[97 99 116 105 111 110] Value:[115 117 98 109 105 116 45 114 101 99 111 114 100] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0} {Key:[111 119 110 101 114 65 100 100 114 101 115 115] Value:[102 97 97 49 50 50 117 122 122 112 117 103 116 114 122 115 48 57 110 102 51 117 104 56 120 102 106 97 122 97 53 57 120 118 102 57 114 118 116 104 100 108] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0} {Key:[114 101 99 111 114 100 45 105 100] Value:[114 101 99 111 114 100 58 97 98 53 54 48 50 98 97 99 49 51 102 49 49 55 51 55 101 56 55 57 56 100 100 53 55 56 54 57 99 52 54 56 49 57 52 101 102 97 100 50 100 98 51 55 54 50 53 55 57 53 102 49 101 102 100 56 100 57 100 54 51 99 54] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0} {Key:[99 111 109 112 108 101 116 101 67 111 110 115 117 109 101 100 84 120 70 101 101 45 105 114 105 115 45 97 116 116 111] Value:[34 50 48 52 53 48 48 48 48 48 48 48 48 48 48 48 48 34] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0}] Codespace: XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0})
{
"tags": {
"action": "submit-record",
"completeConsumedTxFee-iris-atto": "\"2045000000000000\"",
"ownerAddress": "faa122uzzpugtrzs09nf3uh8xfjaza59xvf9rvthdl",
"record-id": "record:ab5602bac13f11737e8798dd57869c468194efad2db37625795f1efd8d9d63c6"
}
}
```