GithubHelp home page GithubHelp logo

trueblocks / trueblocks-core Goto Github PK

View Code? Open in Web Editor NEW
1.0K 14.0 190.0 599.39 MB

The main repository for the TrueBlocks system

Home Page: https://trueblocks.io

License: GNU General Public License v3.0

C++ 32.63% C 0.01% Shell 0.42% CMake 0.52% Python 0.81% Makefile 0.09% Go 62.15% Solidity 1.89% Dockerfile 0.03% Nix 0.01% Roff 0.03% JavaScript 0.06% TypeScript 1.35%
ethereum blockchain command-line-tools indexing

trueblocks-core's Introduction

If you have an existing installation, complete applicable Migrations before proceeding.


TrueBlocks / Unchained Index

GitHub repo size GitHub contributors GitHub stars GitHub forks Twitter Follow

Table of Contents

Introduction

TrueBlocks improves access to blockchain data for any EVM-compatible chain (particularly Ethereum mainnet) while remaining entirely local.

Features:

  • chifra init and chifra scrape which builds the Unchained Index, an index of address appearances that provides lightning-fast access to transactional histories,

  • An optional binary cache, which speeds up queries to the RPC by orders of magnitude,

  • Enhanced command-line options enabling much better access to chain data for data scientists and analysts. For example, easily extract all logs produced by a smart contract or view all ERC-20 holdings for an account, etc.,

  • Advanced tools for producing reconciled "bank statements" and accounting export for any token including ETH.

  • An infinite number of other things restricted only by your imagination.

Installing

Please see the installation instructions on our website.

Searching account histories

While optional, you most likely want to use the Unchained Index to search account histories. To do so, get the index.

Account explorer

You may use the command line, of course, to access data, but you may also wish to run an API server:

chifra daemon

Use curl to pull data or use it to drive our "pre-beta" Account Explorer. See installing the explorer. The API provides the identical tools and options as the command line and it documented here.

Generate gRPC files (developers only)

To regenerate gRPC files, you have to install protobuf tools:

brew install protobuf # Mac
go install google.golang.org/protobuf/cmd/[email protected]
go install google.golang.org/grpc/cmd/[email protected]

Command line

The TrueBlocks command-line tool is called chifra. This gives you access to all the other tools:

chifra --help

Get more help on any sub-command with chifra <cmd> --help. Full documentation is available on our website.

Chifra Serve

One of chifra's command line tools is called serve. This tool provides a simple API mimicing the command line. It is intended to be used only for single user enviroments.

To start the server, run:

chifra server

Chifra was built for the command line, a fact we purposefully take advantage of to ensure continued operation on small machines. As such, this tool is not intended to serve multiple end users in a cloud-based server environment. This is by design. Be forewarned.

Get more help on any sub-command with chifra <cmd> --help. Full documentation is available on our website.

Getting data

Let's look at the first subcommand, called status.

chifra status

If you get a bunch of data, congratulations, your installation is working. Try this command which shows every 10th block between the first and the 100,000th:

chifra blocks 0-100000:10

You should see a long stream of data. Kill the display with Control+C.

See the entire list of chifra commands with chifra --help.

Troubleshooting

Depending on your setup, you may get the following error message when you run some chifra commands:

  Warning: A request to your Ethereum node (http://localhost:8545)
  resulted in the following error [Could not connect to server].
  Specify a valid rpcProvider by editing $rootPath/trueblocks.toml.

Edit the file as instructed. You may find helpful answers on our FAQ.

See our blog for a lot of useful articles on getting started and using TrueBlocks.

If you continue to have trouble, join our discord discussion

The unchained index

The primary data structure produced by TrueBlocks is an index of address appearances called the Unchained Index. This index provides very quick access to transaction histories for any address.

You may either build the entire index from scratch (requires an EVM-compatible tracing/archive node) or you may download a snapshot of the index build from there.

This process is described in the article Indexing Addresses.

Docker version

Our official docker version is in a separate repo. Please see that repo for more information on running with Docker.

Documentation

The TrueBlocks documentation repo builds the TrueBlocks website. See our website for the best available documentation.

Linting

Our build process requires the code you submit to be linted.

In order to that, you must install the GoLang linters. See this page for more information.

To install the primary linter (called golangci-lint), run this command:

curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.53.3

Verify the installation with golangci-lint --version. You should see something like this:

golangci-lint has version 1.50.1 built from <commit> on <date>

Next, run golangci-lint linters. Your system should have at least the default list to properly lint your submission.

> golangci-lint linters


You are encouraged to use additional linters. If you do, and you think they're useful, please suggest that we add it to our build process.

Contributing

A chart showing the number of stars on our repo over time.

Stargazers over time

We love contributors. Please see information about our workflow before proceeding.

  1. Fork this repository into your own repo.
  2. Create a branch: git checkout -b <branch_name>.
  3. Make changes to your local branch and commit them to your forked repo: git commit -m '<commit_message>'
  4. Push back to the original branch: git push origin TrueBlocks/trueblocks-core
  5. Create the pull request.

Contact

If you have questions, comments, or complaints, please join the discussion on our discord server which is linked from our website.

List of Contributors

Thanks to the following people who have contributed to this project:

trueblocks-core's People

Contributors

arieltm avatar artur-jablonski avatar bardinpetr avatar cole-h avatar crodnun avatar cymule avatar daveappleton avatar defi-caratacus avatar dependabot[bot] avatar dszlachta avatar g-snipes avatar griffgreen avatar hanssonmagnus avatar johhonn avatar lefterisjp avatar mattdodsonenglish avatar mzhai2 avatar omahs avatar paulkuhle avatar perama-v avatar rainm avatar realvz avatar skemba avatar snf avatar srgank avatar tjayrush avatar vorot93 avatar wakamex avatar weijiekoh avatar wildmolasses avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

trueblocks-core's Issues

Chain reorgs

I’m not sure where to ask this. I’m running a node, but I’m not mining. Periodically, I retreive block and transaction data using RPC. It then save that data locally. I hear all this talk about re-orgs, so I would expect that once in a while, some of the data I pull would be “re-orged"

I should save data for X blocks. And then spin and re grab data fresh to check for re-orgs. This will be a big deal if the blocks are being re-orged, but I am not reflecting that.

From: https://github.com/Great-Hill-Corporation/ethslurp/issues/146

miniBlock database does not lock the file

If the freshener is running and I try to run speedTest, speedTest hangs because it cannot find the end of file. Freshener should fail if the miniBlock database is in memory, which it is in teh case of loading it.

Should handle default function and constructor better

I don't really handle the constructor or the default function correctly in the monitor code. Look for this code:

        if (!func.name.empty())
            functions[functions.getCount()] = func;

If you remove this, it will show a new line in the grabABI tests, but they are not correct.

makeClass config files

Storing the configuration files in a shared folder (~/.makeClass) doesn't work because classes conflict with each other with different implementations. Store the config files in the folders where the code arrives. Two reasons. Won't have to store the path in the file, and two generating source will be next to the code it generates. Right now, generating source is invisible.

ethslurp: Non-field display field tokens

Like [{NOW}], [{DATE:MONTH}] [{ADDR}] [{HEADER}][{RECORDS}] etc.

Also--these should be able to accept arbitrary internal text such as [Generated on {NOW}.] Perhaps this requires a new class called something like 'Generic'

Now that Slurp is a full fledged class it can take many additional fields for summary:

name
nTransactions
toValue
avgValue
largestValue
smallestValue
totalGasUsed
averageGasPrice
etc.

From https://github.com/Great-Hill-Corporation/ethslurp/issues/23

On first time parsing an ABI

Store the parsed variable in the input data field. It's easy to generate the input data from the data itself and an ABI, it's hard to generate the parsed data because for every transaction, we have to search through all signatures. Also-- we should add counter to function and sort the function in the ABI by most frequent first thereby lessening search time.

From https://github.com/Great-Hill-Corporation/ethslurp/issues/127

lastBlock is incorrect

If lastBlock is first picked up from config.toml file do not add one. If lastBlock comes from the lastBlock file or the cacheDisplay function do add a one. Simple, but annoying. Maybe better to always just write lastBlock - 1 to the file or return it from the function

ethslurp: In transactions.cpp parseParams needs to be removed

From https://github.com/Great-Hill-Corporation/ethslurp/issues/130

This code was a very early way to parse functions but it is totally wrong. It has all been subsumed by the monitors, but does have the benefit of not requiring a separate piece of software. In other words remove it, but don't lose the ability to parse a totally arbitrary input data the way ethslurp does. But also don't require a full-fledged monitor program.

In other words--input parsing should happen fully through the ABI if that is the only thing present, but through the parse library if that is what is needed for speed or flexibility. Note that monitors use this code to fill in the [{FUNCTION}] tag.

miniBlocks is not concurrency protected

If you run monitors watch.sh freshen x and then run testall, it will mess up the miniblocks mostly because ti takes so long to read miniblocks, and if it gets rewritten in between, it doesn't know where the end of the file is. Should protect against allowing write if miniblock is in the process of reading.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.