最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會(huì)員登陸 & 注冊(cè)

ETH RPC搭建

2023-03-19 15:51 作者:蘇慕白丶sumubai  | 我要投稿

配置選擇

先是看了aws、谷歌云、阿里云
這個(gè)配置都要1-2wrmb一個(gè)月,太貴了
問(wèn)了很多朋友,打算用hetzner,50歐一個(gè)月足以

我選的配置:64gb,2tb ssd
開(kāi)好后在郵箱收到信息

鏈接后
按以下步驟安裝系統(tǒng):https://0o0.me/server/hetzner-reinstall-with-raid0.html
系統(tǒng)選ubuntu 22

搭建RPC節(jié)點(diǎn)

搭建eth rpc指令:

mkdir /data cd /data wget https://gethstore.blob.core.windows.net/builds/geth-linux-amd64-1.11.2-73b01f40.tar.gz tar -zxvf geth-linux-amd64-1.11.2-73b01f40.tar.gz mkdir prysm cd prysm curl https://raw.githubusercontent.com/prysmaticlabs/prysm/master/prysm.sh --output prysm.sh chmod +x prysm.sh ./prysm.sh beacon-chain generate-auth-secret cd /data/ cd geth-linux-amd64-1.11.2-73b01f40 輸入完,按兩次回車(chē): nohup ./geth ?--datadir "/data/eth/" --maxpeers 75 ?--cache=2048 --authrpc.jwtsecret /data/prysm/jwt.hex ?--http --http.addr "127.0.0.1" --http.port "18181" >&1 & cd /data/prysm/ 輸入完,按兩次回車(chē): nohup ./prysm.sh beacon-chain --execution-endpoint=http://localhost:8551 --jwt-secret=./jwt.hex --suggested-fee-recipient=0x91a0982397BEB2B65DFF9a6436695e362135cBa6 ?--accept-terms-of-use ? & 查看eth執(zhí)行層日志 tail -f /data/geth-linux-amd64-1.11.2-73b01f40/nohup.out 查看eth共識(shí)層日志 tail -f /data/prysm/nohup.out

等待同步最新塊,over~
大概要1周內(nèi)

使用老版本執(zhí)行層同步

eth執(zhí)行層如果只想太慢可以用老版本
用老版本同步到分叉的那個(gè)塊,再運(yùn)行新版本
運(yùn)行老版本之前要先關(guān)掉新版本的進(jìn)程并且刪除eth文件夾

ps -ef | grep geth kill -9 123456 rm -rf /data/eth wget https://gethstore.blob.core.windows.net/builds/geth-linux-amd64-1.10.24-972007a5.tar.gz tar -zxvf geth-linux-amd64-1.10.24-972007a5.tar.gz cd geth-linux-amd64-1.10.24-972007a5/ nohup ./geth --datadir "/data/eth/" --maxpeers 75 --cache=2048 --http --http.addr "127.0.0.1" --http.port "18181" 1>&1 &

使用Python3執(zhí)行腳本

等兩個(gè)層都同步完成之后
就可以用python3來(lái)調(diào)用自己的rpc節(jié)點(diǎn)了
像我搭建的節(jié)點(diǎn)
ipc地址:/data/eth/geth.ipc
http地址:http://127.0.0.1:18181/

這里會(huì)出現(xiàn)pip3不存在的情況
需要先安裝pip3
然后再安裝web3

wget https://bootstrap.pypa.io/get-pip.py get-pip.py && sudo python3 get-pip.py
pip3 -V
pip3 install web3

python3 demo 代碼:

from web3 import Web3 my_provider = Web3.IPCProvider('/data/eth/geth.ipc') my_provider = Web3.HTTPProvider("http://127.0.0.1:18181/") w3 = Web3(my_provider) # 當(dāng)前區(qū)塊高度 blockNumber = w3.eth.blockNumber print(blockNumber)

更多的操作可以在網(wǎng)上找資料
還可以用nodejs寫(xiě),用golong的話最快

博客原文: https://sumubai.cc/post/96

ETH RPC搭建的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國(guó)家法律
新安县| 安福县| 灵璧县| 织金县| 宜良县| 洪雅县| 图片| 桓台县| 武宁县| 济源市| 惠东县| 武穴市| 于都县| 胶州市| 屯门区| 天祝| 兴业县| 光山县| 庄浪县| 海盐县| 淳化县| 远安县| 嘉黎县| 肥西县| 曲沃县| 宣汉县| 永平县| 东平县| 灌南县| 南投市| 阿拉善右旗| 淄博市| 乌拉特前旗| 荃湾区| 顺义区| 车险| 六安市| 阿克陶县| 江源县| 苍梧县| 柳江县|