Cosmos 基础教程(二)-- Run a Node, API, and CLI

news2024/11/15 7:19:21

有很多不同的方法来运行Cosmos区块链的节点。您将探索如何使用simapp 进行此操作。

1、编译simapp

Cosmos SDK存储库包含一个名为 simapp 的文件夹。在这个文件夹中,您可以找到运行Cosmos SDK模拟版本的代码,这样您就可以在不实际与链交互的情况下测试命令。二进制文件称为simd,您将使用它与节点交互。

首先,创建目录并将其更改为cosmos文件夹,然后将cosmos-sdk repo复制到该文件夹中:

$ mkdir cosmos
$ cd cosmos
$ git clone https://github.com/cosmos/cosmos-sdk
$ cd cosmos-sdk

请确保您使用的是相同版本:

$ git checkout v0.42.6

然后构建cosmos-sdk:

$ make build

构建需要几分钟,并创建一个build 文件夹和一个名为simdsimapp二进制文件:

$ ls build

2、初始化 simapp

现在重置数据库。不仅在数据库已经初始化时运行此步骤,而且即使这是您第一次测试simapp:

$ cd build
$ ./simd unsafe-reset-all

命令输出列出了设置为初始状态的所有文件及其位置。
在这里插入图片描述
是时候初始化应用程序了。初始化创建了创世块和初始链状态:

$ ./simd init demo

在这里插入图片描述

一个更易读的版本:

{
    "app_message": {
        "auth": {
            "accounts": [ ], 
            "params": {
                "max_memo_characters": "256", 
                "sig_verify_cost_ed25519": "590", 
                "sig_verify_cost_secp256k1": "1000", 
                "tx_sig_limit": "7", 
                "tx_size_cost_per_byte": "10"
            }
        }, 
        "bank": {
            "balances": [ ], 
            "denom_metadata": [ ], 
            "params": {
                "default_send_enabled": true, 
                "send_enabled": [ ]
            }, 
            "supply": [ ]
        }, 
        "capability": {
            "index": "1", 
            "owners": [ ]
        }, 
        "crisis": {
            "constant_fee": {
                "amount": "1000", 
                "denom": "stake"
            }
        }, 
        "distribution": {
            "delegator_starting_infos": [ ], 
            "delegator_withdraw_infos": [ ], 
            "fee_pool": {
                "community_pool": [ ]
            }, 
            "outstanding_rewards": [ ], 
            "params": {
                "base_proposer_reward": "0.010000000000000000", 
                "bonus_proposer_reward": "0.040000000000000000", 
                "community_tax": "0.020000000000000000", 
                "withdraw_addr_enabled": true
            }, 
            "previous_proposer": "", 
            "validator_accumulated_commissions": [ ], 
            "validator_current_rewards": [ ], 
            "validator_historical_rewards": [ ], 
            "validator_slash_events": [ ]
        }, 
        "evidence": {
            "evidence": [ ]
        }, 
        "genutil": {
            "gen_txs": [ ]
        }, 
        "gov": {
            "deposit_params": {
                "max_deposit_period": "172800s", 
                "min_deposit": [
                    {
                        "amount": "10000000", 
                        "denom": "stake"
                    }
                ]
            }, 
            "deposits": [ ], 
            "proposals": [ ], 
            "starting_proposal_id": "1", 
            "tally_params": {
                "quorum": "0.334000000000000000", 
                "threshold": "0.500000000000000000", 
                "veto_threshold": "0.334000000000000000"
            }, 
            "votes": [ ], 
            "voting_params": {
                "voting_period": "172800s"
            }
        }, 
        "ibc": {
            "channel_genesis": {
                "ack_sequences": [ ], 
                "acknowledgements": [ ], 
                "channels": [ ], 
                "commitments": [ ], 
                "next_channel_sequence": "0", 
                "receipts": [ ], 
                "recv_sequences": [ ], 
                "send_sequences": [ ]
            }, 
            "client_genesis": {
                "clients": [ ], 
                "clients_consensus": [ ], 
                "clients_metadata": [ ], 
                "create_localhost": false, 
                "next_client_sequence": "0", 
                "params": {
                    "allowed_clients": [
                        "06-solomachine", 
                        "07-tendermint"
                    ]
                }
            }, 
            "connection_genesis": {
                "client_connection_paths": [ ], 
                "connections": [ ], 
                "next_connection_sequence": "0"
            }
        }, 
        "mint": {
            "minter": {
                "annual_provisions": "0.000000000000000000", 
                "inflation": "0.130000000000000000"
            }, 
            "params": {
                "blocks_per_year": "6311520", 
                "goal_bonded": "0.670000000000000000", 
                "inflation_max": "0.200000000000000000", 
                "inflation_min": "0.070000000000000000", 
                "inflation_rate_change": "0.130000000000000000", 
                "mint_denom": "stake"
            }
        }, 
        "params": null, 
        "slashing": {
            "missed_blocks": [ ], 
            "params": {
                "downtime_jail_duration": "600s", 
                "min_signed_per_window": "0.500000000000000000", 
                "signed_blocks_window": "100", 
                "slash_fraction_double_sign": "0.050000000000000000", 
                "slash_fraction_downtime": "0.010000000000000000"
            }, 
            "signing_infos": [ ]
        }, 
        "staking": {
            "delegations": [ ], 
            "exported": false, 
            "last_total_power": "0", 
            "last_validator_powers": [ ], 
            "params": {
                "bond_denom": "stake", 
                "historical_entries": 10000, 
                "max_entries": 7, 
                "max_validators": 100, 
                "unbonding_time": "1814400s"
            }, 
            "redelegations": [ ], 
            "unbonding_delegations": [ ], 
            "validators": [ ]
        }, 
        "transfer": {
            "denom_traces": [ ], 
            "params": {
                "receive_enabled": true, 
                "send_enabled": true
            }, 
            "port_id": "transfer"
        }, 
        "upgrade": { }, 
        "vesting": { }
    }, 
    "chain_id": "test-chain-Hrbd7m", 
    "gentxs_dir": "", 
    "moniker": "demo", 
    "node_id": "93d73b7f8fc1b74612146ba2342e54293c018b9a"
}

