部署安装
git clone https://github.com/bcskill/eth-gasprices.git
cd eth-gasprices
pip3 install -r requirements.txt
服务运行
export ETH_RPC_URL=http://ip:8545
python3 gasprice.py -h 0.0.0.0 -p 8000
服务启动
cp gasprice.service /etc/systemd/system/gasprice.service
systemctl daemon-reload
systemctl start gasprice.service
systemctl status gasprice.service
或者
python3 gasprice.py -h 0.0.0.0 -p 8000 "$@" > ./stdout.txt 2> ./stderr.txt & echo $! > ./nodeos.pid
tail -f stderr.txt
测试访问
测试数据
{
"health": true,
"block_number": 26972,
"block_time": 2.261,
"slow": 24,
"standard": 25,
"fast": 54.955,
"instant": 100
}
数据解释
- slow 慢
- standard 标准
- fast 快速
- instant 即时
“慢”,“标准”,“快速”和“即时”值代表最近200个区块的最低汽油价格。 默认情况下,慢表示30%的概率,标准为60%,快为90%,即时为100%。
常见问题
numpy: Something is wrong with the numpy installation.
python3 gasprice.py
Traceback (most recent call last):
File "gasprice.py", line 4, in <module>
import pandas as pd
File "/home/surou/.local/lib/python3.6/site-packages/pandas/__init__.py", line 17, in <module>
"Unable to import required dependencies:\n" + "\n".join(missing_dependencies)
ImportError: Unable to import required dependencies:
numpy: Something is wrong with the numpy installation. While importing we detected an older version of numpy in ['/home/surou/.local/lib/python3.6/site-packages/numpy']. One method of fixing this is to repeatedly uninstall numpy until none is found, then reinstall this version.
解决方法
rm -rf ~/.local/lib/python3.6/site-packages/numpy
pip install numpy
No module named 'click'
ModuleNotFoundError: No module named 'click'
解决方法
pip3 install click
版权属于:区块链中文技术社区 / 转载原创者
本文链接:https://bcskill.com/index.php/archives/1055.html
相关技术文章仅限于相关区块链底层技术研究,禁止用于非法用途,后果自负!本站严格遵守一切相关法律政策!