Skip to content

Commit

Permalink
Merge pull request #403 from transmute-industries/docs/vps-deployment
Browse files Browse the repository at this point in the history
Documentation for Deploying a Public Web Facing Testnet Node
  • Loading branch information
BenjaminMoe committed Apr 11, 2022
2 parents d9bd13a + bcdd498 commit feb457e
Show file tree
Hide file tree
Showing 4 changed files with 432 additions and 5 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ The following did methods are supported or intended to be supported (or planned
| did:ion | [spec](https://github.com/decentralized-identity/ion) | Bitcoin | IPFS | [Planned](https://github.com/transmute-industries/sidetree.js/issues/379) |
| did:orb | [spec](https://trustbloc.github.io/did-method-orb/) | Hyperledger Fabric | IPFS | [Planned](https://github.com/transmute-industries/sidetree.js/issues/380) |

### Public Sidetree.js Nodes

**Element**

- https://ropsten.element.transmute.industries/
- https://element.shellshop.lol/

## Developers Guide

See [Development](./DEVELOPMENT.md)
Expand Down
12 changes: 7 additions & 5 deletions packages/did-method-element/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,18 +78,20 @@ Element follows the default parameters defined in the [Sidetree Protocol Specifi
| NONCE_SIZE | 16 bytes |

Element uses Ethereum for the ledger layer, which means that did's are anchored to the block chain with a smart contract,
instead of being appended to a `NO_OP` transaction. This means that rather than a specific block, Element will monitor
a specific smart contract address for existing and new anchor transactions.
instead of being appended to a `NO_OP` transaction. Element will monitor a specific smart contract address for existing
and new anchor transactions.

The Elment Contract Address for Ropsten is: `0x920b7DEeD5CdE055260cdDBD70C000Bbd5b30997`.
**Ropsten**
Contract Address: [0x920b7DEeD5CdE055260cdDBD70C000Bbd5b30997](https://ropsten.etherscan.io/address/0x920b7DEeD5CdE055260cdDBD70C000Bbd5b30997)
Starting Block: [11759377](https://ropsten.etherscan.io/block/11759377)

## CRUD Operations

Element supports the 4 CRUD operations defined in the [Sidetree Protocol API Specification](https://identity.foundation/sidetree/api/).
Each operation is performed by submitting a Sidetree operation in the form of and HTTP POST request to a Sidetree node.
The body of the HTTP POST request for an operation will have the Content-Type of `application/json` to the `[server path]/operations` REST end point.

```json
```
{
"type": OPERATION_TYPE,
...
Expand Down Expand Up @@ -257,7 +259,7 @@ For example, to resolve the DID `did:elem:ropsten:EiCtwD11AV9e1oISQRHnMJsBC3OBdY
`https://ropsten.element.transmute.industries/api/1.0/identifiers/did:elem:ropsten:EiCtwD11AV9e1oISQRHnMJsBC3OBdYDmx8xeKeASrKaw6A`.

And we should get the following response.
```
```json
{
"@context": "https://w3id.org/did-resolution/v1",
"didDocument": {
Expand Down
168 changes: 168 additions & 0 deletions packages/did-method-element/docs/public-ropsten-node.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
# Virtual Private Server Ropsten Node

This document will describe how to create a public-facing Element Node
using the Ropsten Ethereum Testnet using Ubuntu 20.04 LTS.

## Requirements

This document is intended for an Ubuntu 20.04 LTS server, with
a public Ipv4/ipv6 address, in an Virtual Private Server environment
such as those hosted with Digital Ocean, Linode, or Vultr. The
minimum requirements are listed below.

- 2 vCPU
- 4GB of RAM
- 40GB of Storage

## Install Requirements

```
# apt-get update
# apt-get upgrade
# apt-get install -y unattended-upgrades software-properties-common python-is-python3 make gcc g++
# echo "unattended-upgrades unattended-upgrades/enable_auto_updates boolean true" | debconf-set-selections; dpkg-reconfigure -f noninteractive unattended-upgrades
```

### MongoDB Service

```
# wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | apt-key add -
# echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" > /etc/apt/sources.list.d/mongodb-org-4.4.list
# apt-get update
# apt-get install -y mongodb-org
# systemctl daemon-reload
# systemctl enable mongod.service
# systemctl start mongod.service
```

Source: https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-ubuntu/

### IPFS Service

```
# cd /tmp
# wget https://dist.ipfs.io/go-ipfs/v0.12.0/go-ipfs_v0.12.0_linux-amd64.tar.gz
# tar -xzf go-ipfs_v0.12.0_linux-amd64.tar.gz && cd go-ipfs
# bash install.sh
# sysctl -w net.core.rmem_max=2500000
# vim /lib/systemd/system/ipfs.service
--- Create File ---
[Unit]
Description=IPFS
After=network.target
[Service]
ExecStart=/usr/local/bin/ipfs daemon --migrate
Restart=always
User=root
Group=root
Restart=on-failure
KillSignal=SIGINT
[Install]
WantedBy=multi-user.target
--- EOF ---
# ipfs init
# systemctl daemon-reload
# systemctl enable ipfs
# systemctl start ipfs
```

### Ethereum Ledger Service

```
# add-apt-repository -y ppa:ethereum/ethereum
# apt-get update
# apt-get -y install ethereum
# vim /lib/systemd/system/ropsten.service
--- Create File ---
[Unit]
Description=Ropsten
After=network.target
[Service]
ExecStart=/usr/bin/geth --syncmode light --ropsten --http
Restart=always
User=root
Group=root
Restart=on-failure
KillSignal=SIGINT
[Install]
WantedBy=multi-user.target
--- EOF ---
# systemctl daemon-reload
# systemctl enable ropsten
# systemctl start ropsten
```

## Install Nodejs

```
# curl -fsSL https://deb.nodesource.com/setup_lts.x | bash -
# apt-get install -y nodejs
# npm install pm2 -g
```

## Build and Run

```
# cd ~
# git clone https://github.com/transmute-industries/sidetree.js.git
# cd sidetree.js/packages/dashboard
# npm i
# vim .env.local
--- Create File ---
SIDETREE_METHOD=elem:ropsten
DESCRIPTION="Sidetree on Ethereum Ledger and IPFS Cas"
# Sidetree Variables
MONGO_DB_CONNECTION_STRING=mongodb://localhost:27017/
DATABASE_NAME=element-ropsten
MAX_CONCURRENT_DOWNLOADS=20
BATCH_INTERVAL_IN_SECONDS=5
OBSERVING_INTERVAL_IN_SECONDS=5
# Element Node Variables
ELEMENT_CONTENT_ADDRESSABLE_STORE_SERVICE_URI=/ip4/127.0.0.1/tcp/5001
ELEMENT_ANCHOR_CONTRACT=0x920b7DEeD5CdE055260cdDBD70C000Bbd5b30997
ETHEREUM_RPC_URL=http://localhost:8545
ETHEREUM_PROVIDER=$ETHEREUM_RPC_URL
ETHEREUM_PRIVATE_KEY=YOUR_PRIVATE_KEY_HERE
ETHEREUM_MNEMONIC='YOUR_MNEMONIC_PHRASE'
--- EOF ---
# npm run build
# pm2 start npm --name "Element Dashboard" -- start
# pm2 save
# pm2 startup
```

## Setup Domain with Nginx and Let's Encrypt

```
# ufw allow ssh
# ufw allow http
# ufw allow https
# ufw enable
# apt-get install -y nginx
# vim /etc/nginx/sites-enabled/element
--- Create File ---
server {
listen 80;
listen [::]:80;
server_name YOUR_DOMAIN_NAME;
root /var/www/html;
location ^~ /.well-known/acme-challenge/ {
try_files $uri $uri/ =404;
}
location / {
proxy_pass http://localhost:3000/;
}
}
--- EOF ---
# apt install -y certbot python3-certbot-nginx
# certbot --nginx -d YOUR_DOMAIN_NAME --non-interactive --agree-tos --register-unsafely-without-email --redirect
```

0 comments on commit feb457e

Please sign in to comment.