您可以在输出中找到chain_id,在我们的构建中,它恰好被称为test-chain-Hrbd7m。记下输出的名称,因为稍后将需要它来确定链 ID,通过标记--chain-id将其传递给simapp

您可以通过以下命令检查初始配置:

$ cat ~/.simapp/config/genesis.json

3、准备你的帐户(account)

It helps to understand the concepts clearly when working hands-on with the Cosmos SDK. Need a refresher? See the section on Accounts in the Main Concepts chapter.

在实际使用Cosmos SDK时,它有助于清楚地理解这些概念。需要复习吗?请参阅“主要概念”一章中的“帐户”部分。

你也可以检查你的keys。它们保存在后端密匙环中,默认情况下是操作系统的密匙环:

$ ./simd keys list

正如你所预料的,你还没有任何keys:

[]

在这里插入图片描述

现在你可以添加一个新key:

$ ./simd keys add d9lab

它输出类似于:

[root@localhost build]# ./simd keys add d9lab
Enter keyring passphrase:
password must be at least 8 characters
Enter keyring passphrase:
Re-enter keyring passphrase:

- name: d9lab
  type: local
  address: cosmos12uj7a02737k7j0d53lhf2eectfktf78vl69de8
  pubkey: cosmospub1addwnpepq0z9q7hy5t050r85r6u9cqgr82uhadg4dx7my7ktgfx6ue4htlfwzg767zh
  mnemonic: ""
  threshold: 0
  pubkeys: []


**Important** write this mnemonic phrase in a safe place.
It is the only way to recover your account if you ever forget your password.

surface mom fiction tuna chase blanket work useful lucky confirm snap crystal peanut enrich sadness heavy voyage bachelor night crazy bargain original prefer else

您可以在上面输出的末尾看到助记符。这个单词序列是一个助记符,您可以使用它来恢复您的公钥和私钥。在生产环境中,助记符必须以可靠和保密的方式存储,作为密钥管理基础设施的一部分。

确认密钥已添加:

$ ./simd keys list
# 或
$ ./simd keys show d9lab

在这里插入图片描述

4、让自己成为一个合适的验证者

如前所述,Cosmos SDK区块链依赖于已识别的验证器来生成块。最初没有用于生成块的验证器。您处于进退两难的境地:初始化和未启动的链需要一个genesis帐户和验证器来进行引导。

