/celo-blockchain

Official repository for the golang Celo Blockchain

Primary LanguageGoGNU Lesser General Public License v3.0LGPL-3.0

Celo Blockchain

Official golang implementation of the Celo Blockchain, based off of the official golang implementation of the Ethereum protocol.

Building the source

Building Celo requires both a Go (version 1.9 or later), a C compiler and a recent nigthly Rust toolchain. You can install them using your favourite package manager. You may also consult the relevant sections in the Celo Engineering Setup guide.

Once the dependencies are installed, run

make geth

or, to build the full suite of utilities:

make all

Executables

Celo project comes with several wrappers/executables found in the cmd directory.

Command Description
geth The main Celo Blockchain client. It is the entry point into the Celo network (alfajores or private net), capable of running as a full node (default), archive node (retaining all historical state), light node (retrieving data live), or lightest node. It can be used by other processes as a gateway into the Celo network via JSON RPC endpoints exposed on top of HTTP, WebSocket and/or IPC transports. geth --help and the Ethereum CLI Wiki page for command line options.
abigen Source code generator to convert Celo contract definitions into easy to use, compile-time type-safe Go packages. It operates on plain Ethereum contract ABIs with expanded functionality if the contract bytecode is also available. However it also accepts Solidity source files, making development much more streamlined. Please see Ethereum's Native DApps wiki page for details.
bootnode Stripped down version of the Celo client implementation that only takes part in the network node discovery protocol, but does not run any of the higher level application protocols. It can be used as a lightweight bootstrap node to aid in finding peers in private networks.
evm Developer utility version of the EVM (Ethereum Virtual Machine) that is capable of running bytecode snippets within a configurable environment and execution mode. Its purpose is to allow isolated, fine-grained debugging of EVM opcodes (e.g. evm --code 60ff60ff --debug).
gethrpctest Developer utility tool to support the ethereum/rpc-test test suite which validates baseline conformity to the Ethereum JSON RPC specs. Please see the ethereum test suite's readme for details.
rlpdump Developer utility tool to convert binary RLP (Recursive Length Prefix) dumps (data encoding used by the Celo protocol both network as well as consensus wise) to user friendlier hierarchical representation (e.g. rlpdump --hex CE0183FFFFFFC4C304050583616263).
puppeth a CLI wizard that aids in creating a new Celo network.

Running Celo

Please see the docs page for more instructions on how to run a Celo node connected to the Alfajores testnet.

Configuration

As an alternative to passing the numerous flags to the Celo binary, you can also pass a configuration file via:

$ geth --config /path/to/your_config.toml

To get an idea how the file should look like you can use the dumpconfig subcommand to export your existing configuration:

$ geth --your-favourite-flags dumpconfig

Note: This works only with celo v1.6.0 and above.

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 celo-blockchain, 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 check up with the core devs first on the official Celo forum 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:

  • Code must adhere to the official Go formatting guidelines (i.e. uses gofmt).
  • Code must be documented adhering to the official Go commentary guidelines.
  • Pull requests need to be based on and opened against the master branch.
  • Commit messages should be prefixed with the package(s) they modify.
    • E.g. "eth, rpc: make trace configs optional"

Submitting an issue

If you come across a bug, you can run geth bug to open a GitHub issue draft with pre-filled system information. If you are using a Docker image, you can run this command using docker run -it <image> bug.

CI Testing and automerge

We run a circle CI test suite on each PR. The following tests are required to merge a PR.

  • Unit tests: make test or ./build/env.sh go run build/ci.go test
  • Lint: make lint (Fix go format errors with gofmt -s)
  • Build: make
  • End to end sync and transfer tests

Individual package tests can be run with ./build/env.sh go test github.com/ethereum/go-ethereum/$(PATH_TO_GO_PACKAGE) if you don't have GOPATH set-up.

Once a PR is approved, adding on the automerge label will keep it up to date and do a squash merge once all the required tests have passed.

License

The celo-blockchain library (i.e. all code outside of the cmd directory) is licensed under the GNU Lesser General Public License v3.0, also included in our repository in the COPYING.LESSER file.

The celo-blockchain binaries (i.e. all code inside of the cmd directory) is licensed under the GNU General Public License v3.0, also included in our repository in the COPYING file.