python-peerplays
python-peerplays copied to clipboard
Trouble using Witness object
After resolving the ssl certificate problem on all of my nodes and successfully being able to connect to them using python-peerplays, I am getting an exception:
peerplays.exceptions.AccountDoesNotExistsException: baxters-sports-witness
This exact, simple code works in python-bitshares, but not in python-peerplays. The only differences I can see is that in bitshares my witness account name has no dashes in it whereas in peerplays it does, and the length of the name is much longer in the failure case. I added the active key for the witness account to the SQLite wallet after pulling it from my active witness wallet using "dump_private_keys". I also verified the key is correct by comparing to what I saved in my key vault.
API = PeerPlays(API_NODES, nobroadcast=False)
print(ACNT) <--- prints correct account name, including dashes
status = Witness(ACNT) <--- this call fails
print(status['signing_key'])
exit(-10)
I also tried this to eliminate issues with private key, length and the dash as possible causes:
# account = Account("taconator\x2Dwitness")
# account = Account("roelandp")
account = Account("init0")
print(account.balances) <-- it printed "[4,359.99946 PPY]"
exit(-10)
All failed except init0. I then tried to verify the chainId using:
print(API.info())
and it printed everything except the chainId (which is 6b6b5f0ce7a36d323768e534f3edb41c6d6332a541a95725b98e28d140850134):
{'recently_missed_count': 0, 'current_witness': '1.6.12', 'last_budget_time': '2018-03-29T23:00:00', 'witness_budget': 321175, 'head_block_number': 8463816, 'id': '2.1.0', 'random': 'e6a71bc39291540dfc3c2011d68144ab8d4561f7', 'time': '2018-03-29T23:38:00', 'recent_slots_filled': '340282366920938463463374607431768211455', 'dynamic_flags': 0, 'next_maintenance_time': '2018-03-30T00:00:00', 'head_block_id': '008125c8681c2396a9a146ba3958d11714fd9b7a', 'last_irreversible_block_num': 8463803, 'current_aslot': 8512624, 'accounts_registered_this_interval': 0}
If I'm doing something wrong (I'm now rather doubtful I am) it is mighty subtle.
Works here:
>>> w = Witness("baxters-sports-witness")
>>> dict(w)
{'id': '1.6.35', 'witness_account': '1.2.8923', 'last_aslot': 8693396, 'signing_key': 'PPY6MKyWpWzmiDWNvy9mLjdvCi1RofrwKYeRnW3Zdc61GyPDcGD4N', 'next_secret_hash': '3770b8a296cb1d063bb77a2f8b811e356b9e4fb2', 'previous_secret': 'e236b03701fe0b5013a5163942fa1aa8c693de59', 'pay_vb': '1.13.39', 'vote_id': '1:42', 'total_votes': '92595213895', 'url': 'http://bit.ly/2tbowRU', 'total_missed': 358, 'last_confirmed_block_num': 8644562}
However, I am on develop
branch. Gonna do a fresh release in a second. Then please upgrade and try again.
Chain_id is not part of info(), same as with bitshares (uptick vs. peerplays):
➜ ~ uptick info
+-----------------------------------+------------------------------------------+
| Key | Value |
+-----------------------------------+------------------------------------------+
| accounts_registered_this_interval | 34 |
| current_aslot | 25991299 |
| current_witness | 1.6.22 |
| dynamic_flags | 0 |
| head_block_id | 018a5b435d1383cc80cbada8e6fe9374009a6245 |
| head_block_number | 25844547 |
| id | 2.1.0 |
| last_budget_time | 2018-04-05T06:00:00 |
| last_irreversible_block_num | 25844533 |
| next_maintenance_time | 2018-04-05T07:00:00 |
| recent_slots_filled | 340282366920938463463374607431768211455 |
| recently_missed_count | 0 |
| time | 2018-04-05T06:40:33 |
| witness_budget | 39200000 |
+-----------------------------------+------------------------------------------+
➜ ~ peerplays info
+-----------------------------------+------------------------------------------+
| Key | Value |
+-----------------------------------+------------------------------------------+
| accounts_registered_this_interval | 0 |
| current_aslot | 8693423 |
| current_witness | 1.6.54 |
| dynamic_flags | 0 |
| head_block_id | 0083e7edca98aafec796688094e31994ccec21aa |
| head_block_number | 8644589 |
| id | 2.1.0 |
| last_budget_time | 2018-04-05T06:00:00 |
| last_irreversible_block_num | 8644579 |
| next_maintenance_time | 2018-04-05T07:00:00 |
| random | a3f7421ff9f098594def2e7fa71d3a23a300d5c5 |
| recent_slots_filled | 340282366920938463463374607431768211455 |
| recently_missed_count | 0 |
| time | 2018-04-05T06:40:36 |
| witness_budget | 283475 |
+-----------------------------------+------------------------------------------+
Still not working for me after upgrading: ... Installing collected packages: treelib, peerplays Found existing installation: peerplays 0.1.15 Uninstalling peerplays-0.1.15: Successfully uninstalled peerplays-0.1.15 Successfully installed peerplays-0.1.16 treelib-1.5.1
(pyppy) admin@ppy003 $ ./testPPYconn.py
Traceback (most recent call last):
File "./testPPYconn.py", line 45, in <module>
status = Witness(ACNT)
File "/home/admin/.virtualenvs/pyppy/lib/python3.5/site-packages/peerplays/blockchainobject.py", line 96, in __init__
self.refresh()
File "/home/admin/.virtualenvs/pyppy/lib/python3.5/site-packages/peerplays/witness.py", line 27, in refresh
self.identifier, peerplays_instance=self.peerplays)
File "/home/admin/.virtualenvs/pyppy/lib/python3.5/site-packages/peerplays/account.py", line 51, in __init__
peerplays_instance=peerplays_instance,
File "/home/admin/.virtualenvs/pyppy/lib/python3.5/site-packages/peerplays/blockchainobject.py", l line 96, in __init__
self.refresh()
File "/home/admin/.virtualenvs/pyppy/lib/python3.5/site-packages/peerplays/account.py", line 64, in refresh
raise AccountDoesNotExistsException(self.identifier)
peerplays.exceptions.AccountDoesNotExistsException: baxters-sports-witness
I created a fresh virtual env, downloaded a zip of the develop branch, unzipped it and changed to the python-peerplays-develop folder. I installed with pip3 install .
It behaves identical to the previous version (works for the init0 account but no others that I've tried):
(tst-ppy) admin@ppy003 $ ./testPPYconn.py
A wallet exists but the password won't unlock it.
Create a new wallet with the password you entered (y/n)?y
Are you REALLY sure?y
Done.
No wallet exists! Creating one now...
[998,359.99769 PPY] #<--- This shows init0 balance
(tst-ppy) admin@ppy003 $ ./testPPYconn.py
Traceback (most recent call last):
File "./testPPYconn.py", line 216, in <module>
account = Account("roelandp")
File "/home/admin/.virtualenvs/tst-ppy/lib/python3.5/site-packages/peerplays/account.py", line 51, in __init__
peerplays_instance=peerplays_instance,
File "/home/admin/.virtualenvs/tst-ppy/lib/python3.5/site-packages/peerplays/blockchainobject.py", line 96, in __init__
self.refresh()
File "/home/admin/.virtualenvs/tst-ppy/lib/python3.5/site-packages/peerplays/account.py", line 64, in refresh
raise AccountDoesNotExistsException(self.identifier)
peerplays.exceptions.AccountDoesNotExistsException: roelandp
Are you sure all your dependencies are declared in the setup? I'm Running python version 3.5.3 on $ uname -a Linux ppy003 4.9.0-6-amd64 #1 SMP Debian 4.9.82-1+deb9u3 (2018-03-02) x86_64 GNU/Linux
I now suspect there is a Debian issue. This is Debian 9 'Stretch'. I had to create a symbolic link to readline.so.6 --> readline.so.7, but even with that I can't get the witness_node to compile, so the platform apparently has issues.
If it weren't for the fact people have reported docker issues on other platforms, I'd blame by docker problem on the OS as well.
I dunno what the $^%#^ is missing / screwed up, but I highly suspect the OS now, especially since xeroc has looked at this and can't duplicate the issue.
Seems real odd it works for some accounts but not others, but with this extensive list of Stretch issues I have serious doubts about Debian's latest OS release. See the notes about it here: https://www.debian.org/releases/stretch/arm64/release-notes/ch-information.en.html
Baxter is the public testnet, not main net.
Make sure you connect to a node that talks to the public testnet.
From your quote, I see init0
has PPY
. Those don't exit on baxter! There they core token is called PPYTEST (IIRC)
Why do you assume I want to connect to Baxter? The witness name I'm using is on main net, and the api nodes are as well. This effort pre-dated the release of the bookie beta, but it was undertaken with that in mind.
I could try it on the testnet but this is a bare bones simple example that should work and doesn't. I also see that the bookie beta docker img was released on a Debian 9 OS base. I have not been able to make that work yet, but obviously it's possible. That is separate from python-peerplays, which should insulate python programs from OS peculiarities, generally speaking.