让你的key,也就是账户,在创世文件中有一个初始余额:

$ ./simd add-genesis-account d9lab 100000000stake

这里附加在金额后面的是stake 后缀。根据创世文件,这个stake 代表这个链中tokens 的单位。因此,该命令将向您的帐户添加100000000 stake 。如果有疑问,你可以确认genesis.json文件中的正确后缀。

grep -A 2 -B 2 denom ~/.simapp/config/genesis.json

你也可以在创世纪文件中确认你有一个初始余额:

$ grep -A 10 balances ~/.simapp/config/genesis.json

尽管有这个初始余额,在你运行你的区块链之前,你仍然需要逃脱第22条军规,并将你的引导交易包含在genesis文件中。

在这种情况下,为了使网络能够运行,您必须满足加权验证器的2/3阈值。
然而,你将是一个人在网络上,所以你可以下注任何数字或高于最低强制,即1000000stake。但是,为了提醒自己诚实的节点投入大量资金是很重要的,您将100000000股份中的70000000股份投入到您刚刚创建的b9lab帐户中。确保不要用完你所有的代币,这样你仍然可以支付gas ,这样你以后就不会用完代币。
别忘了用你自己的--chain-id

./simd gentx d9lab 70000000stake --chain-id test-chain-Hrbd7m

这证实了这一行动:
在这里插入图片描述

当你在自己的文件中创建了这个genesis交易后,用collect-gentxs收集所有的genesis交易,将其包含在你的genesis文件中:

$ ./simd collect-gentxs

打印生成的genesis文件:

