deprecated
b-harvest / terra_oracle_voter_deprecated Goto Github PK
View Code? Open in Web Editor NEWautovoting script for Terra oracle
autovoting script for Terra oracle
deprecated
$ pip install -r requirements.txt
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: certifi==2019.11.28 in /home/terra/.local/lib/python3.8/site-packages (from -r requirements.txt (line 1)) (2019.11.28)
Requirement already satisfied: requests==2.22.0 in /home/terra/.local/lib/python3.8/site-packages (from -r requirements.txt (line 4)) (2.22.0)
Requirement already satisfied: urllib3==1.25.8 in /home/terra/.local/lib/python3.8/site-packages (from -r requirements.txt (line 7)) (1.25.8)
Requirement already satisfied: prometheus_client==0.7.1 in /home/terra/.local/lib/python3.8/site-packages (from -r requirements.txt (line 10)) (0.7.1)
Requirement already satisfied: chardet==3.0.4 in /usr/lib/python3/dist-packages (from -r requirements.txt (line 12)) (3.0.4)
Requirement already satisfied: idna==2.9 in /home/terra/.local/lib/python3.8/site-packages (from -r requirements.txt (line 15)) (2.9)
Requirement already satisfied: aiohttp==3.6.2 in /home/terra/.local/lib/python3.8/site-packages (from -r requirements.txt (line 18)) (3.6.2)
Requirement already satisfied: multidict==4.7.5 in /home/terra/.local/lib/python3.8/site-packages (from -r requirements.txt (line 31)) (4.7.5)
Requirement already satisfied: attrs==19.3.0 in /home/terra/.local/lib/python3.8/site-packages (from -r requirements.txt (line 49)) (19.3.0)
Requirement already satisfied: async-timeout==3.0.1 in /home/terra/.local/lib/python3.8/site-packages (from -r requirements.txt (line 52)) (3.0.1)
Requirement already satisfied: yarl==1.4.2 in /home/terra/.local/lib/python3.8/site-packages (from -r requirements.txt (line 55)) (1.4.2)
Requirement already satisfied: typing-extensions==3.7.4.1 in /home/terra/.local/lib/python3.8/site-packages (from -r requirements.txt (line 73)) (3.7.4.1)
Requirement already satisfied: idna_ssl==1.1.0 in /home/terra/.local/lib/python3.8/site-packages (from -r requirements.txt (line 77)) (1.1.0)
$ pip3 install prometheus_client
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: prometheus_client in /home/terra/.local/lib/python3.8/site-packages (0.7.1)
$ ./terra_oracle_vote.py
Traceback (most recent call last):
File "./terra_oracle_vote.py", line 25, in <module>
from prometheus_client import start_http_server, Summary, Counter, Gauge, Histogram
ModuleNotFoundError: No module named 'prometheus_client'
$ python3 -V
Python 3.6.9
Sometimes the script sends exchange rate: -1
and in log I get this:
Traceback (most recent call last):
File "/opt/oracle/terra_oracle_voter/terra_oracle_vote.py", line 288, in get_fx_rate
api_result[list_number]["Realtime Currency Exchange Rate"]["5. Exchange Rate"])
KeyError: 'Realtime Currency Exchange Rate'
I added a print(api_result[list_number])
and get this:
https://pastebin.com/GZP77zid
I also changed keys for alphavantage but the result doesn't change.
Whien I run systemctl start oracle
i got this error:
โ oracle.service - Terra Oracle
Loaded: loaded (/etc/systemd/system/oracle.service; disabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Fri 2020-10-30 12:23:40 CET; 352ms ago
Process: 27222 ExecStart=/usr/bin/python3 -u ~/terra_oracle_voter/terra_oracle_vote.py (code=exited, status=217/USER)
Main PID: 27222 (code=exited, status=217/USER)
Oct 30 12:23:40 VPS001 systemd[1]: oracle.service: Main process exited, code=exited, status=217/USER
Oct 30 12:23:40 VPS001 systemd[1]: oracle.service: Failed with result 'exit-code'.
So I tryed to run python3 terra_oracle_vote.py
and I got this error:
INFO:root:360694: wait 1.0 blocks until this round ends...
ERROR:root:Error in get_fx_rate
Traceback (most recent call last):
File "terra_oracle_vote.py", line 340, in get_fx_rate
api_result[list_number]["Realtime Currency Exchange Rate"]["5. Exchange Rate"])
KeyError: 'Realtime Currency Exchange Rate'
INFO:root:Active set: ['uusd', 'ukrw', 'usdr', 'umnt']
INFO:root:Prevoting uusd : 0.30417889744729815(percent_change:-0.0800%)
INFO:root:Prevoting ukrw : 344.6969567396699(percent_change:-0.1313%)
INFO:root:Prevoting usdr : 0.21539824964782237(percent_change:-0.2183%)
INFO:root:Prevoting umnt : 867.9894724548534(percent_change:0.0239%)
INFO:root:Start voting on height 360696
INFO:root:Broadcast prevotes only...
INFO:root:Prevoting...
INFO:root:Signing...
Traceback (most recent call last):
File "terra_oracle_vote.py", line 1087, in <module>
broadcast_prevote(this_hash)
File "terra_oracle_vote.py", line 717, in broadcast_prevote
return broadcast_messages([
File "terra_oracle_vote.py", line 688, in broadcast_messages
cmd_output = subprocess.check_output([
File "/usr/lib/python3.8/subprocess.py", line 411, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "/usr/lib/python3.8/subprocess.py", line 489, in run
with Popen(*popenargs, **kwargs) as process:
File "/usr/lib/python3.8/subprocess.py", line 854, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/lib/python3.8/subprocess.py", line 1702, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'sudo /usr/bin/terracli'
if I run sudo /usr/bin/terracli
terracli start
What are these referring to?
Environment=FCSAPI_KEY=
Environment=FEEDER_ADDRESS=
Jun 22 21:49:02 node python3[28764]: INFO:root:2487444: wait 1.0 blocks until this round ends...
Jun 22 21:49:11 node python3[28764]: ERROR:root:Error in get_fx_rate
Jun 22 21:49:11 node python3[28764]: Traceback (most recent call last):
Jun 22 21:49:11 node python3[28764]: File "/home/terra/scripts/terra_oracle_voter/terra_oracle_vote.py", line 297, in get_fx_rate
Jun 22 21:49:11 node python3[28764]: api_result[list_number]["Realtime Currency Exchange Rate"]["5. Exchange Rate"])
Jun 22 21:49:11 nod1 python3[28764]: KeyError: 'Realtime Currency Exchange Rate'
Jun 22 21:49:11 node python3[28764]: INFO:root:Active set: ['uusd', 'ukrw', 'usdr', 'umnt']
using current version. prevotes/votes are being cast normally
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.