EOS 开发:账户

1. 创建账户

上一篇钱包的文章后,我们有了一个解锁后的钱包和三个钥匙对。

新账户必须从另一个账户中创建出来,因此我们从 eosio 中创建出 default 账户。

# 替换括号中为之前创建的 key
cleos --wallet-url http://wallet:5555 -u http://server:7777 create account eosio default {Default owner Public Key} {Default active Public Key}

root@0ad6e73c14f2:~# cleos --wallet-url http://wallet:5555 -u http://server:7777 create account eosio default EOS5KSUCYnHgpxZwSnFNBkJ1LCdqU1iFwazQbEgQAbysV2FLFSBDB EOS6twXkcVomuTH2rih8SgeSPATVLnKts1HR3Q76bvy7aoeC1Yv6L
executed transaction: f5ff3597191f50e24be7d17b6688c0813d7357063313d0b78d7f354e7dcc1607  352 bytes  102400 cycles
#         eosio <= eosio::newaccount            {"creator":"eosio","name":"default","owner":{"threshold":1,"keys":[{"key":"EOS5KSUCYnHgpxZwSnFNBkJ1L...

注意账户名字必须小写并且不能超过 13 个字符(仅支持 12345abcdefghijklmnopqrstuvwxyz67890不允许)。

2. 查看账户信息

root@0ad6e73c14f2:~# cleos -u http://server:7777 get account default
{
  "account_name": "default",
  "permissions": [{
      "perm_name": "active",
      "parent": "owner",
      "required_auth": {
        "threshold": 1,
        "keys": [{
            "key": "EOS6twXkcVomuTH2rih8SgeSPATVLnKts1HR3Q76bvy7aoeC1Yv6L",
            "weight": 1
          }
        ],
        "accounts": []
      }
    },{
      "perm_name": "owner",
      "parent": "",
      "required_auth": {
        "threshold": 1,
        "keys": [{
            "key": "EOS5KSUCYnHgpxZwSnFNBkJ1LCdqU1iFwazQbEgQAbysV2FLFSBDB",
            "weight": 1
          }
        ],
        "accounts": []
      }
    }
  ]
}

也可以通过 public key 查看所有关联的账户:

$ cleos  -u http://server:7777 get accounts EOS5KSUCYnHgpxZwSnFNBkJ1LCdqU1iFwazQbEgQAbysV2FLFSBDB

Reference

  • https://www.eosdocs.io/dappdevelopment/accounts/
Buy me a coffee
Zhao Li /
Published under (CC) BY-NC-SA in categories EOS  tagged with account