Dynamic Traversers in TrueBlocks

Using TrueBlocks to get Permissionless Data

We assume you’ve read some of our previous articles concerning how TrueBlocks creates and publishes an index of address appearances. We won’t rehash that in this article.

chifra init
chifra list 0xf503017d7baf7fbc0fff7492b751025c6a78179b
chifra export 0xf503017d7baf7fbc0fff7492b751025c6a78179b
chifra export --help

Traversers

Under the hood of TrueBlocks, there is a piece of code called a Traverser. A Traverser “traverses” the list of appearances, queries the chain for transactional detail, and calls into whatever functions are associated with the Traverser.

Dynamic Traversers

Recently, we added an amazing new feature to TrueBlocks called “Dynamic Traversers.” The word “dynamic” has special meaning here, harkening back to an ancient computing idea called dynamic link libraries. A dynamic traverser is a dynamic link library that you can customize.

C++ Code

I know many of you will feel flummoxed at having to use C++. Here’s our reaction to your concerns: “Get over it! It’s so freaking worth it.”

Example Folder

Assuming you’ve downloaded and installed TrueBlocks correctly, you may create your own Dynamic Traverser by completing these tasks. We’ll first build a simple example and then build a more complicated traverser that calculates the gas spent (and lost to error) by a given address.

cd ./src/examples/dynamic
make trav1
cp -p ./libtrav1.dylib $CONFIG/cache/obj/
chifra export --load libtrav1.dylib 0xf503017d...6a78179b

Example GasCost Traverser

Next we present another example in that same folder called trav2. Build it with the following commands:

cd ./src/examples/dynamic
make trav2
cp -p ./libtrav2.dylib $CONFIG/cache/objs/
chifra export --load libtrav2.dylib 0xf503017d...6a78179b

Conclusion

Don’t build stuff if you don’t want to end up with the result. That’s what we always say. If you want the benefits of global permissionless data, you have to build a system that presents global permissionless data. That’s a simple straight-forward statement of fact. It’s won’t be easy, but it will be very much worth it.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Thomas Jay Rush

Thomas Jay Rush

Blockchain Enthusiast, Founder TrueBlocks, LLC and Philadelphia Ethereum Meetup, MS Computer Science UPenn