A couple weekends ago I setup a bunch of decentralized projects on my computer for fun. As you might know I’m working on a project called RightMesh which aims to allow people to resell their extra network capacity. I’m super interested in reselling resources, so naturally I like the Golem project which lets you resell cpu / gpu resources, and IPFS / Filecoin which lets you resell storage. The tor project doesn’t allow you to sell anything, but I have a high bandwidth link and figured I might as well put it to good use. I also really like the Ethereum project, so I like to run a full node, and do a bit of GPU mining in a pool as a hobby.
I decided to nuke my entire setup — previously was running Windows 10 for gaming with a bunch of stuff running on Ubuntu in a VM. Haven’t gamed much on my computer lately so moving completely into Ubuntu. First step, get Ubuntu. I chose the server edition because I don’t need all the GUI stuff (I use my laptop for that).
First step, download Ubuntu. I chose version 16.04.3 LTS.
[https://www.ubuntu.com/download/server](https://ubuntu.com/download/server)
I used the startup disk creator tool in Ubuntu on another computer to setup an 8GB usb flash drive.
After it downloaded, I used the startup disk creator tool in Ubuntu on another computer to setup an 8GB usb flash drive. There are similar tools in windows that you can find as well.
![file](/uploads/image-1690611063966.png)
After this, reboot the computer with the USB stick inserted. You may need to press a button like f10 or something on your computer to change which device it boots from (otherwise it will use the previous Windows install).
After boot we can start installing things.
**Installing Stuff**
First, a few things for building and getting source code:
```
sudo apt-get install git build-essential python-twisted supervisor screen tmux python-pip golang-go supervisor
```
Next, since I have AMD RX 580 graphics cards, I had to get the drivers from this page:
[http://support.amd.com/en-us/kb-articles/Pages/AMDGPU-PRO-Install.aspx](https://web.archive.org/web/20171123100207/http://support.amd.com/en-us/kb-articles/Pages/AMDGPU-PRO-Install.aspx)
Once they downloaded, I extracted the drivers, ran the installer and added myself to the video group (otherwise opencl devices will only be available to root user):
```
tar xvf amdgpu-pro-17.40–492261.tar.xz
cd amdgpu-pro-17.40–492261
sudo amdgpu-pro-install
sudo usermod -a -G video $LOGNAME
```
**Ethereum full node & miner**
Next is actually getting the [Ethereum full node](https://web.archive.org/web/20170904193526/https://ethereum.gitbooks.io/frontier-guide/content/) and [GPU mining software](https://web.archive.org/web/20150727115510/http://guide.ethereum.org/gpu.html):
```
sudo apt-get install software-properties-common
sudo add-apt-repository -y ppa:ethereum/ethereum
sudo add-apt-repository -y ppa:ethereum/ethereum-dev
sudo apt-get update
sudo apt-get install ethereum ethminer
```
The ethereum full node software is called geth. [First is creating your account](https://github.com/ethereum/go-ethereum/wiki/Managing-your-accounts/c7f703fdf59198a2f60a54967a1db7efb9765523). You can do this with:
```
geth account new
```
This won’t actually run the full node — it just sets up the files for your account. You’ll want to save the public address that gets generated at this step. Next is actually running the full node. You can run it a couple of ways. One is to run it in “console” mode as follows:
```
geth console
```
This will show output about what geth is doing, and let you enter commands. It can get kind of annoying with the output coming out on the same screen you are trying to enter input in. Once its running, you can quit with the command `exit`.
The other way you can do it is run it as a deamon and then “attach” to it (we’ll see how to do this later on with supervisor, but another way you could do it is run geth in one process using `screen`, and then detach from the screen `ctrl-d` and attach with `geth attach`.
When geth is in either console mode or attached, you can check whether it is synced with the following command:
```
eth.syncing
```
Another useful command is this one, which will list your account public address:
```
eth.coinbase
```
And another one which will list the balance in your account:
```
web3.fromWei(eth.getBalance(eth.coinbase), "ether")
```
You can test that the miner is working with your GPU as follows:
```
ethminer --list-devices
```
which should just show your open-cl devices. You can also do a benchmark to make sure it works as follows:
```
ethminer -G -M
eth-proxy
```
Next, I downloaded [eth-proxy](https://github.com/Atrides/eth-proxy) so that I could do some pooled mining (I use [dwarfpool](https://dwarfpool.com/) — but this will also work with other pools).
```
git clone https://github.com/Atrides/eth-proxy.git
```
Next, setup the configuration file for eth-proxy:
```
nano eth-proxy/eth-proxy.conf
```
You’ll want to make sure you fill in the wallet address you wish the mined tokens to go to (ie: the public address from setting up geth), and also setup the mirrors you wish to connect with (ie: us, europe, asia).
Once this is setup you can start the proxy:
```
cd eth-proxy
python eth-proxy.py
```
Now run your miner with the proxy:
```
ethminer --farm-recheck 200 -G -F http://127.0.0.1:8080/$HOSTNAME
```
**Tor Relay**
According to the [tor website](https://web.archive.org/web/20171207151150/https://www.torproject.org/docs/debian.html.en), its best not to use the tor package in the Ubuntu universe repository because it doesn’t really get updated enough.
```
sudo add-apt-repository "deb http://deb.torproject.org/torproject.org $(lsb_release -s -c) main"
gpg --keyserver keys.gnupg.net --recv A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89
gpg --export A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89 | sudo apt-key add -
sudo apt-get update
sudo apt-get install tor deb.torproject.org-keyring
```
Next, edit the `/etc/tor/torrc` file using an editor like nano:
```
sudo nano `/etc/tor/torrc`
```
You probably want to disable being an exit relay. You can do this by uncommenting the line `ExitPolicy reject *:* # no exits allowed`. Its up to you whether you want to run as a bridge (non-public) node or not. I usually run as a public relay.
I usually uncomment the ORPort line: `ORPort 9001` which will advertise the Tor service on that port. I also set the Nickname so that I can find my node easily in directories.
Lastly, I usually set the bandwidth I’m willing to provide.
After you make the changes, restart the tor service like this:
```
sudo service tor restart
```
You should be able to search for your public tor relay using the [atlas project site](https://atlas.torproject.org/).
**Golem Test Node**
First, get the install script and make it executable:
```
wget https://raw.githubusercontent.com/golemfactory/golem/develop/Installer/Installer_Linux/install.sh
chmod +x install.sh
```
Similar to geth, you can run golem in a couple of different windows. First is the main app — you can run this with golemapp. You probably want to do this in screen. Then in another console, you can attach to it with golemcli -i which will attach to the existing golemapp instance. You can also set your options which are located at: `~/.local/share/golem/default/app.cfg.ini`
In the golemcli, there are a few useful commands. `tasks stats` will show how many tasks have been computed. There is also `incomes show` and `payments show` which show tasks that golem tokens are being paid for. Of course currently, it is all on the public testnet and worthless, but its still cool to try it out so that when it publicly launches you’ll be ready ;)
**IPFS**
Next is IPFS. This one is pretty simple — just [download it](https://dist.ipfs.tech/#go-ipfs), install it and init.
```
wget https://dist.ipfs.io/go-ipfs/v0.4.13/go-ipfs_v0.4.13_linux-amd64.tar.gz
tar xvf go-ipfs_v0.4.13_linux-amd64.tar.gz
cd go-ifps
sudo ./install.sh
```
Init with `ipfs init` which will setup `~/.ipfs`. You can then run ipfs as a daemon with `ipfs daemon`. You might wish to change the configuration in `~/.ipfs/config`. You may notice that the gateway is trying to listen on the same port as the proxy for mining (8080). You may wish to set some of the listening ips to either the LAN address or the public address if you want to be able to access it from another computer (it defaults to showing most of the APIs through localhost only.
**Making Everything Start on Boot**
Theres a few different ways to make everything run on boot. If you wanted you could create service definitions for everything — but that’s kind of overkill for some of these.
The supervisor tool is something that we can use to make sure all the things start on boot.
```
/etc/supervisor/conf.d/geth.conf
```
```
[program:geth]
command=/usr/bin/geth --fast --rpc --rpcaddr 127.0.0.1 --rpcport 8545 --rpccorsdomain * --rpcapi admin,db,eth,debug,miner,net,shh,txpool,personal,web3
autostart=true
autorestart=true
user=<insert user>
stderr_logfile=/var/log/supervisor/geth.err.log
stdout_logfile=/var/log/supervisor/geth.out.log
```
```
/etc/supervisor/conf.d/ipfs.conf
```
```
[program:ipfs]
command=/usr/local/bin/ipfs daemon --init --mount-ipfs /data/ipfs --mount-ipns /data/ipns --mount
environment=IPFS_PATH="/home/<insert user>/.ipfs"
user=<insert user>
stdout_logfile=/var/log/supervisor/ipfs-stdout.log
stderr_logfile=/var/log/supervisor/ipfs-stderr.log
```
```
/etc/supervisor/conf.d/golem.conf
```
```
[program:golem]
directory=/home/<insert user>
command=/usr/local/bin/golemapp
user=<insert user>
stdout_logfile=/var/log/supervisor/golem-stdout.log
stderr_logfile=/var/log/supervisor/golem-stderr.log
```
```
/etc/supervisor/conf.d/eth-proxy.conf
```
```
program:eth-proxy]
directory=/home/<insert user>/eth-proxy
command=python eth-proxy.py
user=<insert user>
stdout_logfile=/var/log/supervisor/eth-proxy-stdout.log
stderr_logfile=/var/log/supervisor/eth-proxy-stderr.log
```
```
/etc/supervisor/conf.d/ethminer.conf
```
```
[program:ethminer]
command=ethminer --farm-recheck 200 -G -F http://127.0.0.1:8080/$HOSTNAME
user=<insert user>
stdout_logfile=/var/log/supervisor/ethminer-stdout.log
stderr_logfile=/var/log/supervisor/ethmier-stderr.log
```
Note above, fill in your username where it says `<insert user>`.
Tor should automatically start as a service in ubuntu so you don’t need to add anything to make that work.
In part II of this guide, I’ll show you how to add some things that let you monitor your setup and make sure its all still running.