{
    "app_message": {
        "auth": {
            "accounts": [
                {
                    "@type": "/cosmos.auth.v1beta1.BaseAccount", 
                    "account_number": "0", 
                    "address": "cosmos12uj7a02737k7j0d53lhf2eectfktf78vl69de8", 
                    "pub_key": null, 
                    "sequence": "0"
                }
            ], 
            "params": {
                "max_memo_characters": "256", 
                "sig_verify_cost_ed25519": "590", 
                "sig_verify_cost_secp256k1": "1000", 
                "tx_sig_limit": "7", 
                "tx_size_cost_per_byte": "10"
            }
        }, 
        "bank": {
            "balances": [
                {
                    "address": "cosmos12uj7a02737k7j0d53lhf2eectfktf78vl69de8", 
                    "coins": [
                        {
                            "amount": "100000000", 
                            "denom": "stake"
                        }
                    ]
                }
            ], 
            "denom_metadata": [ ], 
            "params": {
                "default_send_enabled": true, 
                "send_enabled": [ ]
            }, 
            "supply": [
                {
                    "amount": "100000000", 
                    "denom": "stake"
                }
            ]
        }, 
        "capability": {
            "index": "1", 
            "owners": [ ]
        }, 
        "crisis": {
            "constant_fee": {
                "amount": "1000", 
                "denom": "stake"
            }
        }, 
        "distribution": {
            "delegator_starting_infos": [ ], 
            "delegator_withdraw_infos": [ ], 
            "fee_pool": {
                "community_pool": [ ]
            }, 
            "outstanding_rewards": [ ], 
            "params": {
                "base_proposer_reward": "0.010000000000000000", 
                "bonus_proposer_reward": "0.040000000000000000", 
                "community_tax": "0.020000000000000000", 
                "withdraw_addr_enabled": true
            }, 
            "previous_proposer": "", 
            "validator_accumulated_commissions": [ ], 
            "validator_current_rewards": [ ], 
            "validator_historical_rewards": [ ], 
            "validator_slash_events": [ ]
        }, 
        "evidence": {
            "evidence": [ ]
        }, 
        "genutil": {
            "gen_txs": [
                {
                    "auth_info": {
                        "fee": {
                            "amount": [ ], 
                            "gas_limit": "200000", 
                            "granter": "", 
                            "payer": ""
                        }, 
                        "signer_infos": [
                            {
                                "mode_info": {
                                    "single": {
                                        "mode": "SIGN_MODE_DIRECT"
                                    }
                                }, 
                                "public_key": {
                                    "@type": "/cosmos.crypto.secp256k1.PubKey", 
                                    "key": "A8RQeuSi30eM9B64XAEDOrl+tRVpvbJ6y0JNrma3X9Lh"
                                }, 
                                "sequence": "0"
                            }
                        ]
                    }, 
                    "body": {
                        "extension_options": [ ], 
                        "memo": "93d73b7f8fc1b74612146ba2342e54293c018b9a@192.168.159.128:26656", 
                        "messages": [
                            {
                                "@type": "/cosmos.staking.v1beta1.MsgCreateValidator", 
                                "commission": {
                                    "max_change_rate": "0.010000000000000000", 
                                    "max_rate": "0.200000000000000000", 
                                    "rate": "0.100000000000000000"
                                }, 
                                "delegator_address": "cosmos12uj7a02737k7j0d53lhf2eectfktf78vl69de8", 
                                "description": {
                                    "details": "", 
                                    "identity": "", 
                                    "moniker": "demo", 
                                    "security_contact": "", 
                                    "website": ""
                                }, 
                                "min_self_delegation": "1", 
                                "pubkey": {
                                    "@type": "/cosmos.crypto.ed25519.PubKey", 
                                    "key": "DWOymvjGcTdP+emo7k1kdqsWzxgwimMOXpqh7Lw2pe0="
                                }, 
                                "validator_address": "cosmosvaloper12uj7a02737k7j0d53lhf2eectfktf78v6w3c45", 
                                "value": {
                                    "amount": "70000000", 
                                    "denom": "stake"
                                }
                            }
                        ], 
                        "non_critical_extension_options": [ ], 
                        "timeout_height": "0"
                    }, 
                    "signatures": [
                        "s5x2n/lLuGAOUq0YdJRkxVY5WtcbVt5wZJ4uRUuQ02ULje9czOPikEWFFOm9Bb69GHZBpw0VP9AwbuSzzIGxhA=="
                    ]
                }
            ]
        }, 
        "gov": {
            "deposit_params": {
                "max_deposit_period": "172800s", 
                "min_deposit": [
                    {
                        "amount": "10000000", 
                        "denom": "stake"
                    }
                ]
            }, 
            "deposits": [ ], 
            "proposals": [ ], 
            "starting_proposal_id": "1", 
            "tally_params": {
                "quorum": "0.334000000000000000", 
                "threshold": "0.500000000000000000", 
                "veto_threshold": "0.334000000000000000"
            }, 
            "votes": [ ], 
            "voting_params": {
                "voting_period": "172800s"
            }
        }, 
        "ibc": {
            "channel_genesis": {
                "ack_sequences": [ ], 
                "acknowledgements": [ ], 
                "channels": [ ], 
                "commitments": [ ], 
                "next_channel_sequence": "0", 
                "receipts": [ ], 
                "recv_sequences": [ ], 
                "send_sequences": [ ]
            }, 
            "client_genesis": {
                "clients": [ ], 
                "clients_consensus": [ ], 
                "clients_metadata": [ ], 
                "create_localhost": false, 
                "next_client_sequence": "0", 
                "params": {
                    "allowed_clients": [
                        "06-solomachine", 
                        "07-tendermint"
                    ]
                }
            }, 
            "connection_genesis": {
                "client_connection_paths": [ ], 
                "connections": [ ], 
                "next_connection_sequence": "0"
            }
        }, 
        "mint": {
            "minter": {
                "annual_provisions": "0.000000000000000000", 
                "inflation": "0.130000000000000000"
            }, 
            "params": {
                "blocks_per_year": "6311520", 
                "goal_bonded": "0.670000000000000000", 
                "inflation_max": "0.200000000000000000", 
                "inflation_min": "0.070000000000000000", 
                "inflation_rate_change": "0.130000000000000000", 
                "mint_denom": "stake"
            }
        }, 
        "params": null, 
        "slashing": {
            "missed_blocks": [ ], 
            "params": {
                "downtime_jail_duration": "600s", 
                "min_signed_per_window": "0.500000000000000000", 
                "signed_blocks_window": "100", 
                "slash_fraction_double_sign": "0.050000000000000000", 
                "slash_fraction_downtime": "0.010000000000000000"
            }, 
            "signing_infos": [ ]
        }, 
        "staking": {
            "delegations": [ ], 
            "exported": false, 
            "last_total_power": "0", 
            "last_validator_powers": [ ], 
            "params": {
                "bond_denom": "stake", 
                "historical_entries": 10000, 
                "max_entries": 7, 
                "max_validators": 100, 
                "unbonding_time": "1814400s"
            }, 
            "redelegations": [ ], 
            "unbonding_delegations": [ ], 
            "validators": [ ]
        }, 
        "transfer": {
            "denom_traces": [ ], 
            "params": {
                "receive_enabled": true, 
                "send_enabled": true
            }, 
            "port_id": "transfer"
        }, 
        "upgrade": { }, 
        "vesting": { }
    }, 
    "chain_id": "test-chain-Hrbd7m", 
    "gentxs_dir": "/root/.simapp/config/gentx", 
    "moniker": "demo", 
    "node_id": "93d73b7f8fc1b74612146ba2342e54293c018b9a"
}

