同步moac主网
Posted 戎码江湖
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了同步moac主网相关的知识,希望对你有一定的参考价值。
写在前面:
1.本文主要是同步moac主网节点,调用moac链相关方法。
一、创建钱包
- 需要有一个钱包,保存钱包地址及私钥(暂称呼为钱包A)。
二、下载moac主网安装包
- 下载地址:https://github.com/MOACChain/moac-core/releases
- 下载界面如下图所示(本文采用linux系统):
备注:下载最新版本的安装包,如用以前的安装包可能会出现分叉等一些问题。
三、解压安装包
- 本文安装包放在根目录下,解压后如下:
四、修改文件
- 修改vnodeconfig.json文件
- 具体修改内容
五、同步节点
- 使用tmux打开后台
备注:tmux的使用请查看 https://www.ruanyifeng.com/blog/2019/10/tmux.html - 在后台tmux界面,进入 /linux/vnode 目录下执行如下命令:
./moac-linux-amd64 --datadir "/moacchain/fuxi2.1.1/.moac" --rpc --rpcaddr 0.0.0.0 --rpcport 8545 --rpccorsdomain "*" --rpcapi="db,mc,net,chain3,vnode,debug,scs,txpool" --targetgaslimit 18000000 --port=30333
备注:
1.端口自选,尽量不要使用80,90端口
2.–datadir 修改moac节点的存储地址(使用【ll -a】显示影藏问文件.moac,存放了keystore)
3.–targetgaslimit 18000000 一段时间后新区块的gas上限会逐步由当前的900万提升至1800万
- 出现如下界面即为同步成功:
备注:运行到这一步即完成了节点同步,可以满足基本开发需求。
六、开启挖矿(非必须)
-
进入到console命令界面(1.创建新钱包 2.开启挖矿):
没有设置–datadir的情况下:./moac-linux-amd64 attach
设置了–datadir的情况下: ./moac-linux-amd64 attach datadir设置的位置,比如上边那个命令的datadir是/opt/fuxi2.0.3/.moac,那么该命令就是 [./moac-linux-amd64 attach /opt/fuxi2.0.3/.moac/moac.ipc] -
进入到console命令界面后有以下几个命令:
miner.start 开启挖矿
personal.newAccount(‘123456’) 创建新的钱包,括号里的是该钱包密码
mc.accounts 查看账号
mc.getBalance(mc.accounts[0]) 按序号查询余额
mc.getBalance(‘钱包地址’) 根据地址查询余额,不过前提是该节点下有那个钱包地址 -
ersonal.unlockAccount(“钱包地址”,“钱包密码”,0) 解锁当前钱包地址账号,最后一个参数是解锁时长,0就是无限制解锁
docker部署OKExChain主网
文章目录
一. 编写说明
1.1 文档说明
- 文档内容
通过本文档对欧易链链使用docker部署主网过程进行描述
- 部署服务
服务器 | 程序 | 默认端口 |
---|---|---|
127.0.0.1 | 欧易链主网节点(OKExChain) | rpc接口:8545 p2p接口:26656 |
1.2 配置信息
- 硬件配置
服务器系统:Centos7+
CPU:4核
内存:8GB
硬盘:SSD 500 GB
网络:5M独立带宽
- 软件环境
Docker:19.03.11
注意:软件使用版本不强制使用与上面一样的版本
1.3 部署文档信息
- OKExChain链github地址:https://github.com/okex/exchain/releases
- 主网浏览器:https://www.oklink.com/okexchain
- 主网链官方部署文档:https://okexchain-docs.readthedocs.io/en/latest/getting-start/join-okexchain-mainnet.html
- 官方镜像:https://hub.docker.com/r/okexchain/fullnode-mainnet/tags?page=1&ordering=last_updated
二、下载OKExChain主网镜像
docker pull okexchain/fullnode-mainnet:v0.19.5
三、OKExChain主网容器升成
3.1 创建文件夹
mkdir /opt/docker/okexchain
3.2 容器启动
docker run -itd --restart=unless-stopped -v /etc/localtime:/etc/localtime -v /etc/timezone:/etc/timezone --name okexchain -v /opt/docker/okexchain:/root/.exchaind/data/ -p 8545:8545 -p 26656:26656 okexchain/fullnode-mainnet:v0.19.5
3.3 查看容器日志
docker logs --tail 100 -f okexchain
四、查看OKExChain主网同步节点是否部署成功
- 查看OKExChain容器是否成功启动
# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
97527d0c5e32 okexchain/fullnode-mainnet:v0.19.5 "sh -c /root/start.sh" 5 minutes ago Up 5 minutes 6060/tcp, 0.0.0.0:8545->8545/tcp, 8546/tcp, 26657/tcp, 26659-26660/tcp, 0.0.0.0:26656->26656/tcp okexchain
- 查看OKExChain节点启动日志是否正常
# docker logs -f okexchain
{"app_message":{"ammswap":{"params":{"fee_rate":"0.003000000000000000"},"swap_token_pair_records":null},"auth":{"accounts":[],"params":{"max_memo_characters":"256","sig_verify_cost_ed25519":"590","sig_verify_cost_secp256k1":"1000","tx_sig_limit":"7","tx_size_cost_per_byte":"10"}},"backend":null,"bank":{"send_enabled":true},"crisis":{"constant_fee":{"amount":"1000.000000000000000000","denom":"okt"}},"debug":null,"dex":{"max_token_pair_id":"0","operators":null,"params":{"delist_max_deposit_period":"86400000000000","delist_min_deposit":[{"amount":"100.000000000000000000","denom":"okt"}],"delist_voting_period":"259200000000000","list_fee":{"amount":"20000.000000000000000000","denom":"okt"},"ownership_confirm_window":"86400000000000","register_operator_fee":{"amount":"0.000000000000000000","denom":"okt"},"transfer_ownership_fee":{"amount":"10.000000000000000000","denom":"okt"},"withdraw_period":"259200000000000"},"product_locks":{"Data":{}},"token_pairs":null,"withdraw_infos":null},"distribution":{"delegator_withdraw_infos":[],"fee_pool":{"community_pool":[]},"params":{"community_tax":"0.020000000000000000","withdraw_addr_enabled":true},"previous_proposer":"","validator_accumulated_commissions":[]},"evidence":{"evidence":[],"params":{"max_evidence_age":"120000000000"}},"evm":{"accounts":[],"chain_config":{"byzantium_block":"0","constantinople_block":"0","dao_fork_block":"0","dao_fork_support":true,"eip150_block":"0","eip150_hash":"0x0000000000000000000000000000000000000000000000000000000000000000","eip155_block":"0","eip158_block":"0","ewasm_block":"-1","homestead_block":"0","istanbul_block":"0","muir_glacier_block":"0","petersburg_block":"0","yoloV2_block":"-1"},"contract_blocked_list":[],"contract_deployment_whitelist":[],"params":{"enable_call":false,"enable_contract_blocked_list":false,"enable_contract_deployment_whitelist":false,"enable_create":false,"extra_eips":null,"max_gas_limit_per_tx":"30000000"},"txs_logs":[]},"farm":{"current_rewards":[],"historical_rewards":[],"lock_infos":[],"params":{"create_pool_deposit":{"amount":"10.000000000000000000","denom":"okt"},"create_pool_fee":{"amount":"0.000000000000000000","denom":"okt"},"quote_symbol":"usdk","yield_native_token":false},"pools":[],"pools_yield_native_token":null},"genutil":{"gentxs":null},"gov":{"deposit_params":{"max_deposit_period":"86400000000000","min_deposit":[{"amount":"100.000000000000000000","denom":"okt"}]},"deposits":null,"proposals":[],"starting_proposal_id":"1","tally_params":{"quorum":"0.334000000000000000","threshold":"0.500000000000000000","veto":"0.334000000000000000","yes_in_vote_period":"0.667000000000000000"},"votes":null,"voting_params":{"voting_period":"259200000000000"},"waiting_proposals":{}},"mint":{"minter":{"minted_per_block":[{"amount":"0.000000000000000000","denom":"okt"}],"next_block_to_update":"0"},"original_minted_per_block":"1.000000000000000000","params":{"blocks_per_year":"10519200","deflation_epoch":"3","deflation_rate":"0.500000000000000000","farm_proportion":"0.500000000000000000","goal_bonded":"0","inflation_max":"0","inflation_min":"0","inflation_rate_change":"0","mint_denom":"okt"}},"order":{"open_orders":null,"params":{"cancel_order_msg_gas_unit":"30000","fee_per_block":{"amount":"0.000000000000000000","denom":"okt"},"max_deals_per_block":"1000","new_order_msg_gas_unit":"40000","order_expire_blocks":"259200","trade_fee_rate":"0.001000000000000000"}},"params":{"params":{"max_block_height":"100000","max_deposit_period":"86400000000000","min_deposit":[{"amount":"100.000000000000000000","denom":"okt"}],"voting_period":"259200000000000"}},"slashing":{"missed_blocks":{},"params":{"downtime_jail_duration":"600000000000","min_signed_per_window":"0.050000000000000000","signed_blocks_window":"10000","slash_fraction_double_sign":"0.000000000000000000","slash_fraction_downtime":"0.000000000000000000"},"signing_infos":{}},"staking":{"all_shares":null,"delegators":null,"exported":false,"last_total_power":"0","last_validator_powers":null,"params":{"epoch":252,"max_bonded_validators":21,"max_validators_to_add_shares":30,"min_delegation":"0.000100000000000000","min_self_delegation":"10000.000000000000000000","unbonding_time":"1209600000000000"},"proxy_delegator_keys":null,"unbonding_delegations":null,"validators":null},"stream":null,"supply":{"supply":[]},"token":{"locked_assets":null,"locked_fees":null,"params":{"burn_fee":{"amount":"10.000000000000000000","denom":"okt"},"issue_fee":{"amount":"2500.000000000000000000","denom":"okt"},"mint_fee":{"amount":"10.000000000000000000","denom":"okt"},"modify_fee":{"amount":"0.000000000000000000","denom":"okt"},"ownership_confirm_window":"86400000000000","transfer_ownership_fee":{"amount":"10.000000000000000000","denom":"okt"}},"tokens":[{"description":"OK Group Global Utility Token","mintable":true,"original_symbol":"okt","original_total_supply":"1000000000.000000000000000000","owner":"ex10q0rk5qnyag7wfvvt7rtphlw589m7frs3hvqmf","symbol":"okt","type":"0","whole_name":"OKT"}]},"upgrade":{}},"chain_id":"exchain-66","gentxs_dir":"","moniker":"fullnode","node_id":"07c645e5ea1b68efae3a1d053d0770651f88eacf"}
--2021-09-13 18:12:21-- https://raw.githubusercontent.com/okex/mainnet/main/genesis.json
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 185.199.108.133, 185.199.110.133, 185.199.111.133, ...
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|185.199.108.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 7628169 (7.3M) [text/plain]
Saving to: '/root/.exchaind/config/genesis.json'
/root/.exchaind/con 100%[===================>] 7.27M --.-KB/s in 0.03s
2021-09-13 18:12:22 (266 MB/s) - '/root/.exchaind/config/genesis.json' saved [7628169/7628169]
I[2021-09-13|18:12:22.625][21] starting ABCI with Tendermint module=main
I[2021-09-13|18:12:30.128][21] Executed block module=state height=2322602 validTxs=0 invalidTxs=0
I[2021-09-13|18:12:30.138][21] Committed state module=state height=2322602 txs=0 appHash=475CDCC48EF8D9149399A214D4F0F0F8AF164A0471252B3EAD5C59E153CE5A51
I[2021-09-13|18:12:30.141][21] Interval<33ms>, ApplyBlock<2322602>, tx<0>, elapsed<26ms>, validateBlock<2ms>, abci<15ms>, validate<0ms>, updateState<0ms>, commit<5ms>, evpool<0ms>, saveState<3ms> module=main
I[2021-09-13|18:12:30.161][21] Executed block module=state height=2322603 validTxs=0 invalidTxs=0
I[2021-09-13|18:12:30.169][21] Committed state module=state height=2322603 txs=0 appHash=4C350A691780FBED3DBF82FF257C5C0F24943877F7F27A16B2E0549F6D5D8FA5
五、查看OKExChain主网同步节点是否同步完成
- 查看节点区块数据同步进度
查看节点当前同步的同步进度,返回为false,则OKExChain同步节点区块数据同步完成
# curl -s -H Content-Type:application/json -X POST --data '{"jsonrpc":"2.0","method":"eth_syncing","params":[],"id":1}' http://127.0.0.1:8545
{"jsonrpc":"2.0","id":1,"result":false}
- 查看节点最新区块号
查看节点当前同步的最新区块号,与OKExChain官方区块链浏览器进行对比,查看是否一致,是否已与公网节点的区块一致
OKExChain官方主网浏览器:https://www.oklink.com/okexchain
# curl -s -H Content-Type:application/json -X POST --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' http://127.0.0.1:8545
{"jsonrpc":"2.0","id":1,"result":"0x23b143"}
以上,就是今天分享的全部内容了。
希望大家通过以上方式可以解决自己的实际需求,解决自己目前所遇到的问题。
如果在部署过程中有任何疑问,可以扫描下面的二维码,添加我的个人微信,备注:地区-职业方向-昵称,欢迎来撩,加入区块链技术交流群,与更多的区块链技术大佬学习交流。
原创不易,码字不易。 觉得这篇文章对你有点用的话,麻烦你为本文点个赞,留言或转发一下,因为这将是我输出更多优质文章的动力,感谢!
以上是关于同步moac主网的主要内容,如果未能解决你的问题,请参考以下文章