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 @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.

H2
H3
H4
3 columns
2 columns
1 column
Join the conversation now