如果您感到好奇,您可以在您的genesis中找到更新的gen_txs字段。


        "genutil": {
            "gen_txs": [
                {
                    "auth_info": {
                        "fee": {
                            "amount": [ ], 
                            "gas_limit": "200000", 
                            "granter": "", 
                            "payer": ""
                        }, 
                        "signer_infos": [
                            {
                                "mode_info": {
                                    "single": {
                                        "mode": "SIGN_MODE_DIRECT"
                                    }
                                }, 
                                "public_key": {
                                    "@type": "/cosmos.crypto.secp256k1.PubKey", 
                                    "key": "A8RQeuSi30eM9B64XAEDOrl+tRVpvbJ6y0JNrma3X9Lh"
                                }, 
                                "sequence": "0"
                            }
                        ]
                    }, 
                    "body": {
                        "extension_options": [ ], 
                        "memo": "93d73b7f8fc1b74612146ba2342e54293c018b9a@192.168.159.128:26656", 
                        "messages": [
                            {
                                "@type": "/cosmos.staking.v1beta1.MsgCreateValidator", 
                                "commission": {
                                    "max_change_rate": "0.010000000000000000", 
                                    "max_rate": "0.200000000000000000", 
                                    "rate": "0.100000000000000000"
                                }, 
                                "delegator_address": "cosmos12uj7a02737k7j0d53lhf2eectfktf78vl69de8", 
                                "description": {
                                    "details": "", 
                                    "identity": "", 
                                    "moniker": "demo", 
                                    "security_contact": "", 
                                    "website": ""
                                }, 
                                "min_self_delegation": "1", 
                                "pubkey": {
                                    "@type": "/cosmos.crypto.ed25519.PubKey", 
                                    "key": "DWOymvjGcTdP+emo7k1kdqsWzxgwimMOXpqh7Lw2pe0="
                                }, 
                                "validator_address": "cosmosvaloper12uj7a02737k7j0d53lhf2eectfktf78v6w3c45", 
                                "value": {
                                    "amount": "70000000", 
                                    "denom": "stake"
                                }
                            }
                        ], 
                        "non_critical_extension_options": [ ], 
                        "timeout_height": "0"
                    }, 
                    "signatures": [
                        "s5x2n/lLuGAOUq0YdJRkxVY5WtcbVt5wZJ4uRUuQ02ULje9czOPikEWFFOm9Bb69GHZBpw0VP9AwbuSzzIGxhA=="
                    ]
                }
            ]
        }, 

5、Create blocks

现在你可以启动你的单节点区块链:

$ ./simd start

在你运行命令的终端窗口中,你可以看到块正在生成和验证:

[root@localhost build]# ./simd start
2:30PM INF starting ABCI with Tendermint
2:30PM INF Starting multiAppConn service impl=multiAppConn module=proxy
2:30PM INF Starting localClient service connection=query impl=localClient module=abci-client
2:30PM INF Starting localClient service connection=snapshot impl=localClient module=abci-client
2:30PM INF Starting localClient service connection=mempool impl=localClient module=abci-client
2:30PM INF Starting localClient service connection=consensus impl=localClient module=abci-client
2:30PM INF Starting EventBus service impl=EventBus module=events
2:30PM INF Starting PubSub service impl=PubSub module=pubsub
2:30PM INF Starting IndexerService service impl=IndexerService module=txindex
2:30PM INF ABCI Handshake App Info hash= height=0 module=consensus protocol-version=0 software-version=
2:30PM INF ABCI Replay Blocks appHeight=0 module=consensus stateHeight=0 storeHeight=0
2:30PM INF asserting crisis invariants inv=0/11 module=x/crisis name=staking/module-accounts

