Skip to content

Finance 4 Demo: Golang server & Elm-lang web front-end

License

Notifications You must be signed in to change notification settings

ssoima/fin4-core

 
 

Repository files navigation

CircleCI

Finance 4.0

Finance 4.0 aims for a multi-dimensional incentive system to motivate sustainable behavior. Communities can creat cryptographic tokens to incentivize certain behavior, e.g. collecting waste, avoiding C02, helping others, etc. Users can obtain these tokens by proving that they performed such actions. The number of different token types is unlimited, leading over time to a multi-dimensional system of different incentives -- smart coordination through "sustainable money". In the same spirit, the system uses tokens for democratic governance. A live instance can be found here: www.finfour.net . Main concepts of the Finance 4.0 system are explained in Decrypting Distributed Ledger Systems. This document is a good starter for everyone who wants to know

  • What is a cryptoeconomic token?
  • What is the difference between Ethereum, Bitcoin and Hyperledger?
  • What are actions in a distributed ledger technology (DLT) system?
  • What are claims?
  • How do cryptoeconomic tokens have value?

To learn more about the finance 4.0 system:

Short video: Youtube - Distributed Sustainability

Social media: Twitter

Concept paper: Finance4.0

Slack: todo

Content

Fin4 Demonstrator | This repository

This repository contains a backend server (written in Golang) and a web front-end (written in Elm) of the Finance 4.0 demonstrator. The ELM web app enables a user to

  • Create a new Type of cryptoeconomic Token, which is deployed on the server and Ethereum Blockchain
  • Obtain units of created tokens via performing an action, such as planting a tree
  • Performing Oracle tasks in order to approve actions

The server provides

  • APIs for clients, such as the ELM app
  • Communication functionalities with the Ethereum Blockchain
  • Smart contract deployer
  • Functionality to store actions

The smart contracts are written in Solidity for the Ethereum platform.

In the following Section we explain how the web app and server can be set up.

Install Finance 4.0 demonstrator

We assume a fresh Ubuntu 18.10 system for the following.

Dependencies

export GOROOT=/usr/local/go -> try whereis go, and then see where the root is installed
export GOPATH=$HOME/Projects/goprojects -> folder where fin-4 will be installed in
export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
export GOBIN=$GOPATH/bin

Best is to store this in ~/.bashrc, so that this automatically set whenever you start a new terminal session.

Set up

$ git clone https://fin4-core.git
$ cd fin4-core
$ go get
$ npm install: install server dependencies
$ elm package install: install elm web app dependencies

Setting up database:

sudo apt-get install mysql-server sudo mysql_secure_installation set the root password sudo mysql -u root -p

Inside mysql, create a new database called fin4.

CREATE DATABASE fin4 default charset utf8;

Assign a user full access right to the fin4 database (or leave it with root).

Env variables

Copy .env_sample file to .env. Then, modify the following entries:

cp `fin4-core/.env_sample` `fin4-core/.env`

Open the .env file and add the following information:

modify DATA_SOURCE_NAME by adding USERNAME, PASSWORD and DB_NAME. Assuming a root user for the fin4 database and the password "password1" the expression should look as follow:

$ export DATA_SOURCE_NAME="root:password1@/fin4?charset=utf8mb4,utf8&parseTime=true"

Running the development-server

$ export .env # load the environment variables - Do not forget this whenever you open a new terminal
$ ganache-cli # simulates the ethereum blockchain. Alternatively, you can use the Ganache application
$ make server-dev # deploy the server

Running the development-client (web front-end)

$ make client-dev

After the build, open https://localhost:8888/ inside of your favourite browser.

Testing

$ make test
$ make test-cover
$ make cover-view

Documentation

In the following we document the basic execution of the server and the elm app are explained. Detailed information can/ will be found in the respective packages.

fin4 Server

The main functioning of the server is explained in the server package.

Entry point - main.go

When executing

make server-dev

A new server instance is exportet to the port 8181, which listens to port 3000 (hence all http request will need to be send to this port). You dont know what ports are? Find brief example explanation here . In particular, main.go is executed which

  • loads the necessary environment variables into the program
  • connects to the local database (which you specified in the .env file)
  • initiates the token and user services
  • connects with AWS (is used in our live instance, which is deployed to www.finfour.net)
  • connects with an instance of Ethereum
  • start listening to http request (which internally uses the gin library)

fin4 webapp

Contribute!

We are looking for collaboration from the Open Source community. The project needs enhancements regarding code quality, documentation, and testing. To contribute to the project please take a look at open issues.

About

Finance 4 Demo: Golang server & Elm-lang web front-end

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 56.5%
  • Elm 41.3%
  • CSS 1.2%
  • Other 1.0%