Home

Awesome

Confura

Implementation of an Ethereum Infura equivalent public RPC service on Conflux Network.

MIT licensed

Why Confura

Comparatively running your full node, Confura makes it easy to build a high performance, scalable and available RPC service by providing some augmented features.

RPC Improvement

Node Cluster Management

Rate Limit

VIP Support

Metrics

EVM Compatibility

Prerequisites

Hardware Requirements

Minimum:

Recommended:

Software Requirements

Confura can even be run without any third party dependencies. But depending on what you plan to do with it, you will require the following:

Building the source

Building Confura requires a Go (version 1.15 or later) compiler. Once the dependencies are installed, run

go build -o bin/confura

or if you are using Unix-based OS such as Mac or Linux, you can leverage make tool:

make build

An executable binary named confura will be generated in the project bin directory.

Configuration

Confura will load configurations from config.yml or config/config.yml under current directory at startup. You can use the config.yml within our project as basic template, which has bunch of helpful comments to make it easy to customize accordingly to your needs.

As an alternative to modifying the numerous config items in the configuration file, you can also use environment variables. Environment variables prefixed "INFURA_" will try to overide the config item defined by the path with all its parts split by underscore.

eg.,

export INFURA_RPC_ENDPOINT=":32537"

This will override value for the config item of path rpc.endpoint within the configuration file as ":32537".

Running Confura

Confura is comprised of serveral components as below:

Blockchain Sync

You can use the sync subcommand to start sync service, including DB and ETH sync.

Usage: confura sync [flags]

Flags:

  --db           start core space DB sync server
  --eth          start ETH sync server
  --help         help for sync

eg., you can run the following to kick off synchronizing core space blockchain data into database:

$ confura sync --db

Note: You may need to prepare for the configuration before you start the service.

Node Management

You can use the nm subcommand to start node management service for core space or evm space.

Usage: confura nm [flags]

Flags:

 --cfx    start core space node manager server
 --eth    start evm space node manager server
 --help   help for nm

eg., you can run the following for core space node manager server:

$ confura nm --cfx

Note: You may need to prepare for the configuration before you start the service.

Virtual Filter

You can use the vf subcommand to start virtual filter service (for eSpace only).

Usage: confura vf [flags]

Flags:

 --help   help for nm

eg., you can run the following for virtual filter server:

$ confura vf

Note: You may need to prepare for the configuration before you start the service.

RPC Proxy

You can use the rpc subcommand to start RPC service, including core space, evm space and core space bridge RPC servers.

Usage: confura rpc [flags]

Flags:

 --cfx         start core space RPC server
 --cfxBridge   start core space bridge RPC server
 --eth         start evm space RPC server
 --help        help for rpc

eg., you can run the following for core space RPC server:

$ confura rpc --cfx

Note: You may need to prepare for the configuration before you start the service.

Data Validator

You can use the test subcommand to start data validity test for JSON-RPC, Pub/Sub or Filter API proxy.

Usage: confura test [command] [flags]

Available Commands:

  cfx         validate if epoch data from core space JSON-RPC proxy complies with fullnode
  ws          validate if epoch data from core space Pub/Sub proxy complies with fullnode
  eth         validate if epoch data from evm space JSON-RPC proxy complies with fullnode
  vf          validate if filter changes polled from Virtual-Filter proxy complies with fullnode

Flags: Use confura test [command] --help to list all possible flags for each specific command.

eg., you can run the following to kick off data validity test for core space JSON-RPC proxy.

$ confura test cfx --fn-endpoint http://test.confluxrpc.com --infura-endpoint http://127.0.0.1:22537

Note: You need to boot up RPC proxy (or Virtual Filter proxy) before you start the validation test.

Docker Quick Start

One of the quickest ways to get Confura up and running on your machine is by using Docker Compose:

$ docker-compose build

This will build a slim confura executable docker image based on Alpine Linux.

$ docker-compose up -d

This will start MySQL and Redis dependency middleware containers, for each of which a docker volume is created to persist data even the container is removed. It will also boot up the above components with some basic pre-configurations, and map the default ports as needed.

$ docker-compose ps 

           Name                         Command               State                      Ports                    
------------------------------------------------------------------------------------------------------------------
confura-data-validator       ./confura test cfx -f http ...   Up                                                  
confura-database             docker-entrypoint.sh mysqld      Up      0.0.0.0:53780->3306/tcp, 33060/tcp          
confura-ethdata-validator    ./confura test eth -f http ...   Up                                                  
confura-ethnode-management   ./confura nm --eth               Up      0.0.0.0:28530->28530/tcp,:::28530->28530/tcp
confura-ethrpc               ./confura rpc --eth              Up      0.0.0.0:28545->28545/tcp,:::28545->28545/tcp
confura-ethsync              ./confura sync --eth             Up                                                  
confura-node-management      ./confura nm --cfx               Up      0.0.0.0:22530->22530/tcp,:::22530->22530/tcp
confura-redis                docker-entrypoint.sh redis ...   Up      0.0.0.0:53779->6379/tcp                     
confura-rpc                  ./confura rpc --cfx              Up      0.0.0.0:22537->22537/tcp,:::22537->22537/tcp
confura-sync                 ./confura sync --db              Up
confura-virtual-filter       ./confura vf                     Up      0.0.0.0:48545->48545/tcp,:::48545->48545/tcp

TODO

Contribution

Thank you for considering to help out with the source code! We welcome contributions from anyone on the internet, and are grateful for even the smallest of fixes!

If you'd like to contribute to confura, please fork, fix, commit and send a pull request for the maintainers to review and merge into the main code base. If you wish to submit more complex changes though, please file an issue first to ensure those changes are in line with the general philosophy of the project and/or get some early feedback which can make both your efforts much lighter as well as our review and merge procedures quick and simple.

Please make sure your contributions adhere to our coding guidelines:

License

This project is licensed under the MIT License.