在同一文件夹中打开一个新终端,并检查余额:

$ ./simd query bank balances $(./simd keys show d9lab -a)

打印:
在这里插入图片描述

6、发送交易

练习发送交易。要做到这一点,你将创建另一个名为student的帐户,并将一些tokens 转移到该帐户:

$ ./simd keys add student

打印如下:

[root@localhost build]# ./simd keys add student
Enter keyring passphrase:

- name: student
  type: local
  address: cosmos1h43mcjku2a008jq9pqqzcd75gry7tsuutcn374
  pubkey: cosmospub1addwnpepqd7vfdq7tcyzqlg9vwwg8c2ef0pzwqajpktekgwrdxgxlhz4s6jfqmek9j0
  mnemonic: ""
  threshold: 0
  pubkeys: []


**Important** write this mnemonic phrase in a safe place.
It is the only way to recover your account if you ever forget your password.

vague tuition armor crane picture business organ balance strike town plate target rain provide depend weapon indoor logic uncover track puppy coral effort donate

在发送任何代币之前,请确认新账户的余额是否存在:

$ ./simd query bank balances $(./simd keys show student -a)

这个账户没有余额。您的区块链中还不存在新帐户。只有密钥对已生成并存储在您的密匙环中:

balances: []
pagination:
  next_key: null
  total: "0"

你需要发送一个交易来改变这个新账户的余额:

$ ./simd tx bank send $(./simd keys show d9lab -a) $(./simd keys show student -a) 10stake --chain-id test-chain-Hrbd7m

在签署和广播之前,您将被提示确认交易:
在这里插入图片描述

命令回显信息包括gas_used等有用信息。

先检查一下student账户的余额:

./simd query bank balances $(./simd keys show student -a)

在这里插入图片描述

现在再检查一下student账户的余额:

balances:
- amount: "10"
  denom: stake
pagination:
  next_key: null
  total: "0"

7、CLI路由

现在是时候编写一些Go代码了。simd如何通过命令行界面进行交互?检查cosmos-sdk/simapp/simd/main.go文件:

package main

import (
  "os"

  "github.com/cosmos/cosmos-sdk/server"
  svrcmd "github.com/cosmos/cosmos-sdk/server/cmd"
  "github.com/cosmos/cosmos-sdk/simapp"
  "github.com/cosmos/cosmos-sdk/simapp/simd/cmd"
)

func main() {
  rootCmd, _ := cmd.NewRootCmd()

  if err := svrcmd.Execute(rootCmd, simapp.DefaultNodeHome); err != nil {
    switch e := err.(type) {
    case server.ErrorCode:
      os.Exit(e.Code)

    default:
      os.Exit(1)
    }
  }
}

cmd.NewRootCmd()函数是CLI处理程序。它通过“github.com/cosmos/cosmos-sdk/simapp/simd/cmd”行导入。它可以在cosmos-sdk/simapp/simd/cmd/root.go)文件下找到。

func NewRootCmd() (*cobra.Command, params.EncodingConfig)

其中,定义了基本属性,如应用程序名称:

