您正在查看: EOS-新手教程 分类下的文章

EOS浏览器扩展钱包Scatter的安装

下面演示在Chrome浏览器中演示Scatter的安装

1.源代码安装

首先将Scatter 项目源代码clone到本地

git clone https://github.com/EOSEssentials/Scatter
  • 简述源代码编译

    首先安装好nodejs环境,在此目录执行 npm install安装项目依赖,依赖安装完成后,执行npm run build即可编译出build目录,里面的文件与目录下scatter.zip(此为当前源代码之前编译完成的)文件功能相同。

  • 加载扩展

    Chrome 浏览器地址栏打开chrome://extensions/,点击打开LOAD UNPACKED,选择scatter.zip解压目录,或者编译生成的build目录。即可完成扩展的安装

2.Store安装

打开Chrome Store地址:(Go to Chrome Store)
点击添加至CHROME,允许安装即可自动完成

相关推荐:
Scatter的使用及添加测试网络相关设置
Scatter 在测试网络中与Dapp交互使用

配置自己的节点与EOS主网数据同步

本篇文章将讲解如何将自己机器部署的节点链接到EOS主网,并同步区块数据。

1.源码编译
2.修改config.ini
  • 修改producer-name为自己的节点名,例如producer-name = eos.dos
  • 修改private-key为自己的公钥私钥(在线生成
  • 添加p2p-peer-address 一些已知稳定访问的公网节点
    三种方式获取可用的p2p-peer-address:
  1. (科学上网访问)
  2. (EOSPark 进入BP节点,查看接入点)
  3. (已测试当前可用节点)
  4. (Block Producer bp.json Validator)
  5. (eosnation)
p2p-peer-address = node1.eosnewyork.io:6987
p2p-peer-address = p2p.eos42.io:9876
p2p-peer-address = peering.mainnet.eoscanada.com:9876
p2p-peer-address = node1.starteos.io:9876
  • 按自己需要添加一些插件支持
    plugin = eosio::chain_api_plugin
    plugin = eosio::history_api_plugin
    plugin = eosio::chain_plugin
    plugin = eosio::history_plugin
    plugin = eosio::net_plugin
    plugin = eosio::net_api_plugin

~/.local/share/eosio/nodeos/config目录下执行 (目录可随意)

wget https://github.com/EOS-Mainnet/eos/raw/mainnet-1.0.5/mainnet-genesis.json

在上面目录下执行nodeos --genesis-json mainnet-genesis.json
出现错误Genesis state can only be set on a fresh blockchain
修改执行命令为

nodeos --genesis-json mainnet-genesis.json --delete-all-blocks

执行cleos get info查看chain_id

已经为EOS主网络。

EOS账户权限的使用

从前一篇文章讲解了EOS账户权限介绍以及增删改查
下面介绍下账户权限的使用
基于上篇第5步(为bcskill账号增加自定义权限组custom,基于active )开始进行

1.首先先给账号bcskill转点SYS代币

发币步骤请参考(零基础EOS 节点部署,BP出块(三)-->开始部署),这里就不多做介绍

cleos push action eosio.token transfer '["eosio", "bcskill","1000.0000 SYS","bcskill"]' -p eosio

2.查询bcskill账户余额
cleos get currency balance eosio.token bcskill

3.用bcskill账号已custom权限转账给eosio
cleos push action eosio.token transfer '["bcskill", "eosio","100.0000 SYS","bcskill"]' -p bcskill@custom

4.custom权限组绑定transfer action
cleos set action permission bcskill eosio.token transfer custom

5.用bcskill账号已custom权限转账给eosio
cleos push action eosio.token transfer '["bcskill", "eosio","100.0000 SYS","bcskill"]' -p bcskill@custom

6.查询bcskill账户余额
cleos get currency balance eosio.token bcskill

经过两篇文章我们可以看出EOS的权限管理非常灵活。

EOS账户权限介绍以及增删改查

EOS一直宣传自己的账号权限机制,下面将演示针对账号bcskill三个权限组的增删改查

  • owner 账号拥有者,拥有账号全部的权限,等于超级管理员 (新建账号预设)
  • active 拥有账号大部分账户的权限,等于管理员 (新建账号预设)
  • custom 自定义添加,用于下面演示针对权限组的增删改查
    拥有哪些组的私钥,就拥有当前账号哪些权限。每个组可以有多个授权key,也可以多个授权账户。

1. 生成多组公钥私钥 (在线生成

  • 用于添加到三个权限组演示
权限名 公钥 私钥
owner EOS6fQzsc9Bn5buFbNxHgGMNh9zr2gcbHz2YaaBCfMApw3E8vADu3 5Hvpv1qkoBymEb8DA1MfrgHdcPbxGkE7Ux9DPzhRnb8kHBoAuBn
active EOS5G45ChvRSTjQJGvHX8gBEV2ZrUvbxnh6WEd1qfXKox7KqnZb7j 5Jqq6ztSk41Y6duygrFwCKKVBTaat8zLExG3owwnJSHZMKRcZC4
custom EOS5QxpwkWLAAWQqcT8teKrUceYr5Nj6PsBmCVoLaQQVqcoP2ZjF5 5JewRAyyYoNoTfwmy32CLBiyqS2DfQ8njY4ENuzqJ5Rrp7Zft2o
  • 用于演示一个权限组多个账号
账户名 公钥 私钥
temporary EOS7Yfs4kL6j9G8nmCTFt5ycLUpV4NmPaZKfuVfYC8XJbuDYPPdnA 5JnHkERVzDec7j31gAscy39mDbZvTr2XvGS7SZgwQCgNca3McL1
  • 用于演示一个权限组多个授权key
公钥 私钥
EOS7UKzLPHVUTYpex48pRZokvBNEEp5KKXFGwcb5Qv6dZTWUYHGeP 5JUhVJetKVxZ1vKPBwxKe458g7Zz3LnAz9kLhmirVs7tiSF2bGk

2.导入私钥

cleos wallet import 5Hvpv1qkoBymEb8DA1MfrgHdcPbxGkE7Ux9DPzhRnb8kHBoAuBn
cleos wallet import 5Jqq6ztSk41Y6duygrFwCKKVBTaat8zLExG3owwnJSHZMKRcZC4
cleos wallet import 5JewRAyyYoNoTfwmy32CLBiyqS2DfQ8njY4ENuzqJ5Rrp7Zft2o

3.创建账号

cleos system newaccount eosio bcskill EOS6fQzsc9Bn5buFbNxHgGMNh9zr2gcbHz2YaaBCfMApw3E8vADu3 EOS5G45ChvRSTjQJGvHX8gBEV2ZrUvbxnh6WEd1qfXKox7KqnZb7j  --stake-net '50.00 SYS' --stake-cpu '50.00 SYS' --buy-ram-kbytes 10000

创建账户时,会一同加入owner,active两个组,(两个组的公钥可以用同一个,但不建议)

4.查看账户信息

cleos get account bcskill -j

也就是只要有EOS6fQzsc9Bn5buFbNxHgGMNh9zr2gcbHz2YaaBCfMApw3E8vADu3的私钥,就拥有对账户bcskill的owner权限组的权限
拥有EOS5G45ChvRSTjQJGvHX8gBEV2ZrUvbxnh6WEd1qfXKox7KqnZb7j的私钥,就拥有对账户bcskill的active权限组的权限

5.为bcskill账号增加自定义权限组custom,基于active

cleos set account permission bcskill custom '{"threshold":1,"keys":[{"key":"EOS5QxpwkWLAAWQqcT8teKrUceYr5Nj6PsBmCVoLaQQVqcoP2ZjF5","weight":1}],"accounts":[]}' active

6.查看账户信息

cleos get account bcskill -j

7.为权限组custom更换权限key

cleos set account permission bcskill custom '{"threshold": 1, "keys": [{"key": "EOS7UKzLPHVUTYpex48pRZokvBNEEp5KKXFGwcb5Qv6dZTWUYHGeP", "weight": 1}], "accounts": []}' active

8.查看账户信息

cleos get account bcskill -j

custom授权key已更新

9.为custom添加多个授权key

cleos set account permission bcskill custom '{"threshold":1,"keys":[{"key":"EOS5QxpwkWLAAWQqcT8teKrUceYr5Nj6PsBmCVoLaQQVqcoP2ZjF5","weight":1},{"key":"EOS7UKzLPHVUTYpex48pRZokvBNEEp5KKXFGwcb5Qv6dZTWUYHGeP","weight":1}],"accounts":[]}' active

10.查看账户信息

cleos get account bcskill -j

custom已有两个授权key

11.创建账号temporary

cleos system newaccount eosio temporary EOS7Yfs4kL6j9G8nmCTFt5ycLUpV4NmPaZKfuVfYC8XJbuDYPPdnA EOS7Yfs4kL6j9G8nmCTFt5ycLUpV4NmPaZKfuVfYC8XJbuDYPPdnA  --stake-net '50.00 SYS' --stake-cpu '50.00 SYS' --buy-ram-kbytes 10000

12.为custom添加其他授权账号temporary

cleos set account permission bcskill custom '{"threshold":2,"keys":[{"key":"EOS5QxpwkWLAAWQqcT8teKrUceYr5Nj6PsBmCVoLaQQVqcoP2ZjF5","weight":1}],"accounts":[{"permission":{"actor":"temporary","permission":"active"},"weight":1}]}' active

13.查看账户信息

cleos get account bcskill -j

custom已有授权账号temporary

14.删除custom权限组

cleos set account permission bcskill custom 'NULL' active

15.查看账户信息

cleos get account bcskill -j

custom权限组已被删除

下一篇将讲解EOS账户权限的使用

零基础EOS 节点部署,BP出块(一)-->前期准备

事前准备

  1. 部署3台主机,账户名为(eosio,eosio.bp1,eosio.bp2),系统为Ubuntu 16.04以上版本
  2. 生成15个EOS地址 (10个系统预留账户,2个节点,3个用于投票)(在线生成
eosio eosio.token eosio.bpay eosio.msig eosio.names
eosio.ram eosio.ramfee eosio.saving eosio.stake eosio.upay
eosio.bp1 eosio.bp2 voter1 voter2 voter3
账户名 私钥 公钥
eosio 5KeqsXty9Sa8GfJgNfkckYxKKGcAWE4AWmUHiw6ifDcn3jjUg2i EOS5DkKbBZnSKNSV1iu27ovnygGhoCA99eH69KyNNkSkNrrbBoiRe
eosio.token 5JvL5wbJeQdgpKDDLRFUyWmHwBpRDgvARn99cS4pXoxZt8p7p4w EOS5M2sNqDPZtQoBcRMnPQEnY1MJaVtdWWPx7A3UpcLgtzdLusFVW
eosio.bpay 5KS9q4MPwmcpEM3rX96zR4A4FvLJZC9y1BZxvidaEwqfb4MWREx EOS5iezVa6bsmvZ3HNxdqgyX6GFRMWzE7FsjS3cui8Foavxnj8CfR
eosio.msig 5HsbhVhjtzeuzxdWKQv2MWBtbHzgjxEtYKQg9XB3cxPRYaC7r4m EOS8K1wkfCzPmxAjjfqvqw6zQ1Dbc82YsQyR8MmwNFLcRHcJtth89
eosio.names 5JrEru2K7FKLrwfLQ6B55PRWj2MXVkuXrLiurfn2osSatRsEmj6 EOS5ps938c5zj6UqhdCfssyAy7WSbHgfZoraqD6HrnbpmpEwPwX7S
eosio.ram 5HqNyZgePkdSZLuhz9YTi36L7HuhxpPeEEppNaB49Z7WcJWVsed EOS7DA8jGA6HfZXYcGSGJNsWJL5Q6t5bWcvm4zNykN3Jw7tASzBCR
eosio.ramfee 5KdYWerC5XnqfDhVV5igoyjuNFrT78McrErvbUMd36Wje77t6kJ EOS7R1Ds4zLMPN6onVXjL8XGgKHHCMWjLT7wn3bHcHnQX3dVLErjE
eosio.saving 5JN3GEXZVKYWAgbfdppvGU3hSpiu9BUcpEwpqMMp1NA6gvUsGF9 EOS6BDfFaFZgvx889BQbdaGTMYSn5tUuxaynGQDhpDGD662eBGwkF
eosio.upay 5Kgqr6jB6mfMjNv4vX1Hwj3KqiCxYUhPCnuxTK1mVN118fok4oG EOS7zS7sHctU54oD6is2oPfq11duCMSWfda3HXJAghSfqqr2BZZnV
eosio.bp1 5JzWCZ9W7VNWLYroQpjYG2z6H6UjJUkKdinZpumf6Ru2xoxSrKT EOS7mcXeVUSLCZxEf8eBPm2MbmiswNovoB6rk71pPqaZoxwSAeK7b
eosio.bp2 5HragVTsSmmAg1mznNMDSeAp2ZezcNBw6SbczrNpNtUqRcx4vhh EOS6hfh1yup4tZjbjhD3oPuZwMFqL4iUVehgMsukuvx5ojTWuurtT
voter1 5Jb2DtzYFU9c3LSEP5PPAfN7Je8d8yLGdDN42n561zy34UFwzTN EOS6wLrhcEQDZJvfZSCgVkFzsKcv34XTsTTjXXQZajWaBbEhvLPMg
voter2 5JsFet6W3Xmp3DvcHJsJ6GVcksSZJunGhmjpQaE9Np2ZtK4JYbc EOS6u8i7rknHyAd7AdziWSnEsAbyJHA3U9So4R8p2z58cA1KeEDv2
voter3 5JdQRPPCXtVLKBj5qhg6QtVq5PHuKoKnrcpePG6CsryPuYkiWX6 EOS8LyieKTsMAZGp7DSEhBPEPmPXvQKT5c3EXgEvACcdRwwRwDzoy

EOS 节点部署,BP出块(二)-->节点连接
EOS 节点部署,BP出块(三)-->开始部署