Fabian Schuh avatar

python-bitshares: How to derive transaction ids

xeroc

Published: 22 Jan 2018 › Updated: 22 Jan 2018python-bitshares: How to derive transaction ids

python-bitshares: How to derive transaction ids

Some developers might have noticed that python-graphene and python-bitshares are still pretty much in development.
That said, I finally got to figure out (thanks to abitmoreHive account@abitmore) how to derive transaction ids from a given transaction on the blockchain and quickly implemented this feature in python-bitshares.

From release 0.5.7 of python-graphene and with the next release of python-bitshares (currently in develop branch), you can obtain the transaction id of any transaction by simply:

from bitshares.block import Block
from bitsharesbase.signedtransactions import Signed_Transaction
block = Block(23743383)
tx = Signed_Transaction(**block["transactions"][2])
print(tx.id)

The Signed_Transaction expects keywords with identical names as on the blockchain, which explains the use of ** in front of the dictionary.

The attribute .id of tx is an internal method that derives the transaction id accordingly.
The resulting ids are similar to the ones derived by the cli_wallet and indexed by cryptofresh.com.

In the future, I intend to put more updates on libraries whenever nice features are included (such as the proposal subsystem of pybitshares which was released without further announcements ;D)

Have fun.

Leave python-bitshares: How to derive transaction ids to:

Written by

CEO of ChainSquad GmbH

Read more #bitshares posts


Best Posts From Fabian Schuh

We have not curated any of xeroc's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.

More Posts From Fabian Schuh