Development

You are here:
< Back

Introduction

Everything from the development to the publication of the core is managed by Lerna.

Getting started with Lerna

Before you can get started with working on Qredit Core, you need to setup lerna as previously mentioned.

yarn global add lerna
git clone https://github.com/Qredit/core
cd core
lerna bootstrap

Just follow those steps, and you are ready to get started. Happy Hacking!

Database

Qredit Core stores all the blockchain data in a database. You could read more about it, in the database section.

For development, you could use our ready-to-use Docker Compose configurations, following the instructions at Docker section.

Starting a node

If you want to start a node which consists of a relay and forger you can use any of the following commands (inside packages/core).

  • yarn start => ~/.qredit
  • yarn start:mainnet => packages/core/lib/config/networks/mainnet
  • yarn start:devnet => packages/core/lib/config/networks/devnet
  • yarn start:testnet => packages/core/lib/config/networks/testnet

Starting a relay

If you want to start a relay, you can use any of the following commands (inside packages/core).

  • yarn relay => ~/.qredit
  • yarn relay:mainnet => packages/core/lib/config/networks/mainnet
  • yarn relay:devnet => packages/core/lib/config/networks/devnet
  • yarn relay:testnet => packages/core/lib/config/networks/testnet

Starting a forger

If you want to start a forger, you can use any of the following commands (inside packages/core).

  • yarn forger => ~/.qredit
  • yarn forger:mainnet => packages/core/lib/config/networks/mainnet
  • yarn forger:devnet => packages/core/lib/config/networks/devnet
  • yarn forger:testnet => packages/core/lib/config/networks/testnet

Debugging

It is possible to run a variation of these commands that enables the Node debugger:

  • yarn debug:start
  • yarn debug:relay
  • yarn debug:forger
  • yarn debug:snapshot

A good introduction about how to use the debugger is the guide to debugging of Node.js.

Tests

Every package that is developed should provide tests to guarantee it gives the expected behavior.

Our tool of choice for tests is Jest by Facebook which provides us with the ability to add custom matchers, snapshot testing and parallelizes our test runs.

All packages have a yarn run test command which you should run before sending a PR or pushing to GitHub to make sure all tests are passing. You could use yarn run test:watch to listen to changes on the files and run the tests automatically.

Additionally, we provide a variant (yarn run test:debug) that enables the Node debugger.

Linting

To ensure the code remains maintainable, we use ESLint in combination with StandardJS.

You can find them on GitHub here:

Before sending any PRs or pushing to GitHub, please make sure to run npm run lint to apply the rules enforced by StandardJS.

Last Updated On January 25, 2019