steemit / steem-python

The official Python (3) library for the Steem Blockchain.
https://steem.io
MIT License
154 stars 100 forks source link

Claiming Reward Balance gives MissingKeyError #188

Closed camponez closed 6 years ago

camponez commented 6 years ago

I was trying to use the claim_reward_balance(). It worked for sometime, but two days ago it stops working.

The code:

from steem import Steem
from steem.commit import Commit

c =  Commit(steem=Steem(keys=[POST_KEY, ACTIVE_KEY]))

 c.claim_reward_balance()
MissingKeyError                           Traceback (most recent call last)
<ipython-input-6-537da9054b42> in <module>()
----> 1 c.claim_reward_balance()

/usr/local/lib/python3.6/dist-packages/steem-1.0.0-py3.6.egg/steem/commit.py in claim_reward_balance(self, reward_steem, reward_sbd, reward_vests, account)
    912                 "reward_vests": reward_vests,
    913             })
--> 914         return self.finalizeOp(op, account, "posting")
    915
    916     def delegate_vesting_shares(self, to_account, vesting_shares,

/usr/local/lib/python3.6/dist-packages/steem-1.0.0-py3.6.egg/steem/commit.py in finalizeOp(self, ops, account, permission)
    130         else:
    131             tx.appendSigner(account, permission)
--> 132             tx.sign()
    133
    134         return tx.broadcast()

/usr/local/lib/python3.6/dist-packages/steem-1.0.0-py3.6.egg/steem/transactionbuilder.py in sign(self)
    119
    120         if not any(self.wifs):
--> 121             raise MissingKeyError
    122
    123         signedtx.sign(self.wifs, chain=self.steemd.chain_params)

MissingKeyError:
Boontjie commented 6 years ago

I am not getting a missing key error, but also Bad Cast on claiming reward balance, see #187 . I think new changes affect all 'call' operations where parameters are passed. I am not sure how to restructure them to work at this point in time

Boontjie commented 6 years ago

See my issue, try not using api.steemit node

camponez commented 6 years ago

I can't even get the error anymore. stempy config just hangs there as does c = Commit(steem=Steem(keys=[POST_KEY, ACTIVE_KEY])).

Where do I clear the steempy configuration?

cyon1c commented 6 years ago

This is due to our switch to appbase on api.steemit.com, and those changes not being included in steem-python. I will be working to get this resolved today.

bobinson commented 6 years ago

@cyon1c - thats some exciting news!

camponez commented 6 years ago

I get this error on different api...

roadscape commented 6 years ago

@camponez try using this code as reference: https://github.com/steemit/steem-python/pull/195/files#diff-94ce5c94e607bee610742036bb262f0eR23

devopsjourney1 commented 6 years ago

I can't get s.claim_reward_balance(account='accountnamehere') to work with any node. This functionality stopped working for me a few weeks ago

>>> s.claim_reward_balance(account='accountnamehere') Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python3.6/site-packages/steem/commit.py", line 914, in claim_reward_balance return self.finalizeOp(op, account, "posting") File "/usr/local/lib/python3.6/site-packages/steem/commit.py", line 134, in finalizeOp return tx.broadcast() File "/usr/local/lib/python3.6/site-packages/steem/transactionbuilder.py", line 139, in broadcast raise e File "/usr/local/lib/python3.6/site-packages/steem/transactionbuilder.py", line 136, in broadcast if not self.steemd.verify_authority(self.json()): File "/usr/local/lib/python3.6/site-packages/steem/steemd.py", line 754, in verify_authority 'verify_authority', signed_transaction, api='database_api') File "/usr/local/lib/python3.6/site-packages/steembase/http_client.py", line 243, in call return_with_args=return_with_args) File "/usr/local/lib/python3.6/site-packages/steembase/http_client.py", line 263, in _return raise RPCError(error_message) steembase.exceptions.RPCError: Bad Cast:Invalid cast from string_type to Array

cyon1c commented 6 years ago

Do you have a list of nodes you've tried against? @firemouse604

camponez commented 6 years ago

Weird... I'm still seeing this problem but just with one of my accounts...

camponez commented 6 years ago

Weird... I'm still seeing this problem but just with one of my accounts...

On the account that it's working I get the error: ERROR:root:Downgrade-retry steemd.minnowsupportproject.org

roadscape commented 6 years ago

Is anyone able to confirm this issue is resolved on master branch?

devopsjourney1 commented 6 years ago

Yes, just updated and it seems to be resolved now. Thank you.

roadscape commented 6 years ago

@camponez if it only affects 1 account it's probably due to a WIF/config issue.

I believe the other concerns in this issue should be resolved now, please leave a comment if this is not the case.

camponez commented 6 years ago

@roadscape Yes. Same problem. It only works for one account, not work for two others....

if it only affects 1 account it's probably due to a WIF/config issue.

I'm able to call check_reward(). Only claim(), does not work. I can also vote with those accounts. Only claim() has the problem. Very weird to be for 1 of 3 accounts only.

btw, steempy always say 1.0.0. Is there a way to find if I'm using the latest? maybe add part of the sha to the version?

roadscape commented 6 years ago

@camponez you might be using an old version. We need to update the pypi repo still. I recommend checking your script against master on this repository.

camponez commented 6 years ago

@roadscape I thought that I was running master. I'm doing sudo python setup.py install in the master branch.

$ steempy --version
steempy 1.0.0

is there another way to check which version I'm running?

cyon1c commented 6 years ago

Hey @camponez, I want to trouble shoot a couple things did you use git to clone the repo? If so, can you run git pull origin master and then git log to check that you have all the newest changes by comparing the last commit hash with the tip of master on github.

I noticed your command is sudo python setup.py install, which means you've installed steem-python as a Python 2 library. In your original logs, your traceback shows you are using Python 3.6. I would recommend trying python3 setup.py install and then try this again.

If this still does not work, re-importing the account should solve the issue. In the event that still does not, please report back and I can re-open and investigate further.

camponez commented 6 years ago

@cyon1c

However, when I run on ipython:

import steem
help(steem)
NAME
    steem - # -*- coding: utf-8 -*-

PACKAGE CONTENTS
    account
    aes
    amount
    block
    blockchain
    blog
    cli
    commit
    converter
    dex
    instance
    post
    profile
    steem
    steemd
    transactionbuilder
    utils
    wallet
    witness

VERSION
    0.18.103

FILE
    /usr/local/lib/python3.6/dist-packages/steem-1.0.0-py3.6.egg/steem/__init__.py
camponez commented 6 years ago

I found the error!

It's strange because it had worked before. Problem was on my code. I needed to pass accountto c.claim_reward_balance()

Look good now! :)