Is it possible to find out the transactionId from within an action?
I know I can access the block_num and a few other details using the tapos function but I did not find similar for transactionId.
Note: I did find the following in contracts/test_api/test_transaction.h that seems to work:
void test_transaction::test_read_transaction() {
using namespace eosio;
checksum256 h;
auto size = transaction_size();
char buf[size];
uint32_t read = read_transaction( buf, size );
eosio_assert( size == read, "read_transaction failed");
sha256(buf, read, &h);
printhex( &h, sizeof(h) );
}
I tested with an action and the printed string _seems_ to work for cleos get transaction ....
I didnt know if there was another (better) way.
This is not available for now. However, we'll treat it as a future enhancement.
Note: I did find the following in contracts/test_api/test_transaction.h that seems to work:
void test_transaction::test_read_transaction() { using namespace eosio; checksum256 h; auto size = transaction_size(); char buf[size]; uint32_t read = read_transaction( buf, size ); eosio_assert( size == read, "read_transaction failed"); sha256(buf, read, &h); printhex( &h, sizeof(h) ); }I tested with an action and the printed string _seems_ to work for
cleos get transaction ....I didnt know if there was another (better) way.
Have you solve this problem, I also want to get transaction id offline.
Created #6289 to address this
Most helpful comment
Note: I did find the following in contracts/test_api/test_transaction.h that seems to work:
I tested with an action and the printed string _seems_ to work for
cleos get transaction ....I didnt know if there was another (better) way.