added transaction command docs

This commit is contained in:
Sam Hadi 2021-11-16 14:34:33 -08:00
parent bcf4b11d7b
commit af0c2251fe
3 changed files with 149 additions and 165 deletions

View File

@ -1,247 +1,174 @@
module.exports = { module.exports = {
"theme": "cosmos", theme: "cosmos",
"title": "Kava Documentation", title: "Kava Documentation",
"themeConfig": { themeConfig: {
"logo": { logo: {
"src": "/logo.svg" src: "/logo.svg"
}, },
"custom": true, custom: true,
"sidebar": { sidebar: {
"auto": false, auto: false,
"nav": [ nav: [
{ {
"title": "Intro to Kava Platform", title: "Intro to Kava Platform",
"children": [ children: [
{ {
"title": "Application Process", title: "Application Process",
"path": "/education/application_process.html" path: "/education/application_process.html"
}, },
{ {
"title": "Development Process", title: "Development Process",
"children": [ children: [
{ {
"title": "Kava DAO Governance", title: "Kava DAO Governance",
"path": "/education/kava_dao_governance.html", path: "/education/kava_dao_governance.html",
}, },
{ {
"title": "Testnet", title: "Testnet",
"path": "/education/testnet.html", path: "/education/testnet.html",
}, },
{ {
"title": "Mainnet upgrade", title: "Mainnet upgrade",
"path": "/education/mainnet_upgrade.html", path: "/education/mainnet_upgrade.html",
} }
] ]
} }
] ]
}, },
{ {
"title": "Getting Started - Developers", title: "Getting Started - Developers",
"children": [ children: [
{ {
"title": "Hello Kava", title: "Hello Kava",
"path": "/education/hello_kava.html" path: "/education/hello_kava.html"
}, },
{ {
"title": "Javascript SDK", title: "Javascript SDK",
"path": "/building/javascript-sdk.html" path: "/building/javascript-sdk.html"
}, },
{ {
"title": "Run Validator Node", title: "Run Validator Node",
"path": "/validator_guide" path: "/validator_guide"
}, },
{ {
"title": "Run Bots", title: "Run Bots",
"children": [ children: [
{ {
"title": "Sentinel Bot", title: "Sentinel Bot",
"path": "/tools/sentinel.html" path: "/tools/sentinel.html"
}, },
{ {
"title": "Auction Bot", title: "Auction Bot",
"path": "/tools/auction.html" path: "/tools/auction.html"
} }
] ]
}, },
{ {
"title": "Migration Guide", title: "Migration Guide",
"path": "/kava-8", path: "/kava-8",
"directory": true directory: true
} }
] ]
}, },
{ {
"title": "Resources", title: "Resources",
"children": [ children: [
{ {
"title": "Lite Paper", title: "Lite Paper",
"path": "/education/lite_paper.html" path: "/education/lite_paper.html"
}, },
{ {
"title": "Community Tools", title: "Community Tools",
"path": "/tools/community.html" path: "/tools/community.html"
}, },
{ {
"title": "Module Specs", title: "Module Specs",
"path": "/Modules", path: "/Modules",
"directory": true, directory: true,
}, },
{ {
"title": "CLI Docs", title: "CLI Docs",
"children": [ path: "/education/user_actions/",
directory: true,
},
{ {
"title": "General", title: "REST API Spec",
"children": [ path: "https://swagger.kava.io/"
},
{ {
"title": "Quick Guide", title: "Protocol Reference",
"path": "/education/user_actions/General/quick_guide.html" path: "https://pkg.go.dev/github.com/kava-labs/kava?tab=subdirectories"
} }
] ]
} }
, ]
},
footer: {
logo: "/logo.svg",
textLink: {
text: "kava.io",
url: "https://www.kava.io"
},
services: [
{ {
"title": "CDP", service: "twitter",
"children": [ url: "https://twitter.com/kava_platform"
{
"title": "Create",
"path": "/education/user_actions/CDP/cdp_create.html",
}, },
{ {
"title": "Deposit", service: "medium",
"path": "/education/user_actions/CDP/cdp_deposit.html", url: "https://medium.com/kava-labs"
}, },
{ {
"title": "Draw", service: "telegram",
"path": "/education/user_actions/CDP/cdp_draw.html", url: "https://t.me/kavalabs"
}, },
{ {
"title": "Repay", service: "discord",
"path": "/education/user_actions/CDP/cdp_repay.html", url: "https://discord.gg/JJYnuCx"
}, },
{ {
"title": "Withdraw", service: "github",
"path": "/education/user_actions/CDP/cdp_withdraw.html", url: "https://github.com/kava-labs"
} }
], ],
smallprint: "© 2021 Kava Labs.",
links: [
{
title: "Community",
children: [
{
title: "Blog",
url: "https://medium.com/kava-labs"
}, },
{ {
"title": "HARD", title: "Chat",
"children": [ url: "https://t.me/kavalabs"
{
"title": "Deposit",
"path": "/education/user_actions/HARD/hard_deposit.html",
},
{
"title": "Borrow",
"path": "/education/user_actions/HARD/hard_borrow.html",
},
{
"title": "Repay",
"path": "/education/user_actions/HARD/hard_repay.html",
},
{
"title": "Withdraw",
"path": "/education/user_actions/HARD/hard_withdraw.html",
}
],
},
{
"title": "SWAP",
"children": [
{
"title": "Deposit",
"path": "/education/user_actions/SWAP/swap_deposit.html",
},
{
"title": "Swap Tokens",
"path": "/education/user_actions/SWAP/swap_tokens.html",
},
{
"title": "Withdraw",
"path": "/education/user_actions/SWAP/swap_withdraw.html",
}
],
},
],
},
{
"title": "REST API Spec",
"path": "https://swagger.kava.io/"
},
{
"title": "Protocol Reference",
"path": "https://pkg.go.dev/github.com/kava-labs/kava?tab=subdirectories"
}
]
}
]
},
"footer": {
"logo": "/logo.svg",
"textLink": {
"text": "kava.io",
"url": "https://www.kava.io"
},
"services": [
{
"service": "twitter",
"url": "https://twitter.com/kava_platform"
},
{
"service": "medium",
"url": "https://medium.com/kava-labs"
},
{
"service": "telegram",
"url": "https://t.me/kavalabs"
},
{
"service": "discord",
"url": "https://discord.gg/JJYnuCx"
},
{
"service": "github",
"url": "https://github.com/kava-labs"
}
],
"smallprint": "© 2021 Kava Labs.",
"links": [
{
"title": "Community",
"children": [
{
"title": "Blog",
"url": "https://medium.com/kava-labs"
},
{
"title": "Chat",
"url": "https://t.me/kavalabs"
} }
] ]
}, },
{ {
"title": "Contributing", title: "Contributing",
"children": [ children: [
{ {
"title": "Contributing to the docs", title: "Contributing to the docs",
"url": "https://github.com/Kava-Labs/kava/tree/master/docs" url: "https://github.com/Kava-Labs/kava/tree/master/docs"
}, },
{ {
"title": "Source code on GitHub", title: "Source code on GitHub",
"url": "https://github.com/Kava-Labs/kava" url: "https://github.com/Kava-Labs/kava"
} }
] ]
}, },
{ {
"title": "Related Docs", title: "Related Docs",
"children": [ children: [
{ {
"title": "Cosmos SDK", title: "Cosmos SDK",
"url": "https://cosmos.network/docs" url: "https://cosmos.network/docs"
}, },
{ {
"title": "Binance Chain", title: "Binance Chain",
"url": "https://docs.binance.org" url: "https://docs.binance.org"
} }
] ]
} }

View File

@ -1,4 +1,4 @@
## Quick Overview ## A Quick Overview
short on time? Read these and get a refresher of the most commont commands. short on time? Read these and get a refresher of the most commont commands.
### Get a list of all keys ### Get a list of all keys

View File

@ -0,0 +1,57 @@
## Transaction Creation
One of the fundamental ways to interact with a Kava Node is through the use of ```kvcli```. It can be used to create new transactions from the user, which will later be broadcasted to other nodes in the network after going through validations and signing. the ```kvcli``` commands for transaction creation will all follow a very similar pattern across modules and it will follow the structure below:
```
kvcli tx [module_name] [command_name] [arguments] [flags]
```
| key | explanation |
|-----------|---|
| kvcli | calls the cli by its name |
| tx | creates a transaction |
| module_name | specifies the module which a transaction will be created |
| command_name | specifies the type of transaction for the given module |
| arguments | provide arguments for the transaction |
| flags | provide flags for the transaction some of which can be required |
the flags are the last part of the command and depending on the module they can be required in order for the transaction command to be accepted. Flags are reserved to modify commands, all flags will have a default value. Some of these default values will be empty strings and as stated above they will need to be filled in in order for the command to be processed. a user can override any flag's default value by ```--flag_name [flag_value]```.
Users creating transactions will usually interact with the most common flags below:
| Identifier | Purpose |
|------------------|---------|
| --from | transaction origin account |
| --gas | how much gas a transaction consumes usually left as auto for estimation |
| --gas-adjustment | optional flag for scaling up the gas flag to avoid underestimating |
| --gas-prices | will set how much the user is willing to pay per gas unit |
| --fees | will set the total fees the user is willing to pay |
the fees/gas prices that are calculated will decide if any given validator will decide to include the transaction in a new block by checking the value against their Node's minimum gas price. For that reason users are encouraged to pay more fees such that their transactions get added to a new block.
### Transaction example
given two accounts ```A``` & ```B``` the owner of account ```A``` would like to send some funds over to another account ```B``` , using the ```kvcli``` the user with account ```A``` would create a transaction that will follow this structure below:
```
kvcli tx send <B_Addr> 1000ukava --from <A_Addr> --gas-prices 0.50ukava
```
## Transaction Journey
In the Cosmos SDK a transaction is defined as any user created object that must trigger state changes in the application. As such a transaction must be processed carefully and go through strict validation to ensure that it:
1. Provides all the required fields.
2. The transaction is Valid.
3. The user is authorized and has the fees to pay for the transaction.
4. The transaction is not repeated or malicious in any way.
### Mempool
the first step for a transaction is for it to end up in the Mempool such that it can be processed by Validators and added to a new Block. In order for the transaction to be added into the Mempool it must pass a couple validation steps.
1. Pass basic stateless checks that are quick in nature and act as a quick way to disqualify a transaction immediately, if it is failing to provide basic fields such as address, etc.
2. Pass stateful checks which will required more thorough testing such as the address are valid, have enough funds, and are authorized to create the transaction. The reason this is stateful is because the node will create the state copy and run the transaction in it to validate it.
### Proposal
Once a transaction is in the Mempool and a Proposer is chosen from the set of validators, the Proposer includes it in the new block. And a series of checks are ran by other validators to run the transactions and if everything is valid a new block will be created.