OpenBazaar 2.0 guide installation

in #openbazaar6 years ago (edited)

OB.jpg

OpenBazaar is a fully decentralized open source software peer-to-peer (p2p) which allow transactions of goods. No middleman, no fees and no censorship.The application is free to use and sellers can receive payment in Bitcoin, Bitcoin Cash and Zcash.

OpenBazaar works in a different way to ecommerce (like Amazon). It lets you take control of your store and profile. The traditional way is to contact the seller through a website but with OB the aim let users connect directly to each other.

To install OB is needed to run server and client, servers can store and provide information to users. At the beginning was making noisy for me to understand OpenBazaar is then two programs:

Server: The back-end app. It connects to the network .
Client: The front-end app. It connects to the server, it the visual interface. **

OpenBazaar package will install both server and client locally in your computer. But the server can be anywhere, in this guide I will show you how to set up in a VPS with Ubuntu 16.04.

Server

Install dependencies

sudo apt-get update
sudo apt-get install build-essential git -y

Install the last version of Go

It’s always good practice to check directly in Go Official Page the last version.

wget https://dl.google.com/go/go1.10.3.linux-amd64.tar.gz
sudo tar -zxvf go1.10.3.linux-amd64.tar.gz -C /usr/local/

Setup Go

Create a directory of your Go projects:

mkdir go

Edit .profile in your home directory :

nano ~.profile

and copy these lines to the end of the file (make sure you use the proper directory):

export GOPATH=$HOME/go
export PATH=$PATH:/usr/local/go/bin

run:

source ~/.profile

with this Go should be installed in your computer.

Install Openbazaar-go

go get github.com/OpenBazaar/openbazaar-go

with this command you will be able to find the source code here:
$GOPATH/src/github.com/OpenBazaar/openbazaar-go

start the server:

cd $GOPATH/src/github.com/OpenBazaar/openbazaar-go
go run openbazaard.go start

Firewall allow connections

sudo ufw allow 4002/tcp

Client

For the client go the OB Official page official page:

For the Linux version you only have to double-click and install the .deb package and the in the main menu you will find the new application.

Setup SSL on the server

openssl genrsa -out rootCA.key 4096
openssl req -x509 -new -nodes -key rootCA.key -days 1024 -out rootCA.crt -subj "/C=EA/ST=Earth/L=Babylon/O=Jesuit/OU=Illuminati/CN=rootCA.crt"
openssl genrsa -out server.key 4096
openssl req -new -key server.key -out server.csr -subj "/C=EA/ST=Earth/L=Babylon/O=Jesuit/OU=Illuminati/CN=<vps.ip>"
openssl x509 -req -in server.csr -CA rootCA.crt -CAkey rootCA.key -CAcreateserial -out server.crt -days 1024

these instructions will generate 3 files:

  • server.crt
  • server.key
  • rootCA.crt

now it is time to tell the OB config file it will use SSL certificate:

sed -i -E "s/("SSL": )false/\1true/" config
sed -i -E "s|("SSLCert": ")|\1$HOME/ob2/.openbazaar2.0/server.crt|" config
sed -i -E "s|("SSLKey": ")|\1$HOME/ob2/.openbazaar2.0/server.key|" config

Once generate the self-signed certificate you will need to install rooCA.crt in the OS of the client machine. Usually self-signed certificates are rejected by the OS, which is why you need to install this root certificate.

Copy rootCA.crt to your client:

scp rootCA.crt yourclientip:yourlocation/folder/

Setup SSL in your client:

Once the rootCA.crt is in your machine, it supposed with double-click should give you the option to install it.

Troubleshooting:

Error:
http: TLS handshake error from IP:port: tls: first record does not look like a TLS handshake

In my case my client machine running Ubuntu was not able to recognize the new certificate, it worked with that:

sudo apt-get install libnss3-tools
sudo cp rootCA.crt /usr/share/ca-certificates/
sudo dpkg-reconfigure ca-certificates

ssl1.png

Make sure you select the certificate from this window with tab

crt.jpg

ssl2.png

certutil -d sql:$HOME/.pki/nssdb -A -t "C,," -n "rootCA" -i rootCA.crt

after that I was able to connect to the server and start to configure it.

To read more about my installing adventures, please Upvote and follow me here on Steemit @atmandigital

If you want to donate feel free:
BTC:
37UGHZZDU1MCructiEgY7QBwwU2qxTTPrn
Zcash:
t1SDeFVFNFoVw1DsqqN13oSD8QyjD2FSVeE

Sort:  

This is so great, thank you for sharing this! I work for OB1, the team leading the development of OpenBazaar, and have a couple of quick notes from our dev team:

  1. Add sudo ufw allow 4001/tcp after the other ufw command

  2. You can download client-only binaries (no need to have another server installed locally), they have "client" in the filename https://github.com/OpenBazaar/openbazaar-desktop/releases

  3. We have a new command for certs but it hasn’t been tested by anyone outside of our team that you're welcome to try if you'd like. It’s

go run openbazaard.go gencerts --host <ip>

and then the certs are in <datadir>/ssl/

Thank you for this guide!
One small note:
nano ~.profile
should be changed to:
nano ~/.profile
Or, alternatively,
cd ~
nano .profile