BitShares Forum
Main => Technical Support => Topic started by: madforstrength on May 25, 2016, 06:54:04 am
-
Hi @xeroc ,
Is there any way I can get block number from transaction?
I am getting this:
{
"ref_block_num": 58752,
"ref_block_prefix": 3236012376,
"expiration": "2016-05-25T06:54:00",
"operations": [[
0,{
"fee": {
"amount": 264174,
"asset_id": "1.3.0"
},
"from": "1.2.98834",
"to": "1.2.101520",
"amount": {
"amount": 10000,
"asset_id": "1.3.0"
},
"extensions": []
}
]
],
"extensions": [],
"signatures": [
"1f24ed1f4e129dbba3973406aea2c6c7443eab11f85d7daeb66e7992273ca959b80c98ddc2704bcd21c679d8b4d4011951f05b4ea41ac934c4d6b9429106ad1c8c"
]
}
-
That is a signed transcation .. if you put this as argument of "get_transaction_id" you will get a transaction id ..
Then there is "get_recent_transaction_by_id"
https://bitshares.org/doxygen/classgraphene_1_1app_1_1database__api.html#ac1475ae15f2b5398a08a68d067051e92
not sure if it tells you the blocknumber though ..
-
Hello @xeroc,
Thanks for your reply, well "get_recent_transaction_by_id" also does not return block number :(
In the mobile wallet of bitshares they are somehow getting blocknumber and transaction id after transaction is included in the blockchain. (TransactionConfirmStore.js) Do you have any idea how they are getting it?
-
Maybe @svk can figure that out
-
Hi @xeroc,
I found that they are using "broadcast_transaction_with_callback" to get the block number.
I have tried to call this using python graphenelib the transaction was broadcasted but it returned none. So I think I need to somehow add listener for callback.
This is what I have tried:
client1.setObjectCallbacks({"registered-network-broadcast": config.trx_callback})
print(client1.ws.broadcast_transaction_with_callback(0,res, api="network_broadcast"))
Can you help me out in this?
-
Hi @xeroc,
I found that they are using "broadcast_transaction_with_callback" to get the block number.
I have tried to call this using python graphenelib the transaction was broadcasted but it returned none. So I think I need to somehow add listener for callback.
This is what I have tried:
client1.setObjectCallbacks({"registered-network-broadcast": config.trx_callback})
print(client1.ws.broadcast_transaction_with_callback(0,res, api="network_broadcast"))
Can you help me out in this?
"broadcast_transaction_with_callback" is a call that requires websockets for the callback .. you can't use it via RPC easily unfortunatelly :(