Skip to content

chuvayva/procoin

Repository files navigation

Procoin

Procoin is a client web site for Procoin Token.

The system works with blockchain via Ruby Ethereum Library ethereum.rb which internally uses JSON RPC API.

Before you start

You should deploy Token to a blockchain. See Deployment to Ropsten.

Getting Started

Make sure you have Ruby 2.3.1, PostgreSQL, Redis and Yarn installed.

Install gems:

bundle install

Setup DB:

bundle exec rake db:reset

It will create procoin DB in postgres.

Install js packages:

yarn install

Run Server

The system consist of several processes listed in the Procfile. Run it using Foreman, Hivemind or Overmind

hivemind

Tests

Make sure you have setup test database. You can do it by:

RAILS_ENV=test bundle exec rake db:reset

Then run rspec tests:

rspec

Configuration

We use dotenv-rails for app configuration. Use .env.development for customization.

To cutomize JSON RPC server set ETHEREUM_RPC_URL environment variable. For instance you can use Infura:

ETHEREUM_RPC_URL=https://ropsten.infura.io/<your infura key>

You had better sign up and have you own token, but https://ropsten.infura.io also works. Check Getting started with Infura.

You need to deploy Procoin token to a blockchain and set it's address:

ETHEREUM_TOKEN_ADDRESS=<procoin address>

You should have an account with ether to make transactions. Set it via:

ETHEREUM_ADMIN_ACCOUNT=<account address>
ETHEREUM_ADMIN_PRIVATE_KEY=<account private key>

You can existed or generate them in console:

bundle exec rails console
key = Eth::Key.new
key.address
key.private_hex