rootCmd := &cobra.Command{
    Use:   "simd",
    Short: "simulation app",

此外,观察Cobra被导入并用于CLI重定向:

rootCmd.AddCommand(
    genutilcli.InitCmd(simapp.ModuleBasics, simapp.DefaultNodeHome),
    genutilcli.CollectGenTxsCmd(banktypes.GenesisBalancesIterator{}, simapp.DefaultNodeHome),
    genutilcli.MigrateGenesisCmd(),
    genutilcli.GenTxCmd(simapp.ModuleBasics, encodingConfig.TxConfig, banktypes.GenesisBalancesIterator{}, simapp.DefaultNodeHome),
    genutilcli.ValidateGenesisCmd(simapp.ModuleBasics),
    AddGenesisAccountCmd(simapp.DefaultNodeHome),
    tmcli.NewCompletionCmd(rootCmd, true),
    NewTestnetCmd(simapp.ModuleBasics, banktypes.GenesisBalancesIterator{}),
    debug.Cmd(),
    config.Cmd(),
)

另外,查看simapp/app.go,将导入每个模块和密钥管理员。首先你会看到一个相当大的模块列表(打开新窗口),大多数Cosmos-sdk应用程序都使用这些模块:

...
  "github.com/cosmos/cosmos-sdk/x/auth"
  "github.com/cosmos/cosmos-sdk/x/auth/ante"
  authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
  authsims "github.com/cosmos/cosmos-sdk/x/auth/simulation"
  authtx "github.com/cosmos/cosmos-sdk/x/auth/tx"
  authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
  "github.com/cosmos/cosmos-sdk/x/auth/vesting"
  "github.com/cosmos/cosmos-sdk/x/bank"
  bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
  banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
  "github.com/cosmos/cosmos-sdk/x/capability"
  capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper"
  capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
...

/cosmos-sdk/x/文件夹中的模块是由在Cosmos栈上工作的几个组织维护的。要理解一个模块,最好的方法是查看相应的spec文件夹。例如,查看cosmos-sdk/x/bank/spec/01_state.md以了解本节中使用的bank模块的状态。

您是否需要对模块及其在Cosmos SDK中的作用进行概念复习?参见前一章的模块部分。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/358567.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

从零开始使用MMSegmentation训练Segformer

从零开始使用MMSegmentation训练Segformer 写在前面:最新想要用最新的分割算法如:Segformer or SegNeXt 在自己的数据集上进行训练,但是有不是搞语义分割出身的,而且也没有系统的学过MMCV以及MMSegmentation。所以就折腾了很久&am…

Javascript 立即执行函数

IIFE,一般称为立即执行函数。你可能会问我,*“嘿!我知道正常的函数表达式是什么样子的,但是 IIFE 到底是什么?”。*好吧,这正是我今天要在本文中回答的问题。 函数表达式 在了解立即调用函数表达式之前,让…

栈与队列-算法总结

目录 基础知识 用栈实现队列 用队列实现栈 栈的拿手好戏 删除字符串中的所有相邻重复项 逆波兰表达式求值 滑动窗口最大值 前k个高频元素 基础知识 栈队列stackqueue先进后出先进先出无迭代器无迭代器容器设配器容器设配器vector deque listvector deque list C标准库版本…

“dv/dt”和“di/dt”值:这些值的水平对固态继电器有什么影响?

di/dt水平过高是晶闸管故障的主要原因之一。发生这种情况时,施加到半导体器件上的应力会大大超过额定值并损坏功率元件。在这篇新的博客文章中,我们将解释dv/dt和di/dt值的重要性,以及为什么在为您的应用选择固态继电器之前需要考虑它们。 让…

VMware虚拟机安装Win11最详细过程以及遇到的这台电脑无法运行Windows11的问题

准备工作 在使用VMware虚拟机安装Win11之前我们先把准备工作做好,以免后续思绪混乱导致出错。 1. 到VMware官网或点击链接下载正版VMware Workstation 16 Pro。 2. 双击打开安装包,点击下一步。 3. 阅读用户许可协议,勾选我接受许可协议中的…

k8s-二进制部署

文章目录一、环境二、步骤1、安装cfssl工具2、部署etcd集群3、在node节点安装docker组件4、安装flannel组件部署master节点组件部署node节点部署kube-proxy组件三、测试一、环境 角色服务器地址组件master192.168.174.140kube-apiserver,kube-controller-manager&a…

外包出来,朋友内推我去一家公司,问的实在是太...

外包出来,没想到算法死在另一家厂子,自从加入这家公司,每天都在加班,钱倒是给的不少,所以也就忍了。没想到8月一纸通知,所有人不许加班,薪资直降30%,顿时有吃不起饭的赶脚。 好在有…

2023赏金计划:Coremail SRC漏洞征集与样本奖励火热进行中

赏金活动一:Coremail SRC漏洞奖励计划 01 活动背景 2023年1月,Coremail安全应急响应中心(Coremail SRC)正式上线启用,面向公众收集安全漏洞信息与安全情报。Coremail SRC旨在联合众多安全专家、白帽子研究员共同发现…

MySQL 运算符及优先级

MySQL 运算符 MySQL 主要有以下几种运算符: 算术运算符比较运算符逻辑运算符位运算符算术运算符 MySQL 支持的算术运算符包括: 运算符作用加法-减法*乘法/ 或 DIV除法% 或 MOD取余 在除法运算和模运算中,如果除数为0,将是非法除数&#x…

分布式事务几种方案

1)、2PC 模式 数据库支持的 2PC【2 phase commit 二阶提交】,又叫做 XA Transactions。 MySQL 从 5.5 版本开始支持,SQL Server 2005 开始支持,Oracle 7 开始支持。 其中,XA 是一个两阶段提交协议,该协议…

