Skip to content

Latest commit

 

History

History
262 lines (159 loc) · 11.6 KB

docker-element-ropsten-install.md

File metadata and controls

262 lines (159 loc) · 11.6 KB

Testnet Docker Install

This guide will describe how to install and run Element locally using docker. The purpose of this guide is to provide a simple-as-possible method for testing did element using a Mac, Windows or Linux desktop envrionment.

Table of Contents

  1. Install Nodejs
  2. Install Docker
  3. Infura
  4. Create Wallet
  5. Fund Wallet
  6. Run Element Dashboard
  7. Create / Resolve Operation
  8. Clean Up

1. Install Nodejs

Nodejs can be run on a variety of operating systems. For instructions on how to install nodejs on your device plase refer to: https://nodejs.org

2. Install Docker

Docker can be installed on a variety of operating systems. For instructions on how to install the docker engine on your device, please refer to: https://docs.docker.com/engine/install/.

In the case of Linux, the docker-compose command needs to be installed seprately, please refer to this documentation: https://docs.docker.com/compose/install/.

To continue with the instructions for this installation, you should be able to run the docker and docker-compose commands.

3. Infura

3.1 In your browser navigate to https://infura.io. Then click on Sign Up in the navigation bar.

infura-step01

3.2 Enter your email address, provide a secure password and click on the SIGN UP button to submit the form.

infura-step02

3.3 A confirmation screen will appear indicating that a confirmation link was sent to your email.

infura-step03

3.4 Locate the confirmation email in your inbox. Click on the CONFIRM EMAIL ADDRESS button in the mail body.

infura-step04

3.5 You will be redirected to the Infura dashboard. Click on the CREATE NEW PROJECT button in the top right.

infura-step05

3.6 Select Ethereum from the dropdown for the product, and provide element for the name.

infura-step06

3.7 Under the KEYS section, select ROPSTEN from the endpoint dropdown. Our Ehtereum Provider will be the https link.

infura-step07

4. Create Wallet

4.1 In your browser navigate to https://metamask.io. Click on the Download button.

metamask-step01

4.2 You will br provided with a link to download the plugin for your browser.

metamask-step02

4.3 Click on the link to add to Firefox (or Chrome), depending on which browser you are using.

metamask-step03

4.4 Once the plugin has been installed, a new tab will open to initialize metamask.

metamask-step04

4.5 Click on the right option to Create a Wallet.

metamask-step05

4.6 Provide an answer to the option to provide anonymous statistics.

metamask-step06

4.7 Create a password. This should be secure but memorable, as you will need to enter this password if you plan to use Metamask from your browser.

metamask-step07

4.8 You will then be taken to a video which provides guidance for securing your wallet. Click on the Next button when you're ready.

metamask-step08

4.9 From there click on the blurred box to reveal your Recovery Phrase.

metamask-step09

4.10 Copy the contents of your Recovery Phrase and paste it somewhere, or physically write it down. Click on Next when you're ready.

metamask-step10

4.11 To make sure you have your pass phrase recorded, you will be prompted to select each word in order. Do so and click Confirm.

metamask-step11

4.12 You will be given a short screen congratulating you for setting up your wallet. Click on All Done.

metamask-step12

4.13 You will be taken to your wallet, which will have no funds in it.

metamask-step13

4.14 Click on the circular identicon in the top right corner, and select Settings from the bottom of the menu.

metamask-step14

4.15 From there, click on the Advantaced tab, and then locate the option for the option to Show Test Networks, and turn it on.

metamask-step15

4.16 After that you can click on the select menu that says Mainnet and select the option that says Ropsten.

metamask-step16

4.17 From the settings menu, you can click on the close button to display your wallet. We are now ready to add test funds.

metamask-step17

5. Fund Wallet

5.1 In Metamask, click on Account 1 at the top of your wallet to copy your address.

add-funds-step01

5.2 Open a new tab, and search ropsten faucet.

add-funds-step02

5.3 Each site should function the same effectively. Put your address in the text field and click Send me rETH.

add-funds-step03

5.4 Alot of sites will be empty, or require a queue that takes several minutes. You only need a small amount.

add-funds-step04

5.5 Once you have a small amount of funds in your wallet, you're ready to go.

add-funds-stop05

Run with Docker

Clone the Sidetree.js repository, install and run background processes.

git clone git@github.com:transmute-industries/sidetree.js.git
cd sidetree.js
npm i
docker-compose -f ./docker-compose.yml up --detach --remove-orphans

This will run ganache, mongo and ipfs. Specifically we will use ipfs and mongo, ganache is used for development. We will be using ropsten via the Infura url that we provide.

cd packages/dashboard
cp .env.ropsten.example .env.ropsten

From there you will need to populate the .env.ropsten file with the values you created from this readme. Open the .env.ropsten and enter the following values.

  1. MONGO_DB_CONNECTION_STRING = mongodb://localhost:27017/
  2. ELEMENT_CONTENT_ADDRESSABLE_STORE_SERVICE_URI = /ip4/127.0.0.1/tcp/5001
  3. ETHEREUM_RPC_URL = Ehtereum Provider from 3.7
  4. ETHEREUM_MNEMONIC = Recovery Phrase from 4.10

Edit .env.ropsten with your preferred text editor (vim, emacs, notepad++, textedit)

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='https://ropsten.infura.io/v3/<project-id>'
ETHEREUM_PROVIDER=$ETHEREUM_RPC_URL
ETHEREUM_MNEMONIC="metamask recovery phrase here"

Once you have populated the .env.ropsten file, you can run the dashboard with the following command.

npm run dev:ropsten

You will then be able to access the dashboard on http://localhost:3000

7. Create / Resolve Operation

Once we have Element running on our local machine, we can then run a test operation to see if we are able to create and then resolve a did.

Element Node Welcome Splash

We can start by opening up localhost:3000 in our browser and then clicking on the Wallet link on the "Manage" card.

Element Node Create Wallet

From there we can click on the Create Wallet button, this will create a private/public key pair to allow us to sign did's. Note: The wallet will throw an error when not used on localhost or https.

Element Node Create Did

Once the wallet is created, you will be automatically redirected to the create route. Can can then click on the CREATE DID button to generate a did.

Element Node Show Created Did

Once the operation is complete, you should see the confirmation above. To see if we can resolve the did, we can click on the underlined did to be redirected to the resolve page.

Element Node Resolve Created Did

You should see a card that looks like the above image. You can then click on the arrows to show more information about the did.

Element Node Created Did Details

If you want more information on how to use the API interact with dids, you can read the documentation at localhost:3000/docs.

8. Clean up

Top stop running the dashboard process hi Ctrl + c on the keyboard.

To turn off docker and remove the processes run

docker ps
CONTAINER ID   IMAGE                             COMMAND 
555af580276e   trufflesuite/ganache-cli:latest   ...
19f210df6d08   ipfs/go-ipfs:v0.7.0               ...
1b4d11e7615c   mongo                   

docker kill 555af580276e
docker kill 19f210df6d08
docker kill 1b4d11e7615c