【系列】 EOS开发6 创建EOS账户

安装docker

使用命令行创建EOS账户需要有一套EOS开发环境,这里我们使用一个已经安装了EOS套件的docker环境,本文使用Mac系统,关于docker软件的安装可查看 Mac docker install

创建EOS账户

  1. 启动docker
    docker run --rm -it eosio/eos:latest /bin/bash

  2. 确认eos主网信息
    root@7dd4e87a4ac7:/opt/eosio# ./bin/cleos -u

http://mainnet.eoswz.com get info
{
  "server_version": "db570801",
  "chain_id": "aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906",
  "head_block_num": 198160,
  "last_irreversible_block_num": 198159,
  "last_irreversible_block_id": "0003060fc4f73548996ba657e008c3dcf299b9e3c51085fb3d8288345f6c0563",
  "head_block_id": "000306103792c66883cf2a6e8be8745dfb10ab503b25b81eed76e4daa906edc7",
  "head_block_time": "2018-06-11T14:29:29",
  "head_block_producer": "genesisblock",
  "virtual_block_cpu_limit": 200000000,
  "virtual_block_net_limit": 1048576000,
  "block_cpu_limit": 199900,
  "block_net_limit": 1048576
}

注意EOS主链ID为aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906,只有看到这个ID才是真正的EOS

  1. 创建钱包,保存密码 root@7dd4e87a4ac7:/opt/eosio# ./bin/cleos wallet create "/opt/eosio/bin/keosd" launched Creating wallet: default Save password to use in the future to unlock this wallet. Without password imported keys will not be retrievable. “PW5Ju1KZ5LApHVzAtwXGm83LDNWoAyybkpisxxxxxxx”

  2. 解锁钱包(如果需要)
    cleos wallet unlock
    根据输入以上密码

  1. 导入私钥到钱包 root@7dd4e87a4ac7:/opt/eosio# ./bin/cleos wallet import xxxxxxxxXdWN4f5rsDmZ53sd6er1JEmf8kxxxxxxxxx imported private key for: EOS8TQRjDk9cSKw5WoUWmgmNC8DAzCxxCwxxxxxxxxx

  2. 查看账户
    root@7dd4e87a4ac7:/opt/eosio# ./bin/cleos -u http://mainnet.eoswz.com get accounts EOS8TQRjDk9cSKw5WoUWmgmNC8DAzCxxCwxxxxxxxx { "account_names": [ "gy4domrvguge" ] }

  1. 查看账户余额 root@7dd4e87a4ac7:/opt/eosio# ./bin/cleos -u http://mainnet.eoswz.com get currency balance eosio.token gy4domrvguge EOS
    10.0000 EOS
  1. 创建一个新私钥对
    root@7dd4e87a4ac7:/opt/eosio# ./bin/cleos create key Private key: 5JAvLYWHK3AmpvrGoPT6185rHUhD3FkY2CxSy4axxxxx Public key: EOS8gsDpXU69w3eaeuWnvnYcTCxxxxxx
  1. 导入到钱包 root@7dd4e87a4ac7:/opt/eosio# ./bin/cleos wallet import 5JAvLYWHK3AmpvrGoPT6185rHUhD3FkY2CxSy4axxxxx imported private key for: EOS8gsDpXU69w3eaeuWnvnYcTCxxxxxxxxx
  1. 查询账户名是否被注册 http://www.dappworld.com/api/v1/eos/account

  2. 创建新账户 root@7dd4e87a4ac7:/opt/eosio# ./bin/cleos -u http://mainnet.eoswz.com system newaccount --stake-net '0.0 EOS' --stake-cpu '0.0 EOS' --buy-ram-kbytes 3 gy4domrvguge eosfanwallet EOS8gsDpXU69w3eaeuWnvnYcTCxxxxxxxx

好了,这样我们就创建了一个名为“eosfanwallet”的EOS账户,花费了少量的EOS,大概是人民币3元

「力场 lichang.io」公链挖矿第一社区!

你可能感兴趣的:(EOS)