EOS之前的版本,如果~/.local/share/eosio/nodeos/config/genesis.json
不存在的话,
会自动在此目录创建初始化的genesis.json
,每次nodeos 运行也会自动读取genesis.json
之后版本默认不会再已文件的形式创建初始化的genesis.json
,(可查看相关代码)。程序也不会再自动读取genesis.json
,
当需要时自己手动通过--genesis-json
传入。这样可避免不必要的数据冲突。
相关文章:
EOS之前的版本,如果~/.local/share/eosio/nodeos/config/genesis.json
不存在的话,
会自动在此目录创建初始化的genesis.json
,每次nodeos 运行也会自动读取genesis.json
之后版本默认不会再已文件的形式创建初始化的genesis.json
,(可查看相关代码)。程序也不会再自动读取genesis.json
,
当需要时自己手动通过--genesis-json
传入。这样可避免不必要的数据冲突。
相关文章:
Dapp获取EOS帐号身份大致流程如下
参考Scatter获取身份的流程(Scatter 身份获取部分代码),Dapp对于身份的验证规则如下
如果Dapp配置了所需网络的chain Id,则计算返回为("${this.blockchain}:"+"chain:${this.chainId}").toLowerCase()
如果没有配置chain Id,则计算返回 ("${this.blockchain}:"+"${this.host}:${this.port}").toLowerCase()
Dapp匹配身份有两种方式
对于只有所需网络的地址和端口的,先根据地址和端口通过RPC获取对应的chain idgetinfo
然后Extension统一根据chain id查询对应的账户信息中选中的账号信息,以及从对应chain id网络信息中找到选中的网络信息。
然后将账户信息和网络信息创建成一个身份返回给Dapp.
getinfo
,判断是否相同)。getaccount
,返回中查看permissions
对应权限是否存在,并且公钥是否与私钥生成的公钥一致)git clone https://github.com/EOS-Mainnet/eos.git
git checkout --no-track -b Branch_v1.1.0 Mainnet-1.1.0 --
./eosio_build.sh
sudo make install
ln -s /usr/local/eosio/bin/nodeos /usr/local/bin/nodeos
ln -s /usr/local/eosio/bin/cleos /usr/local/bin/cleos
先运行下nodeos
,将会自动创建~/.local/share/eosio/nodeos/config
目录和config.ini
文件。
修改config.ini中如下内容
//添加
p2p-peer-address = p2p.party.eostea.io:56234
//修改 可忽略
agent-name = "EOS Test Agent"
//如果需要外部eosjs调用的话,修改
access-control-allow-origin = *
//如果需要查看get actions,取消前面注释
filter-on = *
//如果需要返回错误信息,修改
verbose-http-errors = true
//添加插件支持
plugin = eosio::chain_api_plugin
plugin = eosio::history_plugin
plugin = eosio::history_api_plugin
继续修改config.ini
//修改BP名
producer-name = 你的节点名字
//修改BP节点名对应的公钥,私钥 (不要用下面现成的,自己去重新生成!!!)
signature-provider = EOS66bcyj8NBeJigeCDqCeYnaJNFZfCZt328yEpHCh7VZKSxed4Cn=KEY:5KHqSSajXUi11wPEWagiWgY51G6mo4zE4FKfrD2tNH9i4PHHVxU
//添加插件支持
plugin = eosio::producer_plugin
切换到~/.local/share/eosio/nodeos/config
目录,
新建genesis.json
,将(测试网络genesis.json)内容复制到新建的genesis.json
文件中,不要用wget直接下载,github会有转向内容不对.
rm -rf ~/.local/share/eosio/nodeos/data
~/.local/share/eosio/nodeos/config
执行nodeos --genesis-json genesis.json
此时已启动并开始同步区块
root@iZj6cgy98yiuluw41gz0aoZ:~/.local/share/eosio/nodeos/config# cleos get currency balance eosio.token bcskillsurou EOS
20000000.0000 EOS
root@iZj6cgy98yiuluw41gz0aoZ:~/.local/share/eosio/nodeos/config# cleos system delegatebw bcskillsurou bcskillsurou '10000000.0000 EOS' '10000000.0000 EOS'
2018-07-20T12:20:56.591 thread-0 main.cpp:438 create_action ] result: {"binargs":"a0129ddec45aab49a0129ddec45aab4900e876481700000004454f530000000000e876481700000004454f530000000000"} arg: {"code":"eosio","action":"delegatebw","args":{"from":"bcskillsurou","receiver":"bcskillsurou","stake_net_quantity":"10000000.0000 EOS","stake_cpu_quantity":"10000000.0000 EOS","transfer":false}}
executed transaction: ed7bfc3787629ae9fd27c8ef2a51440a2f89717a4e442e5c5588184ce7664c4b 144 bytes 1798 us
# eosio <= eosio::delegatebw {"from":"bcskillsurou","receiver":"bcskillsurou","stake_net_quantity":"10000000.0000 EOS","stake_cpu...
# eosio.token <= eosio.token::transfer {"from":"bcskillsurou","to":"eosio.stake","quantity":"20000000.0000 EOS","memo":"stake bandwidth"}
# bcskillsurou <= eosio.token::transfer {"from":"bcskillsurou","to":"eosio.stake","quantity":"20000000.0000 EOS","memo":"stake bandwidth"}
# eosio.stake <= eosio.token::transfer {"from":"bcskillsurou","to":"eosio.stake","quantity":"20000000.0000 EOS","memo":"stake bandwidth"}
warning: transaction executed locally, but may not be confirmed by the network yet ]
root@iZj6cgy98yiuluw41gz0aoZ:~/.local/share/eosio/nodeos/config# cleos system regproducer bcskillsurou EOS8H6rzgwpV2KD5AtiDMZLQWw6nDxWaV6jGc7rVY8sHfFuJZjCq4 http://bcskill.com
2018-07-20T12:36:19.839 thread-0 main.cpp:438 create_action ] result: {"binargs":"a0129ddec45aab490003be6e9ef6503430e4c80a2cd52149d2b7b9330d92c2cea4a839632f94ced75daf10687474703a2f2f64617070702e636f6d0000"} arg: {"code":"eosio","action":"regproducer","args":{"producer":"bcskillsurou","producer_key":"EOS8H6rzgwpV2KD5AtiDMZLQWw6nDxWaV6jGc7rVY8sHfFuJZjCq4","url":"http://dappp.com","location":0}}
executed transaction: 91df9e3e6e27708ab803ee6da121c2ddd7845fef5f76145dbfd618937ecee5e5 160 bytes 1130 us
# eosio <= eosio::regproducer {"producer":"bcskillsurou","producer_key":"EOS8H6rzgwpV2KD5AtiDMZLQWw6nDxWaV6jGc7rVY8sHfFuJZjCq4","u...
warning: transaction executed locally, but may not be confirmed by the network yet ]
需要等主网启动后,才会出块。
新购买的云服务器只有root帐号,但部署EOS时,非常不建议使用root权限运行,以免因为EOS出现未知BUG导致。。
sudo adduser username
用adduser创建后的新用户是不能使用sudo的,因为还没有赋予相关root权限,执行以下代码赋予权限
sudo usermod -a -G adm username
sudo usermod -a -G sudo username
当需要删除用户时可以使用以下指令
sudo userdel -r username
这个指令会删除用户username并把该用户下的所有文件(/home/username/路径下的所有文件)都删除,若要保留这些文件而仅仅删除用户,可使用以下指令
sudo userdel username
ps:(可查看/etc/group文件来查看各用户组情况)
由于需要使用PHP开发api thinkPhp5连接EOS的mongo db数据,所以有此文
部署好PHP环境,放置好thinkPhp5项目后,修改数据库配置
编辑/var/www/application/database.php
return [
'type' => '\think\mongo\Connection',
'hostname' => '127.0.0.1',
'database' => 'eosmain',
'username' => '', //eos 环境部署的mongo db默认没有用户名和密码,只能本地访问
'password' => '',
'hostport' => '27017',
推荐文章: