Skip to content

freicoin/foundation

Repository files navigation

Freicoin Foundation

This is the web for the Freicoin Foundation. It is written in python using the framework django.

Installation

Environment variables

After cloning the repository, you may want to edit the file .env to set your own settings, for example, for setting a smtp account.

Dependencies

On systems like windows, the first thing you need to install if you haven’t installed it already is make. In unix based systems like linux or macOS you already have that.

To build the project you need to satisfy several dependencies first and their installation depends on your system.

For example, in debian you could do it by just running the following command in a terminal:

sudo apt-get install python-dev virtualbox vagrant postgresql libncurses5-dev libgmp3-dev libmpfr-dev libmpc-dev libpq-dev libghc-zlib-dev m4

Ubuntu

The version of libmpc-dev offered in Ubuntu repositories is outdated, so if you’re using that system, you will need to download it and compile it yourself.

If you used the line above to install the dependencies, first remover the outdatd versions:

sudo apt-get remove libmpc-dev libgmp3-dev libmpfr-dev

The sources for the needed packages can be found here:

http://gmplib.org/ http://www.mpfr.org/ http://www.multiprecision.org/

Then compile all the packages with:

tar xzf mpfr-3.1.2.tar.gz
cd mpfr-3.1.2
./configure --prefix=/usr/local && make && sudo make install

cd gmp-5.1.2
./configure --prefix=/usr/local && make && sudo make install

tar xzf mpc-1.0.1.tar.gz
cd mpc-1.0.1
./configure --prefix=/usr/local && make && sudo make install

Building options

Here’s a list of make targets and their effects:

CommandDescription
makeThe first thing to run. Creates an Ubuntu virtual machine, downloads and installs all the dependencies and builds the project.
make shellStarts a python shell ready to import the project’s modules and interact with the database.
make runStarts a server on http://127.0.0.1:8000/
make vmsuspendShut down the VMs and frees up that memory

Once you have it the dependencies installed, you can run any of them in the project’s root.

Please, contact us if these instructions aren’t enough or can be improved for the system you’re using.

Donations wallet setup

The FFs web uses HD wallets (BIP 0032) to generate the addresses for the organizations to receive donations. This increases security and simplifies auctions.

The administrator creates a wallet by running the shell locally with make shell and then type:

from pycoin.wallet import Wallet
master_wallet = Wallet.from_master_secret("change_this")
master_wallet_public = master_wallet.public_copy()
master_wallet_public_key = master_wallet_public.wallet_key()

The administrator must store the secret (in this case “change_this”), preferably on an off-line computer or paper. When he needs he needs to forward the received donations monthly, he can re-create the master wallet using that secret.

But the foundation’s web needs to generate addresses for each organization and month using the master_wallet_public_key obtained below. In this case the key is:

xpub661MyMwAqRbcFEfGXZ3mV9KDNk3T2Top3wGWDGr7Q2yWwSgcgTgSqb2zii2QhLoySDX4LZKqPig86UG76S2KbqwPD9xERwQTJKuCsugVnc5

This key must be stored on the settings file, for example:

DONATIONS_WALLET_KEY='xpub661MyMwAqRbcFEfGXZ3mV9KDNk3T2Top3wGWDGr7Q2yWwSgcgTgSqb2zii2QhLoySDX4LZKqPig86UG76S2KbqwPD9xERwQTJKuCsugVnc5'

Anyone can re-create the public HD using pycoin or another HD wallet tool:

from pycoin.wallet import Wallet
master_wallet_public = Wallet.from_wallet_key('xpub661MyMwAqRbcFEfGXZ3mV9KDNk3T2Top3wGWDGr7Q2yWwSgcgTgSqb2zii2QhLoySDX4LZKqPig86UG76S2KbqwPD9xERwQTJKuCsugVnc5')

To generate the individual addresses for each organization, you have to use the month (starting to count from the web launch) and the id of the organization. For example, to obtain the address for the month 14 (a year and 2 months after launch) and for the organization with id=5, you would do it like this:

master_wallet_public.subkey_for_path('14/5').bitcoin_address()
u'1DPEEVxWpiMVFuLgMAazgYe3Sr8bZ9ZFpk'

The administrator generates the sub-keys to forward the funds in the same way, but using the private master wallet which gives him access to the private keys.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published