Just finished first version of comment edit history plugin, source code is here: https://github.com/abitmore/steem/tree/dev-comment-history-plugin
How to use
1- Compile
In local steemd directory,
git remote add abit https://github.com/abitmore/steem.git
git fetch abit
git checkout v0.14.2
git merge abit/dev-comment-history-plugin
git submodule update --init --recursive
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_CONTENT_PATCHING=OFF -DLOW_MEMORY_NODE=ON ..
make steemd
2- Edit config.ini, enable the plugin and API:
# Set an API to be publicly available, may be specified multiple times
public-api = database_api login_api comment_history_api
# Plugin(s) to enable, may be specified multiple times
enable-plugin = witness comment_history
3- Start steemd with --rpc-endpoint and --replay
cd /parent/path/to/data
/path/to/steemd -s seed.steemed.net:2001 --rpc-endpoint --replay
4- Query
wscat -c ws://127.0.0.1:8090/ws/
> {"id": 1, "jsonrpc": "2.0", "method": "call", "params": [2, "get_comment_history", ["bluehorseshoe","a-simple-how-to-charcoal-grill-a-damn-good-t-bone-steak"]]}
< {"id":1,"result":[{"author":"bluehorseshoe","permlink":"a-simple-how-to-charcoal-grill-a-damn-good-t-bone-steak","block":5783105,"trx_in_block":2,"op_in_trx":0},{"author":"bluehorseshoe","permlink":"a-simple-how-to-charcoal-grill-a-damn-good-t-bone-steak","block":5783119,"trx_in_block":2,"op_in_trx":0},{"author":"bluehorseshoe","permlink":"a-simple-how-to-charcoal-grill-a-damn-good-t-bone-steak","block":5783196,"trx_in_block":3,"op_in_trx":0},{"author":"bluehorseshoe","permlink":"a-simple-how-to-charcoal-grill-a-damn-good-t-bone-steak","block":5783265,"trx_in_block":5,"op_in_trx":0},{"author":"bluehorseshoe","permlink":"a-simple-how-to-charcoal-grill-a-damn-good-t-bone-steak","block":5783468,"trx_in_block":5,"op_in_trx":0}]}
With this API we can get the block number and the transaction id in the block and operation id in the transaction, then we can use get_block API to get more detailed data.
TODO
- return detailed data directly? If do, return patched content or the diff only?
Please advice.
//Update 1:
Related feature request on github: https://github.com/steemit/steemit.com/issues/21
Hope to see this in a release soon!
I suggest returning the patched content as this will make it less work for end clients.
Thanks for discussing.
If the node or plugin store a copy of full content for every patch, it will definitely use a lot of RAM. From this point of view I tend to encourage clients to apply patches by their own. If the node/API re-apply patches for every query, it will probably be expensive to compute, but seems doable.
What is the purpose of this? See how one edited his comment?
Yes.
cool. Tech Genius FTW!