Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Trying to fix claim_reward_balance for Blurt compatibility #293

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Saboin
Copy link

@Saboin Saboin commented Apr 4, 2021

I set out to try fixing the claim_reward_balance so that it would work on Blurt.
I started by fixing reward_balances.
That now works correctly. Example:

>>> a.reward_balances
[0.000 BLURT, 56.055241 VESTS]

Before, it would return an empty list.

Then I tried fixing the claim_reward_balance. I've managed to get it to build the transaction and broadcast it, but the RPC rejects the transaction saying that it's missing posting authority.

If I do it with blurt.nobroadcast=True, the returned transaction looks okay:

>>> blurt.nobroadcast=True
>>> a.claim_reward_balance()
{'expiration': '2021-04-04T03:09:03', 'ref_block_num': 23150, 'ref_block_prefix': 3025359504, 'operations': [['claim_reward_balance', {'account': 'saboin', 'reward_blurt': '0.000 BLURT', 'reward_vests': '56.055241 VESTS'}]], 'extensions': [], 'signatures': ['1f29e691eefe2ca6ae93bc3c5477fe89480058fc9c2f1312b741b64ff3c98de2304cbf6daa5748d7900d88f685c6f62d8171520e4357050308ac2740e2ea205e5e'], 'trx_id': '8285c641085bb52d8aa175eb3bf4c147050a6535'}

But if I do it with blurt.nobroadcast=False, it gets rejected as if it's not signed correctly, and that's where I'm stuck. This part is a bit beyond my ability.

Here's the traceback if it can help point someone in the right direction:

>>> blurt.nobroadcast=False
>>> a.claim_reward_balance()
Traceback (most recent call last):
** IDLE Internal Exception: 
  File "/Users/Saboin/Library/Python/3.8/lib/python/site-packages/beem-0.24.22-py3.8.egg/beemapi/noderpc.py", line 62, in rpcexec
    reply = super(NodeRPC, self).rpcexec(payload)
  File "/Users/Saboin/Library/Python/3.8/lib/python/site-packages/beem-0.24.22-py3.8.egg/beemapi/graphenerpc.py", line 457, in rpcexec
    raise RPCError(ret['error']['message'])
beemapi.exceptions.RPCError: missing required posting authority:Missing Posting Authority saboin

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<pyshell#79>", line 1, in <module>
    a.claim_reward_balance()
  File "/Users/Saboin/Library/Python/3.8/lib/python/site-packages/beem-0.24.22-py3.8.egg/beem/account.py", line 3197, in claim_reward_balance
    return self.blockchain.finalizeOp(op, account, "posting", **kwargs)
  File "/Users/Saboin/Library/Python/3.8/lib/python/site-packages/beem-0.24.22-py3.8.egg/beem/blockchaininstance.py", line 937, in finalizeOp
    ret = self.txbuffer.broadcast()
  File "/Users/Saboin/Library/Python/3.8/lib/python/site-packages/beem-0.24.22-py3.8.egg/beem/transactionbuilder.py", line 558, in broadcast
    raise e
  File "/Users/Saboin/Library/Python/3.8/lib/python/site-packages/beem-0.24.22-py3.8.egg/beem/transactionbuilder.py", line 553, in broadcast
    self.blockchain.rpc.broadcast_transaction(
beemapi.exceptions.UnhandledRPCError: missing required posting authority:Missing Posting Authority saboin
>>>

@Saboin
Copy link
Author

Saboin commented Apr 5, 2021

I figured out what the problem is.

The operation IDs are not the same on Hive and Blurt. Only the first five are the same. This is why it wasn't able to sign the Blurt operation correctly.

I tried replacing the list of operations in beembase/operationids.py with the Blurt operations, and then it signed the transaction correctly.

I got the list of operations from here:
https://gitlab.com/blurt/blurt/-/blob/dev/libraries/protocol/include/blurt/protocol/operations.hpp

I don't know if you want to go through the trouble of making Beem completely compatible with both Hive and Blurt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant