Skip to content

BlockFlock is a simple caching layer compatible with the Hive-Engine protocol. It is designed to be used in front of a classic Hive Engine node.

License

Notifications You must be signed in to change notification settings

CADawg/BlockFlock

Repository files navigation

BlockFlock

BlockFlock is a simple caching layer compatible with the Hive-Engine protocol. It is designed to be used in front of a classic Hive Engine node.

Build and Install

You will need Go 1.22+ installed.

git clone https://github.com/CADawg/BlockFlock
cd BlockFlock
go build
cp config.example.json config.json
./BlockFlock
# Or if you want to automatically download blocks over time
./BlockFlock auto

What does it cache?

It caches only one call, getBlockInfo. This is because it takes a fair time to request and the data doesn't change once it's set. Otherwise, it pipes the request straight through to the real hive engine node.

Database

This is built on top of the very fast BadgerDB, and once a block is cached, it can respond within 3 milliseconds (excluding network time). This is considerably faster than the 40 - 70 ms I got when requesting from the node directly from the same rack in the datacenter.

Error Handling

When an incorrect input is specified, if it can't be decoded, it will not pass it on to the hive engine node, and you will receive a response as follows:

{
    "jsonrpc": "2.0",
    "id": 0,
    "error": {
        "code": -69,
        "message":"invalid character '}' looking for beginning of value"
    }
}

Compatibility

Apart from the error cases where there is a malformed input, we aim to be 1:1 compatible with Hive Engine, please report any inconsistencies in the issues tab.

About

BlockFlock is a simple caching layer compatible with the Hive-Engine protocol. It is designed to be used in front of a classic Hive Engine node.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages