create account

Full Nodes Will Have get_transaction Without account_history Plugin by inertia

View this thread on: hive.blogpeakd.comecency.com
· @inertia · (edited)
$16.71
Full Nodes Will Have get_transaction Without account_history Plugin
<div class="pull-right">
  <img src="https://cdn.steemitimages.com/DQmTLtJf11RPjY2wcrqafLs5Yh33K2QeEYBdnXQ9gRtbBke/image.png" />
</div>

# Background

Right now, if you want to run a full node, you have to make a tough decision about how to enable `account_history_api`.  You can back the `account_history_api` plugin with either `account_history` plugin or `account_history_rocksdb` plugin.

If you go with `account_history_rocksdb` plugin, you get better performance, but you lose `condenser_api.get_transaction` and `account_history_api.get_transaction ` (see: [#2309](https://github.com/steemit/steem/issues/2309)).

For that situation, we see:

```
This API is not supported for account history backed by RocksDB
```

**TL;DR:** In theory, you can use `account_history_rocksdb` and still have the ability to locate a `trx_id`  if ...

# Theory

There is a new API called `transaction_status_api` that hasn't been released yet.  But I suspect that once `transaction_status_api` has been merged into `steemd` (see: [#2458](https://github.com/steemit/steem/issues/2458)), API client tools should be able to simulate the original behavior of `*.get_transaction` by calling `transaction_status_api.find_transaction`, getting either `status` of `within_reversible_block` or `within_irreversible_block` along with the `block_num`.

Once we have `block_num`, we can request the block and grab the original transaction with `trx_id`.

**Update [2019-09-16]:** You *can* do this, but only for a 64,000 block window. I didn't know this at the time.

# Example

Start up a node that has `transaction_status_api` enabled ...

```curl
docker run -d -p 8090:8090 inertia/tintoy:transaction-status-api
```

I have a `trx_id` but no other information (in reality, I got this by asking for block 95 from `tintoy`):

```
070a2a89005ef3c4ef3d881d069d143f78861828
```

So I can call `transaction_status_api.find_transaction`:

```bash
curl -s --data '{"jsonrpc":"2.0", "method":"transaction_status_api.find_transaction", "params": {"transaction_id": "070a2a89005ef3c4ef3d881d069d143f78861828"}, "id":1}' http://localhost:8090 | jq
```

Returns:

```json
{
  "jsonrpc": "2.0",
  "result": {
    "status": "within_irreversible_block",
    "block_num": 95
  },
  "id": 1
}
```

Oh look!  It's from block 95.  Imagine that.  Now I ask for the block:

```bash
curl -s --data '{"jsonrpc":"2.0", "method":"block_api.get_block", "params":{"block_num":95}, "id":1}'  http://localhost:8090 | jq
```

In the result (not show, not enough resource credits today) I can look at `transaction_ids` and find my `trx_id`.  The index at my `trx_id` in `transaction_ids` is the same index at the transaction I want of `transactions`.  **It works, all without `account_history` plugin enabled!**
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 64 others
properties (23)
authorinertia
permlinkfull-nodes-will-have-gettransaction-without-accounthistory-plugin
categorysteem
json_metadata{"app":"steemit/0.1","tags":["steem","api","steemd","rocksdb"],"image":["https://cdn.steemitimages.com/DQmTLtJf11RPjY2wcrqafLs5Yh33K2QeEYBdnXQ9gRtbBke/image.png"],"links":["https://github.com/steemit/steem/issues/2309","https://github.com/steemit/steem/issues/2458"],"format":"markdown"}
created2018-12-03 09:35:51
last_update2019-09-16 13:55:51
depth0
children3
last_payout2018-12-10 09:35:51
cashout_time1969-12-31 23:59:59
total_payout_value12.699 HBD
curator_payout_value4.011 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length2,758
author_reputation346,568,901,399,561
root_title"Full Nodes Will Have get_transaction Without account_history Plugin"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id76,284,670
net_rshares27,143,304,133,822
author_curate_reward""
vote details (128)
@gtg ·
I guess, as long as it was built with `-DSKIP_BY_TX_ID=OFF`.
properties (22)
authorgtg
permlinkre-inertia-full-nodes-will-have-gettransaction-without-accounthistory-plugin-20181203t135229881z
categorysteem
json_metadata{"tags":["steem"],"app":"steemit/0.1"}
created2018-12-03 13:52:30
last_update2018-12-03 13:52:30
depth1
children0
last_payout2018-12-10 13:52:30
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length60
author_reputation461,829,867,647,270
root_title"Full Nodes Will Have get_transaction Without account_history Plugin"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id76,294,280
net_rshares0
@steem-plus ·
SteemPlus upvote
Hi, @inertia!

You just got a **2.61%** upvote from SteemPlus!
To get higher upvotes, earn more SteemPlus Points (SPP). On your Steemit wallet, check your SPP balance and click on "How to earn SPP?" to find out all the ways to earn.
If you're not using SteemPlus yet, please check our last posts in [here](https://steemit.com/@steem-plus) to see the many ways in which SteemPlus can improve your Steem experience on Steemit and Busy.
properties (22)
authorsteem-plus
permlinkfull-nodes-will-have-gettransaction-without-accounthistory-plugin---vote-steemplus
categorysteem
json_metadata{}
created2018-12-03 21:59:45
last_update2018-12-03 21:59:45
depth1
children0
last_payout2018-12-10 21:59:45
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length434
author_reputation247,952,188,232,400
root_title"Full Nodes Will Have get_transaction Without account_history Plugin"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id76,314,692
net_rshares0
@steem-ua ·
#### Hi @inertia!

Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your **UA** account score is currently 6.469 which ranks you at **#165** across all Steem accounts.
Your rank has not changed in the last three days.

In our last Algorithmic Curation Round, consisting of 219 contributions, your post is ranked at **#142**.
##### Evaluation of your UA score:

* You've built up a nice network.
* The readers like your work!
* Try to work on user engagement: the more people that interact with you via the comments, the higher your UA score!


**Feel free to join our [@steem-ua Discord server](https://discord.gg/KpBNYGz)**
properties (22)
authorsteem-ua
permlinkre-full-nodes-will-have-gettransaction-without-accounthistory-plugin-20181204t022550z
categorysteem
json_metadata"{"app": "beem/0.20.9"}"
created2018-12-04 02:25:51
last_update2018-12-04 02:25:51
depth1
children0
last_payout2018-12-11 02:25:51
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length678
author_reputation23,214,230,978,060
root_title"Full Nodes Will Have get_transaction Without account_history Plugin"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id76,323,460
net_rshares0