【系列】EOS智能合约开发06 - cleos wallet 创建钱包

in #cn6 years ago

 接上篇: EOS智能合约开发05 - nodeos启动单节点测试网络

 

programs目录下的可执行文件

eos/build/programs 目录下,有很多有用的命令(本质上是可执行文件):

  • eos/build/programs/cleos/cleos
  • eos/build/programs/eosio-abigen/eosio-abigen
  • eos/build/programs/eosio-launcher/eosio-launcher
  • eos/build/programs/keosd/keosd
  • eos/build/programs/nodeos/nodeos 

 比如,上一篇文章中的介绍的 nodeos 可以用来启动单节点区块链;这篇介绍的 cleos wallet 可以用来创建钱包。
 

检查wallet_api_plugin

首先,需要nodeosconfig.ini中,已经加载了wallet_api_plugin(钱包API插件)。

配置config.ini的内容,在上一篇也有介绍,如果按照上一篇配置了插件,可以略过下面的内容。

首先,需要定位到默认的config.ini保存的目录:

.local/share/eosio/nodeos/config

 然后使用gedit命令编辑:

gedit config.ini

在文本最后插入以下配置:

enable-stale-production = true
# Enable block production with the testnet producers
producer-name = eosio
# Load the block producer plugin, so you can produce blocks
plugin = eosio::producer_plugin
# Wallet plugin
plugin = eosio::wallet_api_plugin
# As well as API and HTTP plugins
plugin = eosio::chain_api_plugin
plugin = eosio::http_plugin
# This will be used by the validation step below, to view account history
plugin = eosio::account_history_api_plugin

 

启动EOS区块链

创建钱包之前,要启动区块链,因为这些创建信息都会写入区块。和上一篇一样,从eos/build/programs/nodes目录,启动EOS单节点区块链的命令如下:

nodeos -e -p eosio --plugin eosio::wallet_api_plugin --plugin eosio::chain_api_plugin --plugin eosio::account_history_api_plugin

配置了config.ini后,命令可以简化为:

nodeos

 

创建钱包

启动区块链后,到eos/build/programs/cleos目录下,打开终端,输入命令:

cleos wallet create

创建了一个默认钱包,钱包名是:default 密码(用于解锁钱包)是:PW5JaZitmdV4nUcumR7Z1rE6DG1GC8E9bMs94aAsQABsgGpxGb1SK 

查看创建钱包的信息

创建钱包后,终端会返回一条创建成功的信息:.wallet文件被保存到了本地的“.local/share/eosio/nodeos/data”文件夹中。 

 可以看到,终端返回了一条创建钱包的信息:

eosio generated block f0facf32... #1191 @ 2018-04-10T09:34:38.500 with 0 trxs, lib: 1190

2078890ms thread-0   wallet.cpp:182                save_wallet_file     ] saving wallet to file /home/songguo/.local/share/eosio/nodeos/data/./default.wallet

可以到钱包被创建的目录,查看钱包信息。 

 打开这个.wallet文件,可以看到钱包信息:

{ "cipher_keys": "7bbbcde9ff7819f927adc3a9ffed0150d372b236b72d4268ebe85cea12730ca715be987a7ddae0212956ab00e7997f350e6556a28f4bc994899f0a5114e0a1fefd2448a50f6457c288fb5ed982a496c3ccee299bb8d85d5d33a59dc10e8336979fb32a79166cce1179bbfffc9c2225c6e461f10b58fa3c1ea53320cfe815f1b39b0b26d59e19222048cf884b458e8e68" }

是一个简单的JSON对象,只有一个字段“cipher_keys”。
到这里,我们学会了:

  • 如何下载和构建EOS工程;
  • 如何运行一个EOS区块链(不过还只是单节点的);
  • 如何创建EOS钱包。

 下一篇:  EOS智能合约开发07 - 第一个智能合约:Welcome to EOS ! 

 

每天学点Linux

shell和bash

接触过Linux的人,或多或少都会听过shell和bash这个两个词,那么,


什么是shell?

shell是一个命令语言解释器(command-language interpreter)

shell是一个程序,接受从键盘输入的命令,然后把命令传递给操作系统去执行。


什么是bash?

bash 是来自GNU项目的shell程序。“bash” 是 “Bourne Again SHell” 的首字母缩写。

这个名字的由来是,很久以前,有一个叫 Steve Bourne 的工程师,在Unix系统上,开发了一个Shell程序,名字叫“Bourne Shell”。后来,他又为这个程序开发了一个增强版本,取名就叫“Bourne Again Shell”。 

Sort:  

Congratulations @ldy3413! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 1 year!

Click here to view your Board

Support SteemitBoard's project! Vote for its witness and get one more award!

Congratulations @ldy3413! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 2 years!

You can view your badges on your Steem Board and compare to others on the Steem Ranking

Vote for @Steemitboard as a witness to get one more award and increased upvotes!

Coin Marketplace

STEEM 0.17
TRX 0.13
JST 0.027
BTC 58919.17
ETH 2647.00
USDT 1.00
SBD 2.43