Beem-0.20.14: beempy verify --use-api fails with TypeError

Project Information

The beempy verify command allows users to check "who" signed operations on the blockchain. This enables in some cases to distinguish bot-votes and manual votes, or provides information on which dApp acted in the name of the user. The beempy verify command has a --use-api option that instructs the tool to use the get_potential_signatures Steem API call to find the signers of transactions.

A GitHub issue as well as a Pull Request to fix the problem were created. The PR was approved and merged by the PO and the fix will be part of the next beem release.

Expected behavior

beempy verify --trx [trx_num] --use-api [block_num] should use the get_potential_signatures call to find the signing keys for a given block or transaction.

Actual behavior

beempy verify --trx [trx_num] --use-api [block_num] raises a TypeError.

How to reproduce

# beempy verify --trx 37 --use-api 28592655
Traceback (most recent call last):
[...]
  File "/usr/local/lib/python3.6/site-packages/beem/cli.py", line 3146, in verify
    public_keys = tx.get_potential_signatures()
  File "/usr/local/lib/python3.6/site-packages/beem/transactionbuilder.py", line 339, in get_potential_signatures
    ret = self.steem.rpc.get_potential_signatures(args, api="database")
  File "/usr/local/lib/python3.6/site-packages/beemapi/graphenerpc.py", line 467, in method
    query = get_query(self.is_appbase_ready() and not self.use_condenser, self.get_request_id(), api_name, name, args)
  File "/usr/local/lib/python3.6/site-packages/beemapi/rpcutils.py", line 33, in get_query
    args = json.loads(json.dumps(args))
[...]
TypeError: Object of type 'datetime' is not JSON serializable

Fix

The problem in this case was that the corresponding raw transaction data was parsed already and timestamp strings were replaced by datetime objects. The TransactionBuilder class used to load that transaction tried to JSON-serialize these objects and failed. By passing the raw JSON transaction data to the TransactionBuilder class instead of the preprocessed data, the class can properly serialized the data. See PR#138.

GitHub Account

https://github.com/crokkon

H2
H3
H4
Upload from PC
Video gallery
3 columns
2 columns
1 column
4 Comments