推荐系统[八]算法实践总结V1:淘宝逛逛and阿里飞猪个性化推荐:召回算法实践总结【冷启动召回、复购召回、用户行为召回等算法实战】

0.前言:召回排序流程策略算法简介 推荐可分为以下四个流程,分别是召回、粗排、精排以及重排: 召回是源头,在某种意义上决定着整个推荐的天花板;粗排是初筛,一般不会上复杂模型;精排是整个推荐环节的重中之重,在特征和模型上都会做的比较复杂;重排,一般是做打散或满足…

Windows 服务器IIS安装,服务器多界面设置方法

当你在使用服务器时是否有遇到这样一个问题?当你正在服务器里进行工作时,突然一个小伙伴在没有告知你的情况下进入了服务器里,导致你服务器失去连接了,这种情况是非常常见的现象。 主要原因就是因为服务器没有安装多界面&#xf…

k8s多节点二进制部署以及Dashboard-UI

一.多Maser集群架构的了解Kubernetes作为容器集群系统,通过健康检查重启策略是实现Pod故障自我修复能力,通过调度室实现Pod分布式部署,并保持预期副本数,根据Node失效状态自动在其他Node拉起Pod,实现了应用层的高可用。…

KUKA机器人_示教器的基本组成结构和功能介绍

KUKA机器人_示教器的基本组成结构和功能介绍 如何操作KUKA机器人? 通过KUKA机器人的手持操作器(KUKA smartPAD),或者叫示教器。 如下图所示, 可以通过示教器的各种按键菜单和触摸屏(手、触摸笔)来操作示教器。 下面对于示教器上的按键菜单的功能进行详细的说明: …

契约开发、测试你知多少?

契约维护的难题 如今微服务凭借其灵活、易开发、易扩展等优势深入人心,不同服务之间的集成和交互日渐繁多且复杂。这些服务之间交互的方式是多样的,常见的有 HTTP 请求和消息队列。在它们交互的过程中,会有服务的版本演进,交互信…

Mysql架构与内部模块

Mysql架构与内部模块 演示环境: MySQL 5.7 存储引擎:InnoDB 一、一条查询SQL是如何执行的? 程序或者工具要操作数据库,第一步跟数据库建立连接。 1、通信协议 首先,MySQL 必须要运行一个服务,监听默认的…

vue - vue中对Vant日历组件(calendar)的二次封装

vue中对vant日历选择器组件实现的的二次封装;主要实现功能如下: 主要功能: 日期区间选择(基本);自定义选择器的底部按钮,添加清除时间操作(slot插槽);指定默认选中的日期…

一种图片展示的完美方案,图片展示,object-fill

通常一般的处理 <style>.img-container {width: 300px;height: 200px;background: #f60;}img {width: 100%;height: 100%;}</style> </head> <body><div class"img-container"><img src"./行道树.png" alt""&g…

Java之JVM性能初探

一、JVM简介jvm是一种用于计算设备的规范&#xff0c;它是一个虚构出来的机器&#xff0c;是通过在实际的计算机上仿真模拟各种功能实现的。jvm包含一套字节码指令集&#xff0c;一组寄存器&#xff0c;一个栈&#xff0c;一个垃圾回收堆和一个存储方法域。JVM屏蔽了与具体操作…

AWS攻略——使用Public NAT解决私有子网实例访问互联网

文章目录创建NAT网关编辑Private子网路由测试知识点参考资料在《AWS攻略——子网》一文中&#xff0c;我们分别创建了一个Public子网和一个Private子网&#xff0c;并让Public子网中的实例可以SSH登录到Private子网的实例中。 现实场景中&#xff0c;我们可能存在如下需求&…