EOS:Cleos 和 keosd 的开启——东科教育

本文介绍Cleos命令行工具的功能及其与区块链交互的方法,包括配置与使用说明。同时,还介绍了Keosd私钥管理器的安装与配置流程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Cleos

 

cleos 是一个命令行工具,可与区块链交互并管理钱包。

cleos是一个与暴露的REST API接口的命令行工具nodeos。
为了使用,cleos您需要将终点(IP地址和端口号)添加到nodeos实例,
并配置cleos为加载'eosio :: chain_api_plugin'。 cleos包含所有命令的文档。
有关所有已知命令的列表cleos,只需简单地运行它,不带任何参数;

为了方便起见,我们将为我们的容器中运行的cleos创建一个bash别名。在终端中,运行:

alias cleos='docker exec eosio /opt/eosio/bin/cleos --wallet-url http://localhost:8888'

现在尝试cleos --help在您的终端中运行。您应该看到以下输出:

Command Line Interface to EOSIO Client
Usage: /opt/eosio/bin/cleos [OPTIONS] SUBCOMMAND

Options:
  -h,--help                   Print this help message and exit
  -u,--url TEXT=http://localhost:8888/
                              the http/https URL where nodeos is running
  --wallet-url TEXT=http://localhost:8900/
                              the http/https URL where keosd is running
  -r,--header                 pass specific HTTP header; repeat this option to pass multiple headers
  -n,--no-verify              don't verify peer certificate when using HTTPS
  -v,--verbose                output verbose actions on error

Subcommands:
  version                     Retrieve version information
  create                      Create various items, on and off the blockchain
  get                         Retrieve various items and information from the blockchain
  set                         Set or update blockchain state
  transfer                    Transfer EOS from account to account
  net                         Interact with local p2p network connections
  wallet                      Interact with local wallet
  sign                        Sign a transaction
  push                        Push arbitrary transactions to the blockchain
  multisig                    Multisig contract commands
  system                      Send eosio.system contract action to the blockchain.

Keosd概述

建议编辑

该程序keosd位于eos/build/programs/keosdEOSIO / eos存储库中的文件夹中,可用于存储cleos将用于签署发送到块链的事务的私钥。keosd在本地机器上运行并在本地存储您的私钥。

对于大多数用户来说,使用keosd的最简单方法是让cleos自动启动它。钱包文件(foo.wallet例如命名)也将默认在此目录中创建。

 

自动锁定

默认情况下,keosd设置为在闲置15分钟后自动锁定钱包。这是可配置的config.ini。请注意,如果您需要禁用此功能,您必须设置一个巨大的数字 - 将其设置为0将导致keosd始终锁定您的钱包。

 

手动启动keosd

可以keosd简单地使用手动启动

$ keosd

默认情况下,keosd创建文件夹~/eosio-wallet并用基本config.ini文件填充它。配置文件的位置可以使用--config-dir参数在命令行中指定。配置文件包含传入http连接的http服务器端点以及用于跨源资源共享的其他参数。请注意,如果您允许cleos自动启动keosd,则会生成一个config.ini,与您手动启动keosd的情况相比,它们会有所不同。

可以使用--data-dir参数在命令行中指定钱包数据文件夹的位置。

有关可以运行的可能选项的完整列表keosd --help

$ keosd --help
Application Options:

Config Options for eosio::http_plugin:
  --http-server-address arg (=127.0.0.1:8888)
                                        The local IP and port to listen for
                                        incoming http connections; set blank to
                                        disable.
  --https-server-address arg            The local IP and port to listen for
                                        incoming https connections; leave blank
                                        to disable.
  --https-certificate-chain-file arg    Filename with the certificate chain to
                                        present on https connections. PEM
                                        format. Required for https.
  --https-private-key-file arg          Filename with https private key in PEM
                                        format. Required for https
  --access-control-allow-origin arg     Specify the Access-Control-Allow-Origin
                                        to be returned on each request.
  --access-control-allow-headers arg    Specify the Access-Control-Allow-Header
                                        s to be returned on each request.
  --access-control-allow-credentials    Specify if Access-Control-Allow-Credent
                                        ials: true should be returned on each
                                        request.

Config Options for eosio::wallet_plugin:
  --wallet-dir arg (=".")               The path of the wallet files (absolute
                                        path or relative to application data
                                        dir)
  --unlock-timeout arg (=900)           Timeout for unlocked wallet in seconds
                                        (default 900 (15 minutes)). Wallets
                                        will automatically lock after specified
                                        number of seconds of inactivity.
                                        Activity is defined as any wallet
                                        command e.g. list-wallets.
  --eosio-key arg                       eosio key that will be imported
                                        automatically when a wallet is created.

Application Config Options:
  --plugin arg                          Plugin(s) to enable, may be specified
                                        multiple times

Application Command Line Options:
  -h [ --help ]                         Print this help message and exit.
  -v [ --version ]                      Print version information.
  --print-default-config                Print default configuration template
  -d [ --data-dir ] arg                 Directory containing program runtime
                                        data
  --config-dir arg                      Directory containing configuration
                                        files such as config.ini
  -c [ --config ] arg (=config.ini)     Configuration file name relative to
                                        config-dir
  -l [ --logconf ] arg (=logging.json)  Logging configuration file name/path
                                        for library users

 

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值