Skip to content

Developer Setup Guide

Alex Dovzhanyn edited this page Nov 6, 2018 · 2 revisions

This guide will cover how you can set up your developer environment to start contributing to Elixium. For developer resources regarding smart contracting and decentralized application development, go to the Decentralized Application Development guide.

Project Structure

Before we get started setting up the development environment, let's cover how the project is structured, both in terms of code and in terms of community. Elixium is run by the community and our aim is to be as decentralized as possible. There is no concept of 'core team' in Elixium, we don't have a team heirarchy -- the team is the development community, which dictates the direction of the project. That being said, it is impractical to give absolute access to everyone on every repository in the ecosystem, so we do have a group of maintainers whose purpose is to merge pull requests, categorize / respond to issues, and to act as a resource for other engineers, as well as a lead maintainer, who is in charge of appointing maintainers.

Elixium is split up into a few different repositories based on their functionality, as follows:

  • Elixium Core (this repository) A library housing all of the implementation functions and algorithms of Elixium
  • Elixium Miner Pulls in the core library as a dependency and uses functionality in the core to facilitate peer-to-peer connections, block/transaction validation, and mining.
  • Elixium Node Almost exactly the same as the miner except that no mining happens. Miner and node are separate for now but are very likely to become one project because of all of their similarities.
  • Elixium Wallet Aims to be an SPV implementation as a desktop wallet. Is currently only a CLI as the main focus is currently on developing the core and network.

Some of these projects depend on one another, and you're likely going to need to clone more than one of these repositories in order to work on the network. When working on the wallet, node, or miner repositories, you won't need any of the other repos. When working on the core repository, you'll need at least the core and either the miner or the node repo, but it's best to have all three.

Setup

After cloning the project you intend on working on, you'll need to set up the dev config file for that project. In order to do this, duplicate the config/dev.exs.sample file and name it dev.exs. We'll be adding / changing this file in the coming steps.

Port Forwarding

Regardless of which repository you're working with, you'll need to set up port forwarding on your router. Port forwarding allows you to connect to the test network (or, more specifically, for other nodes in the test network to be able to connect to you). If you don't set up port forwarding, you will only be able to make outbound connections to the network, and no node will be able to connect to your computer through TCP.

By default, Elixium nodes (and miners) use port 31013 to communicate. If you're working with more than repo, you should set each of them to use a different port so they don't conflict if you need to run both of them at the same time. You can change this port by editing the config/dev.exs file in the repo(s) you'll be working on:

use Mix.Config

config :elixium_node, # This line will differ depending on which repo you're in
  port: 31012 # Change this to whatever port you prefer to use

After you've settled on a port, you'll need to access your router's configuration. Usually you can pull up this screen by going to 192.168.1.1 in your browser, but if that doesn't work try Googling 'Router config [your_isp_here]' to see how to pull up that page. Once there, you're likely to see a login page that looks something like this:

Router Config Page

The username is usually admin and the password is usually password, but this may differ by router. You can usually find these credentials on your router in the same place where you'd find your wifi password. Once you've logged in, navigate to where it says 'port forwarding' (again, this will differ by router). Here's what it looks like on Fios:

Port Forwarding Link

On the port forwarding screen, you'll need to select the internal IPv4 address of your development computer as the destination address, and enter the port you selected before. If you don't know your computers IPv4 address, you can find it by running ifconfig in your terminal. The port forwarding page will look something like this:

Port Forwarding

You'll want to do this for every port you choose for each repository.

Working on Miner / Node

If you're going to be working only with the miner or node repo, you're almost done with setup. All that's left to do now is to cd into the directory of the repository, and to install the project's dependencies. You can do this by typing mix deps.get. Once that's done, open the codebase in your favorite editor and you're ready to start contributing!

In order to run the miner or node, just run mix run --no-halt.

Working on Core

In order to contribute to core, you'll need the core and at least either the miner or node repo cloned and configured. Since core is a library that is shared between the different projects, there isn't a way to test core efficiently without having one of the other repos.

You'll need to change the dependency of the miner / node repo to point at your local core repository, rather than have it pull from hex. To do this, open the mix.exs file of the miner / node repo, and change the line {:elixium_core, "~> 0.2"} to say {:local_dependency, path: "your/path/to/core", app: false} in the dependencies section. This change is necessary so that when you run the node / miner, the functions it references will be from your local core repo rather than the hex package that is online.

Once you've done that, you'll be able to make modifications to the core and run the miner / node repositories to see your changes live.