diff --git a/docs/cli-client/README.md b/docs/cli-client/README.md new file mode 100644 index 000000000..e69de29bb diff --git a/docs/cli-client/keys/README.md b/docs/cli-client/keys/README.md new file mode 100644 index 000000000..410208962 --- /dev/null +++ b/docs/cli-client/keys/README.md @@ -0,0 +1,30 @@ +# iriscli keys + +## Description + +Keys allows you to manage your local keystore for tendermint. + +## Usage + +```shell +iriscli keys [command] +``` + +## Available Commands + +| Name | Description | +| ------------- | ------------------------------------- | +| [add](add.md) | Create a new key, or import from seed | +| list | List all keys | +| show | Show key info for the given name | +| delete | Delete the given key | + +## Flags + +| Name, shorthand | Default | Description | Required | +| --------------- | ------- | ------------- | -------- | +| --help, -h | | help for keys | | + +## Extended description + +These keys may be in any format supported by go-crypto and can be used by light-clients, full nodes, or any other application that needs to sign with a private key. diff --git a/docs/cli-client/keys/add.md b/docs/cli-client/keys/add.md new file mode 100644 index 000000000..2174b8c7c --- /dev/null +++ b/docs/cli-client/keys/add.md @@ -0,0 +1,69 @@ +# iriscli keys add + +## Description + +Create a new key, or import from seed + +## Usage + +``` +iriscli keys add [flags] +``` + +## Flags + +| Name, shorthand | Default | Description | Required | +| --------------- | --------- | ------------------------------------------------------------ | -------- | +| --account | | [uint32] Account number for HD derivation | | +| --dry-run | | Perform action, but don't add key to local keystore | | +| --help, -h | | help for add | | +| --index | | [uint32] Index number for HD derivation | | +| --ledger | | Store a local reference to a private key on a Ledger device | | +| --no-backup | | Don't print out seed phrase (if others are watching the terminal) | | +| --recover | | Provide seed phrase to recover existing key instead of creating | | +| --type, -t | secp256k1 | [string] Type of private key (secp256k\|ed25519) | | + +## Examples + +### Create a new key + +```shell +iriscli keys add MyKey +``` + +You'll be asked to enter a password for your key, note: password must be at least 8 characters. + +```txt +Enter a passphrase for your key: +Repeat the passphrase: +``` + +After that, you're done with creating a new key, but remember to backup your seed phrase, it is the only way to recover your account if you ever forget your password or lose your key. + +```txt +NAME: TYPE: ADDRESS: PUBKEY: +MyKey local faa1mmsm487rqkgktl2qgrjad0z3yaf9n8t5pkp33m fap1addwnpepq2g0u7cnxp5ew0yhqep8j4rth5ugq8ky7gjmunk8tkpze95ss23ak4svkjq +**Important** write this seed phrase in a safe place. +It is the only way to recover your account if you ever forget your password. + +oval green shrug term already arena pilot spirit jump gain useful symbol hover grid item concert kiss zero bleak farm capable peanut snack basket +``` + +The 24 words above is a seed phrase just for example, **DO NOT** use it in production. + +### Recover an existing key + +If you forget your password or lose your key, or you wanna use your key in another place, you can recover your key by your seed phrase. + +```txt +iriscli keys add MyKey --recover +``` + +You'll be asked to enter a new password for your key, and enter the seed phrase. Then you get your key back. + +```txt +Enter a passphrase for your key: +Repeat the passphrase: +Enter your recovery seed phrase: +``` + diff --git a/docs/features/bank.md b/docs/features/bank.md new file mode 100644 index 000000000..e69de29bb diff --git a/docs/features/distribution.md b/docs/features/distribution.md new file mode 100644 index 000000000..e69de29bb diff --git a/docs/features/governance.md b/docs/features/governance.md new file mode 100644 index 000000000..7961541cc --- /dev/null +++ b/docs/features/governance.md @@ -0,0 +1,260 @@ +# Gov/Iparam User Guide + +## Basic Function Description + +1. On-chain governance proposals on text +2. On-chain governance proposals on parameter change +3. On-chain governance proposals on software upgrade + +## Interactive process + +### governance process + +1. Any users can deposit some tokens to initiate a proposal. Once deposit reaches a certain value `min_deposit`, enter voting period, otherwise it will remain in the deposit period. Others can deposit the proposals on the deposit period. Once the sum of the deposit reaches `min_deposit`, enter voting period. However, if the block-time exceeds `max_deposit_period` in the deposit period, the proposal will be closed. +2. The proposals which enter voting period only can be voted by validators and delegators. The vote of a delegator who hasn't vote will be the same as his validator's vote, and the vote of a delegator who has voted will be remained. The votes wil be tallyed when reach `voting_period'. +3. More details about voting for proposals: +[CosmosSDK-Gov-spec](https://github.com/cosmos/cosmos-sdk/blob/develop/docs/spec/governance/overview.md) + +## Usage Scenario +### Create an environment + +``` +rm -rf iris +rm -rf .iriscli +iris init gen-tx --name=x --home=iris +iris init --gen-txs --chain-id=gov-test -o --home=iris +iris start --home=iris +``` + +### Usage scenario of parameter change + +Scenario 1:Change the parameters through the command lines + +``` +# Query parameters can be changed by the modules'name in gov +iriscli gov query-params --module=gov --trust-node + +# Results +[ + "Gov/gov/DepositProcedure", + "Gov/gov/TallyingProcedure", + "Gov/gov/VotingProcedure" +] + +# Query parameters can be modified by "key” +iriscli gov query-params --key=Gov/gov/DepositProcedure --trust-node + +# Results +{"key":"Gov/gov/DepositProcedure","value":"{\"min_deposit\":[{\"denom\":\"iris-atto\",\"amount\":\"10000000000000000000\"}],\"max_deposit_period\":10}","op":""} + +# Send proposals, return changed parameters +echo 1234567890 | iriscli gov submit-proposal --title="update MinDeposit" --description="test" --type="ParameterChange" --deposit="10iris" --param='{"key":"Gov/gov/DepositProcedure","value":"{\"min_deposit\":[{\"denom\":\"iris-atto\",\"amount\":\"10000000000000000000\"}],\"max_deposit_period\":20}","op":"update"}' --from=x --chain-id=gov-test --fee=0.05iris --gas=20000 + +# Deposit for a proposal +echo 1234567890 | iriscli gov deposit --proposal-id=1 --deposit=1iris --from=x --chain-id=gov-test --fee=0.05iris --gas=20000 + +# Vote for a proposal +echo 1234567890 | iriscli gov vote --proposal-id=1 --option=Yes --from=x --chain-id=gov-test --fee=0.05iris --gas=20000 + +# Query the state of a proposal +iriscli gov query-proposal --proposal-id=1 --trust-node + +``` + +Scenario 2: Change the parameters by the files + +``` +# Export profiles +iriscli gov pull-params --path=iris --trust-node + +# Query profiles' info +cat iris/config/params.json +{ + "gov": { + "Gov/gov/DepositProcedure": { + "min_deposit": [ + { + "denom": "iris-atto", + "amount": "10000000000000000000" + } + ], + "max_deposit_period": "10" + }, + "Gov/gov/VotingProcedure": { + "voting_period": "10" + }, + "Gov/gov/TallyingProcedure": { + "threshold": "1/2", + "veto": "1/3", + "governance_penalty": "1/100" + } + } +} +# Modify profiles (TallyingProcedure的governance_penalty) +vi iris/config/params.json +{ + "gov": { + "Gov/gov/DepositProcedure": { + "min_deposit": [ + { + "denom": "iris-atto", + "amount": "10000000000000000000" + } + ], + "max_deposit_period": "10" + }, + "Gov/gov/VotingProcedure": { + "voting_period": "10" + }, + "Gov/gov/TallyingProcedure": { + "threshold": "1/2", + "veto": "1/3", + "governance_penalty": "20/100" + } + } +} + +# Change the parameters through files, return changed parameters +echo 1234567890 | iriscli gov submit-proposal --title="update MinDeposit" --description="test" --type="ParameterChange" --deposit="10iris" --path=iris --key=Gov/gov/TallyingProcedure --op=update --from=x --chain-id=gov-test --fee=0.05iris --gas=20000 + +# Deposit for a proposal +echo 1234567890 | iriscli gov deposit --proposal-id=1 --deposit=1iris --from=x --chain-id=gov-test --fee=0.05iris --gas=20000 + +# Vote for a proposal +echo 1234567890 | iriscli gov vote --proposal-id=1 --option=Yes --from=x --chain-id=gov-test --fee=0.05iris --gas=20000 + +# Query the state of a proposal +iriscli gov query-proposal --proposal-id=1 --trust-node +``` + +## CLI Command Details + +### Basic method of gov modules + +``` +# Text proposals +iriscli gov submit-proposal --title="update MinDeposit" --description="test" --type="Text" --deposit="10iris" --from=x --chain-id=gov-test --fee=0.05iris --gas=20000 +``` + +* `--title` The title of a proposal +* `--description` The description of a proposal +* `--type` The type of a proposal {'Text','ParameterChange','SoftwareUpgrade'} +* `--deposit` The number of the tokens deposited +* The basic text proposals are as below + +``` +iriscli gov deposit --proposal-id=1 --deposit=1iris --from=x --chain-id=gov-test --fee=0.05iris --gas=20000 +``` + +* `--propsal-id` The ID of the proposal deposited +* `--deposit` The number of the tokens deposited + +``` +iriscli gov vote --proposal-id=1 --option=Yes --from=x --chain-id=gov-test --fee=0.05iris --gas=20000 +``` + +* `--proposal-id` The ID of the proposal in voting period +* `--option` Vote option{'Yes'-agree,'Abstain'-abstain,'No'-disagree,'nowithVeto'-strongly disagree } + + +``` +# Query the state of a proposal +iriscli gov query-proposal --proposal-id=1 --trust-node +``` + +* `--proposal-id` Query the ID of a proposal + + + +### The proposals on parameters modification + +``` +# Query parameters can be modified by the modules'name in gov +iriscli gov query-params --module=gov --trust-node +``` + +* `--module` Query the list of "key" of the parameters can be changed in the module + + +``` +# Query the parameters can be modified by "key" +iriscli gov query-params --key=Gov/gov/DepositProcedure --trust-node +``` + +* `--key` Query the parameter corresponding to the "key" + +``` +# Export profiles +iriscli gov pull-params --path=iris --trust-node +``` + +* `--path` The folder of node initialization + + + +``` +# Modify the parameters through the command lines +iriscli gov submit-proposal --title="update MinDeposit" --description="test" --type="ParameterChange" --deposit="10iris" --param='{"key":"Gov/gov/DepositProcedure","value":"{\"min_deposit\":[{\"denom\":\"iris-atto\",\"amount\":\"10000000000000000000\"}],\"max_deposit_period\":20}","op":"update"}' --from=x --chain-id=gov-test --fee=0.05iris --gas=20000 +``` + +* `--param` The details of changed parameters (get parameters through query-params, modify it and then add "update" on the "op", more details in usage scenarios) +* Other fields' proposals are similar with text proposal + +``` +# Change the parameters through files, return modified parameters +echo 1234567890 | iriscli gov submit-proposal --title="update MinDeposit" --description="test" --type="ParameterChange" --deposit="10iris" --path=iris --key=Gov/gov/TallyingProcedure --op=update --from=x --chain-id=gov-test --fee=0.05iris --gas=20000 +``` + +* `--path` The folder of node initialization +* `--key` The key of the parameter to be modified +* `--op` The type of changed parameters; only 'update' is implemented at present +* Other fields' proposals are similar with text proposal + +### Proposals on software upgrade + +## Basic parameters + +``` +# DepositProcedure(The parameters in deposit period) +"Gov/gov/DepositProcedure": { + "min_deposit": [ + { + "denom": "iris-atto", + "amount": "10000000000000000000" + } + ], + "max_deposit_period": "10" +} +``` + +* Parameters can be changed +* The key of parameters:"Gov/gov/DepositProcedure" +* `min_deposit[0].denom` The minimum tokens deposited are counted by iris-atto. +* `min_deposit[0].amount` The number of minimum tokens and the default scope:10iris,(1iris,200iris) +* `max_deposit_period` Window period for repaying deposit, default :10, scope(0,1) + +``` +# VotingProcedure(The parameters in voting period) +"Gov/gov/VotingProcedure": { + "voting_period": "10" +}, +``` + +* Parameters can be changed +* `voting_perid` Window period for vote, default:10, scope(20,20000) + +``` +# TallyingProcedure (The parameters in Tallying period) +"Gov/gov/TallyingProcedure": { + "threshold": "1/2", + "veto": "1/3", + "governance_penalty": "1/100" +} +``` + +* Parameters can be changed +* `veto` default: 1/3, scope(0,1) +* `threshold` default 1/2, scope(0,1) +* `governance_penalty` The default ratio of slashing tokens of validators who didn't vote: 1/100, scope(0,1) +* Vote rules: If the ratio of voting power of "strongly disagree" over "veto", the proposal won't be passed. If the ratio of voting_power of "agree" over "veto", the proposal won't be passed. Otherwise, it will be passed. + diff --git a/docs/features/iservice/README.md b/docs/features/iservice/README.md new file mode 100644 index 000000000..6ee46fffa --- /dev/null +++ b/docs/features/iservice/README.md @@ -0,0 +1,168 @@ +# IService User Guide + +## Basic Function Description +IRIS Services (a.k.a. "iServices") intend to bridge the gap between the blockchain world and the conventional business application world, by mediating a complete lifecycle of off-chain services -- from their definition, binding (provider registration), invocation, to their governance (profiling and dispute resolution). By enhancing the IBC processing logic to support service semantics, the IRIS SDK is intended to allow distributed business services to be available across the internet of blockchains. The [Interface description language](https://en.wikipedia.org/wiki/Interface_description_language) (IDL) we introduced is +to work with the service standardized definitions to satisfy service invocations across different programming languages. +The currently supported IDL language is [protobuf](https://developers.google.com/protocol-buffers/). The main functions of this module are as follows: +1. Service Definition +2. Service Binding +3. Service Invocation (TODO) +4. Dispute Resolution (TODO) +5. Service Analysis (TODO) + +## Interactive process + +### Service definition process + +1. Any users can define a service. In service definition,use `protobuf` to standardize the definition of the service's method, its input and output parameters. + +## Usage Scenario +### Create an environment + +``` +rm -rf iris +rm -rf .iriscli +iris init gen-tx --name=x --home=iris +iris init --gen-txs --chain-id=service-test -o --home=iris +iris start --home=iris +``` + +### Service Definition + +``` +# Service definition +iriscli iservice define --chain-id=service-test --from=x --fee=0.004iris --service-name=test-service --service-description=service-description --author-description=author-description --tags tag1,tag2 --messaging=Unicast --idl-content= --file=test.proto + +# Result +Committed at block 92 (tx hash: A63241AA6666B8CFE6B1C092B707AB0FA350F108, response: {Code:0 Data:[] Log:Msg 0: Info: GasWanted:200000 GasUsed:8007 Tags:[{Key:[97 99 116 105 111 110] Value:[115 101 114 118 105 99 101 45 100 101 102 105 110 101]} {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:[49 54 48 49 52 48 48 48 48 48 48 48 48 48 48]}] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0}) +{ + "tags": { + "action": "service-define", + "completeConsumedTxFee-iris-atto": "160140000000000" + } +} + +# Query service definition +iriscli iservice definition --def-chain-id=service-test --service-name=test-service + +``` + +### Service Binding +``` +# Service Binding +iriscli iservice bind --chain-id=service-test --from=x --fee=0.004iris --service-name=test-service --def-chain-id=service-test --bind-type=Local --deposit=1iris --prices=1iris --avg-rsp-time=10000 --usable-time=100 --expiration=-1 + +# Result +Committed at block 168 (tx hash: 02CAC60E75CD93465CAE10CE35F30B53C8A95574, response: {Code:0 Data:[] Log:Msg 0: Info: GasWanted:200000 GasUsed:5437 Tags:[{Key:[97 99 116 105 111 110] Value:[115 101 114 118 105 99 101 45 98 105 110 100]} {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:[49 48 56 55 52 48 48 48 48 48 48 48 48 48 48]}] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0}) +{ + "tags": { + "action": "service-bind", + "completeConsumedTxFee-iris-atto": "108740000000000" + } +} + +# Query service binding +iriscli iservice binding --def-chain-id=service-test --service-name=test-service --bind-chain-id=service-test --provider= + +# Query service binding list +iriscli iservice bindings --def-chain-id=service-test --service-name=test-service + +# Service binding update +iriscli iservice update-binding --chain-id=service-test --from=x --fee=0.004iris --service-name=test-service --def-chain-id=service-test --bind-type=Local --deposit=1iris --prices=1iris,2iris --avg-rsp-time=10000 --usable-time=100 --expiration=-1 + +# Result +Committed at block 233 (tx hash: 2F5F44BAF09981D137EA667F9E872EB098A9B619, response: {Code:0 Data:[] Log:Msg 0: Info: GasWanted:200000 GasUsed:4989 Tags:[{Key:[97 99 116 105 111 110] Value:[115 101 114 118 105 99 101 45 98 105 110 100 105 110 103 45 117 112 100 97 116 101]} {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:[57 57 55 56 48 48 48 48 48 48 48 48 48 48]}] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0}) +{ + "tags": { + "action": "service-binding-update", + "completeConsumedTxFee-iris-atto": "99780000000000" + } +} + +# Refund Deposit +iriscli iservice refund-deposit --chain-id=service-test --from=x --fee=0.004iris --def-chain-id=service-test --service-name=test-service + +# Result +Committed at block 1563 (tx hash: 748CEA6EA9DEFB384FFCFBE68A3CB6D8B643361B, response: {Code:0 Data:[] Log:Msg 0: Info: GasWanted:200000 GasUsed:5116 Tags:[{Key:[97 99 116 105 111 110] Value:[115 101 114 118 105 99 101 45 114 101 102 117 110 100 45 100 101 112 111 115 105 116]} {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:[49 48 50 51 50 48 48 48 48 48 48 48 48 48 48]}] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0}) +{ + "tags": { + "action": "service-refund-deposit", + "completeConsumedTxFee-iris-atto": "102320000000000" + } +} +``` + +## CLI Command Details + +``` +iriscli iservice define --chain-id=service-test --from=x --fee=0.004iris --service-name=test-service --service-description=service-description --author-description=author-description --tags "tag1 tag2" --messaging=Unicast --idl-content= --file=test.proto +``` +* `--service-name` The name of iService +* `--service-description` The description of this iService +* `--author-description` The self-description of the iService creator which is optional +* `--tags` The keywords of this iService +* `--messaging` The transfer type of this iService{`Unicast`,`Multicast`} +* `--idl-content` The standardized definition of the methods for this iService +* `--file` Idl-content can be replaced by files,if the item is not empty. + +``` +iriscli iservice definition --def-chain-id=service-test --service-name=test-service +``` +* `--def-chain-id` The ID of the blockchain defined of the iService +* `--service-name` The name of iService + +``` +iriscli iservice bind --chain-id=service-test --from=x --fee=0.004iris --service-name=test-service --def-chain-id=service-test --bind-type=Local --deposit=1iris --prices=1iris --avg-rsp-time=10000 --usable-time=100 --expiration=-1 +``` +* `--def-chain-id` The ID of the blockchain defined of the iService +* `--service-name` The name of iService +* `--bind-type` Set whether the service is local or global +* `--deposit` The deposit of service provider +* `--prices` Service prices, a list sorted by service method +* `--avg-rsp-time` The average service response time in milliseconds +* `--usable-time` An integer represents the number of usable service invocations per 10,000 +* `--expiration` Negative number used here means the unbonded blockchain height "never expire" + +``` +iriscli iservice binding --def-chain-id=service-test --service-name=test-service --bind-chain-id=service-test --provider= +``` +* `--def-chain-id` The ID of the blockchain defined of the iService +* `--service-name` The name of iService +* `--bind-chain-id` The ID of the blockchain bound of the iService +* `--provider` The blockchain address of bech32 encoded account + +``` +iriscli iservice bindings --def-chain-id=service-test --service-name=test-service +``` +* Refer to iriscli iservice binding + +``` +iriscli iservice update-binding --chain-id=service-test --from=x --fee=0.004iris --service-name=test-service --def-chain-id=service-test --bind-type=Local --deposit=1iris --prices=1iris,2iris --avg-rsp-time=10000 --usable-time=100 --expiration=-1 +``` +* Refer to iriscli iservice bind + +``` +iriscli iservice refund-deposit --chain-id=service-test --from=x --fee=0.004iris --def-chain-id=service-test --service-name=test-service +``` +* `--def-chain-id` The ID of the blockchain defined of the iService +* `--service-name` The name of iService + +## IDL extension +When using proto file to standardize the definition of the service's method, its input and output parameters, the method attributes can be added through annotations. + +### Annotation standard +* If `//@Attribute attribute: value` wrote on top of `rpc method`,it will be added to the method attributes. Eg. +> //@Attribute description: sayHello + +### Currently supported attributes +* `description` The name of this method in the iService +* `output_privacy` Whether the output of the method is encrypted,{`NoPrivacy`,`PubKeyEncryption`} +* `output_cached` Whether the output of the method is cached,{`OffChainCached`,`NoCached`} + +### IDL content example +* idl-content example +> syntax = \"proto3\";\n\npackage helloworld;\n\n// The greeting service definition.\nservice Greeter {\n //@Attribute description: sayHello\n //@Attribute output_privacy: NoPrivacy\n //@Attribute output_cached: NoCached\n rpc SayHello (HelloRequest) returns (HelloReply) {}\n}\n\n// The request message containing the user's name.\nmessage HelloRequest {\n string name = 1;\n}\n\n// The response message containing the greetings\nmessage HelloReply {\n string message = 1;\n}\n + +* IDL file example + +[test.proto](./test.proto) diff --git a/docs/features/iservice/test.proto b/docs/features/iservice/test.proto new file mode 100644 index 000000000..ccb70ab00 --- /dev/null +++ b/docs/features/iservice/test.proto @@ -0,0 +1,21 @@ +syntax = "proto3"; + +package helloworld; + +// The greeting service definition. +service Greeter { + //@Attribute description: sayHello + //@Attribute output_privacy: NoPrivacy + //@Attribute output_cached: NoCached + rpc SayHello (HelloRequest) returns (HelloReply) {} +} + +// The request message containing the user's name. +message HelloRequest { + string name = 1; +} + +// The response message containing the greetings +message HelloReply { + string message = 1; +} diff --git a/docs/features/record.md b/docs/features/record.md new file mode 100644 index 000000000..a7ea515fe --- /dev/null +++ b/docs/features/record.md @@ -0,0 +1,85 @@ +# Record User Guide + +## Basic Function 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) + +## 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" + +``` + +Scenario 2: Query the transactions including recorded data onchain through cli + +``` +# Query the status of the records onchain +iriscli tendermint txs --tag "action='submit-record'" +``` + +## Details of cli + +``` +iriscli record submit --description="test" --onchain-data=x --chain-id="record-test" --from=x --fee=0.04iris +``` + +* `--onchain-data` The data needs to be recorded + + +``` +iriscli record query --record-id=x --chain-id="record-test" +``` + +* `--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` diff --git a/docs/features/stake.md b/docs/features/stake.md new file mode 100644 index 000000000..2189c8edd --- /dev/null +++ b/docs/features/stake.md @@ -0,0 +1,94 @@ +# Delegators + +## What is a delegator? +People that cannot, or do not want to run validator operations, can still participate in the staking process as delegators. Indeed, validators are not chosen based on their own stake +but based on their total stake, which is the sum of their own stake and of the stake that is delegated to them. This is an important property, as it makes delegators a safeguard against + validators that exhibit bad behavior. If a validator misbehaves, its delegators will move their Atoms away from it, thereby reducing its stake. Eventually, if a validator's stake falls + under the top 100 addresses with highest stake, it will exit the validator set. + +## States for a Delegator + +Delegators have the same state as their validator. + + +Note that delegation are not necessarily bonded. Tokens of each delegator can be delegated and bonded, delegated and unbonding, delegated and unbonded, or loose. + +## Common operation for Delegators + +* Delegation + +To delegate some IRIS token to a validator, you could run the following command: +```$xslt +iriscli stake delegate --address-delegator= --address-validator= --chain-id=fuxi-3001 --from=name --gas=2000000 --fee=40000000000000000iris --amount=10000000000000000000iris +``` +> Please notice that the amount is under unit iris-atto, 1iris=10^18 iris-atto + +* Query Delegations + +You could query your delegation amount with the following command: + +```$xslt +iriscli stake delegation --address-delegator= --address-validator= --chain-id=fuxi-3001 +``` + +The example output is the following: +```$xslt +Delegation +Delegator: faa1je9qyff4qate4e0kthum0p8v7q7z8lr7eczsv6 +Validator: faa1dmp6eyjw94u0wzc67qa03cmgl92qwqaph28lxq +Shares: 10000000000000000000/1Height: 215307 +``` + +> Please notice that the share amount is also correspond to iris-atto, 1iris=10^18 iris-atto + + +* Re-delegate + +Once a delegator has delegated his own IRIS to certain validator, he/she could change the destination of delegation at anytime. If the transaction is executed, the +delegation will be placed at the other's pool after 10 minutes. + +The redelegation operation is composed of two phases: + * redelegate begin + * redelegate complete + + To start, you should run the following command: +```$xslt +iriscli stake redelegate begin --addr-validator-dest= --addr-validator-source= --address-delegator= --chain-id=fuxi-3001 --from=name --gas=2000000 --fee=40000000000000000iris --shares-percent=1.0 +``` + +Please note that you have to wait 10 minute to run the next command: + +```$xslt +iriscli stake redelegate complete --addr-validator-dest= --addr-validator-source= --address-delegator= --chain-id=fuxi-3001 --from=name --gas=2000000 --fee=40000000000000000iris +``` + +The example output is the following: +```$xslt +Delegation +Delegator: faa1je9qyff4qate4e0kthum0p8v7q7z8lr7eczsv6 +Validator: faa1kepndxvjr6gnc8tjcnelp9hqz8jdcs8mvz7m86 +Shares: 10000000000000000000/1Height: 215459 +``` + +* Unbond Delegation + + +Once a delegator has delegated his own IRIS to certain validator, he/she could withdraw the delegation at anytime. If the transaction is executed, the +delegation will become liquid after 10 minutes. + +The redelegation operation is composed of two phases: + * unbond begin + * unbond complete + + To start, you should run the following command: +```$xslt +iriscli stake unbond begin --address-validator= --address-delegator= --chain-id=fuxi-3001 --from=name --gas=2000000 --fee=40000000000000000iris --shares-percent=1.0 +``` + +Please note that you have to wait 10 minute to run the next command: + +```$xslt +iriscli stake unbond complete --address-validator= --address-delegator= --chain-id=fuxi-3001 --from=name --gas=2000000 --fee=40000000000000000iris +``` + +You could check that the balance of delegator has increased. \ No newline at end of file diff --git a/docs/features/upgrade.md b/docs/features/upgrade.md new file mode 100644 index 000000000..06a1035b8 --- /dev/null +++ b/docs/features/upgrade.md @@ -0,0 +1,113 @@ +# Software Upgrade User Guide + +## Basic Function Description + +The module supports the infrastructure of the blockchain software upgrade. It will be upgraded to the new version through voting at UpgradeProposal and switch stage within specific time, and is fully compatible with the historical data on the blockchain. + +## Interaction Process + +### Governance process of software upgrade proposal +1. Submit a software upgrade proposal +2. More details about governance process is in GOV [User Guide](../gov/README.md) + +### The process of software upgrade +1. Install a new software, send a switch message, and broadcast to the whole network. +2. Once reach the limited time, it will be counted whether the proportion of voting power of upgraded software exceeds 95%. +3. If it exceeds 95%, the software will be upgraded, otherwise the upgrade fails. +4. The validators who didn't upgrade in time need to re-download the new software and blocks synchronized. + +## Usage Scenarios + +### Create an environment + +``` +rm -rf iris +rm -rf .iriscli +iris init gen-tx --name=x --home=iris +iris init --gen-txs --chain-id=upgrade-test -o --home=iris +iris start --home=iris +``` + +### Submit a software upgrade proposal + +``` +# Send an upgrade proposal +iriscli gov submit-proposal --title=Upgrade --description="SoftwareUpgrade" --type="SoftwareUpgrade" --deposit=10iris --from=x --chain-id=upgrade-test --fee=0.05iris --gas=20000 + +# Deposit for a proposal +iriscli gov deposit --proposal-id=1 --deposit=1iris --from=x --chain-id=upgrade-test --fee=0.05iris --gas=20000 + +# Vote for a proposal +iriscli gov vote --proposal-id=1 --option=Yes --from=x --chain-id=upgrade-test --fee=0.05iris --gas=20000 + +# Query the state of a proposal +iriscli gov query-proposal --proposal-id=1 --trust-node +``` + +### Upgrade software + +* Scenario 1 + +Implement following operations within limited time(2days, 57600 block height): + +``` +# 1. Download the new version:iris1 + +# 2. Close the old one +kill -f iris + +# 3. Install the new version,iris1 and start it(copy to bin) +iris1 start --home=iris + +# 4. Send a switch message, and broadcast to the whole network that the new software has been installed. +iriscli1 upgrade submit-switch --from=x --proposalID=1 --chain-id=upgrade-test --fee=0.05iris --gas=20000 + +# 5. Upgrade automatically when reach the preset time + +# 6. Query whether the current version has been successfully upgraded +iriscli upgrade info --trust-node +``` + +* Scenario 2 + +The operations in Scenario 1 haven't been implemented in the limited time (2 days, 57600 block height), report errors after the new version become valid: + +``` +# 1. Download the new version, iris1 + +# 2. Close the old one +kill -f iris + +# 3. Install the new version, iris1 and start it with following command lines(copy to bin) +iris1 start --replay --home=iris + +# 4. Query whether the current version has been successfully upgraded +iriscli upgrade info --trust-node +``` + +## Command details + +``` +iriscli gov submit-proposal --title=Upgrade --description="SoftwareUpgrade" --type="SoftwareUpgrade" --deposit=10iris --from=x --chain-id=upgrade-test --fee=0.05iris --gas=20000 +``` + +* `--type` "SoftwareUpgrade" The type of Software upgrade proposals +* Other parameters can be referrenced in [Gov User Guide](../gov/README.md) + +``` +iriscli upgrade submit-switch --name=x --from=$VADDR --proposalID=1 --chain-id=upgrade-test --fee=0.05iris --gas=20000 +``` + +* `--proposalID` The ID of passed software upgrade proposals + +``` +iris start --replay +``` + +* Resynchronize the block, clean the dirty AppHash + +``` +iriscli upgrade info --trust-node +``` + +* Query the version details of current software diff --git a/docs/light-client/README.md b/docs/light-client/README.md new file mode 100644 index 000000000..e69de29bb diff --git a/docs/resources/README.md b/docs/resources/README.md new file mode 100644 index 000000000..e69de29bb diff --git a/docs/software/basic-concepts/bech32-prefix.md b/docs/software/basic-concepts/bech32-prefix.md new file mode 100644 index 000000000..e69de29bb diff --git a/docs/software/basic-concepts/key-types/coin-type.md b/docs/software/basic-concepts/key-types/coin-type.md new file mode 100644 index 000000000..3656537eb --- /dev/null +++ b/docs/software/basic-concepts/key-types/coin-type.md @@ -0,0 +1,111 @@ +# Coin_Type + +## Definitions + +Coin_type defines the available units of a kind of token in IRISnet. The developers can specify different coin_type for their tokens. The native token in IRIShub is `iris`, which has following available units: `iris-milli`, `iris-micro`, `iris-nano`, `iris-pico`, `iris-femto` and `iris-atto`. The conversion relationship between them are as follows: + +``` +1 iris = 10^3 iris-milli +1 iris = 10^6 iris-micro +1 iris = 10^9 iris-nano +1 iris = 10^12 iris-pico +1 iris = 10^15 iris-femto +1 iris = 10^18 iris-atto +``` + +All the registered types of `iris` in the system can be used with transactions. + +## Data Structure of coin_type + +```golang +type CoinType struct { + Name string `json:"name"` + MinUnit Unit `json:"min_unit"` + Units Units `json:"units"` + Origin Origin `json:"origin"` + Desc string `json:"desc"` +} +``` + +## Structure definition of Unit + +```golang +type Unit struct { + Denom string `json:"denom"` + Decimal int `json:"decimal"` +} +``` + +* Name : The name of a token, which is also its default unit;for instance,the default unit of `iris` is `iris`. +* MinUnit:The minimum unit of coin_type. + +The tokens in the system are all stored in the form of minimum unit, +such as `iris-atto`. You could choose to use the minimum unit of the tokens when sending a transaction to the IRIShub. +If you use the command line client, aka `iriscli`, you can use any system-recognized unit and the system +will automatically convert to the minimum unit of this corresponding token. For example, if you execute `send`command +to transfer 1iris, the command line will be processed as 10^18 iris-attos in the backend, and you will only +see 10^18 `iris-attos` when searching the transaction details by transaction hash. + + + +`Denom` is defined as the name of this unit, and `Decimal` is defined as the precision of the unit. + +For example, the precision of iris-atto is 18. + +* `Unit` defines a set of units available under coin_type. +* `Origin` defines the source of the coin_type, with the value `Native` (inner system, iris for IRIShub), +`External` (external system, such as eth for Ethereum, etc.), and `UserIssued` (user-defined). +* `Desc`:Description of the coin_type. + +## Query of coin_type + +If you want to query the coin_type configuration of a certain token, you can use the following command: + +```golang +iriscli bank coin-type [coin_name] +``` + +If you query the `coin-type` of `iris` with `iriscli bank coin-type iris` + +Example output: +```$xslt +{ + "name": "iris", + "min_unit": { + "denom": "iris-atto", + "decimal": "18" + }, + "units": [ + { + "denom": "iris", + "decimal": "0" + }, + { + "denom": "iris-milli", + "decimal": "3" + }, + { + "denom": "iris-micro", + "decimal": "6" + }, + { + "denom": "iris-nano", + "decimal": "9" + }, + { + "denom": "iris-pico", + "decimal": "12" + }, + { + "denom": "iris-femto", + "decimal": "15" + }, + { + "denom": "iris-atto", + "decimal": "18" + } + ], + "origin": 1, + "desc": "IRIS Network" +} +``` \ No newline at end of file diff --git a/docs/software/basic-concepts/key-types/fee.md b/docs/software/basic-concepts/key-types/fee.md new file mode 100644 index 000000000..64b2587f2 --- /dev/null +++ b/docs/software/basic-concepts/key-types/fee.md @@ -0,0 +1,23 @@ +# Introduction + +Specify the maximum fee you want to pay by `--fee`. Gas is the unit used to measure how much resource needed to execute the transaction. Specify the maximum gas limit by --gas. If maximum gas is too small, it won't be enough for executing the transaction. If the fee is too low, fee paid for each unit of gas will be low & validator won't execute the transaction too. The fee(minimum unit)/gas must be large than 2*10^10. We recommend that you set your maximum gas to 20000 and set your maximum fee to 400000000000000iris. Fee will be deduct according to the gas used and lefted fee will be returned to user. + +## Fee + +To secure their own validator node and maintain the avalibility of blockchain network, validators in IRISnet need a lot of equipments and works. Thus, every transactions in IRISnet should pay some fee to validators. The parameter in commands is used to specify the maximum fee the user want to pay for their transaction. + +## Gas + +The resource needed for every transactions are varied for different type of transactions. For example, only a few computations, queries & modifies is needed for sending some token to other peolpe. But a lot of computations, queries & modifies is needed for creating a validator. Gas is the unit used to measure how much resource needed to execute the transaction. We list the gas needed for some typical operactions in the below: + +- gas needed for reading some data from database: 10 + data length(in bytes) +- gas needed for writing some data to database: 10 + 10 * data length(in bytes) +- sign or verify a signature + +The total gas needed for executing the transaction is the sum of gas needed for every operations performed during executing the transaction. User should specify the maximum gas by --gas parameter. If maximum gas is not enough for executing the transcation, the transaction won't be executed successfully and all the fee will be returned to user's account. After the transaction being executed successfully, fee will deduct according to gas used, deducted fee will be maximum fee * gas used / maximum gas and left fee will be returned to user. Gas price is equal to maximum fee / maximum gas and stands for fee that user want to pay for each unit of gas. To keep the fee is set in a resonable range, we set a minimum limit for gas price, 2^(-8) iris/gas, transaction won't be executed if the gas price is less than this value. + +Example +``` + iriscli stake unbond complete --from=test --address-validator=faa1mahw6ymzvt2q3lu4pjj5pau2e8krntklgarrxy --address-delegator=faa1mahw6ymzvt2q3lu4pjj5pau2e8krntklgarrxy --fee=2000000000000000iris --gas=20000 --chain-id=test +``` +This example is a transaction to complete the unbond operation. The maximum fee(--fee) is set to be 2000000000000000iris(2*10^15) and the maximum(--gas) gas is set to be 20000. Therefore, the gas price here is 10^11iris/gas. Suppose that 1500 gas is used to execute the transaction, then 1500000000000000 iris will be paid to validators and lefted 500000000000000 iris will be returned to user. diff --git a/docs/software/basic-concepts/key-types/genesis.md b/docs/software/basic-concepts/key-types/genesis.md new file mode 100644 index 000000000..e69de29bb diff --git a/docs/software/basic-concepts/key-types/gov-params.md b/docs/software/basic-concepts/key-types/gov-params.md new file mode 100644 index 000000000..e69de29bb diff --git a/docs/software/basic-concepts/key-types/inflation.md b/docs/software/basic-concepts/key-types/inflation.md new file mode 100644 index 000000000..e69de29bb diff --git a/docs/software/cli-client.md b/docs/software/cli-client.md new file mode 100644 index 000000000..e69de29bb diff --git a/docs/software/light-client.md b/docs/software/light-client.md new file mode 100644 index 000000000..e69de29bb diff --git a/docs/software/monitor.md b/docs/software/monitor.md new file mode 100644 index 000000000..e69de29bb diff --git a/docs/software/node.md b/docs/software/node.md new file mode 100644 index 000000000..e69de29bb