python-bitshares: How to derive transaction ids

View this thread on: d.buzz | hive.blog | peakd.com | ecency.com
·@xeroc·
0.000 HBD
python-bitshares: How to derive transaction ids
![](https://bitshares.org/images/transparent_b.png)

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:

```python
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.
👍 , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,