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.
- Install Nodejs
- Install Docker
- Infura
- Create Wallet
- Fund Wallet
- Run Element Dashboard
- Create / Resolve Operation
- Clean Up
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
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.1 In your browser navigate to https://infura.io. Then click on Sign Up
in the navigation bar.
3.2 Enter your email address, provide a secure password and click on the SIGN UP
button to submit the form.
3.3 A confirmation screen will appear indicating that a confirmation link was sent to your email.
3.4 Locate the confirmation email in your inbox. Click on the CONFIRM EMAIL ADDRESS
button in the mail body.
3.5 You will be redirected to the Infura dashboard. Click on the CREATE NEW PROJECT
button in the top right.
3.6 Select Ethereum
from the dropdown for the product, and provide element
for the name.
3.7 Under the KEYS
section, select ROPSTEN
from the endpoint dropdown. Our Ehtereum Provider will be the https link.
4.1 In your browser navigate to https://metamask.io. Click on the Download
button.
4.2 You will br provided with a link to download the plugin for your browser.
4.3 Click on the link to add to Firefox (or Chrome), depending on which browser you are using.
4.4 Once the plugin has been installed, a new tab will open to initialize metamask.
4.5 Click on the right option to Create a Wallet
.
4.6 Provide an answer to the option to provide anonymous statistics.
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.
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.
4.9 From there click on the blurred box to reveal your Recovery Phrase.
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.
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
.
4.12 You will be given a short screen congratulating you for setting up your wallet. Click on All Done
.
4.13 You will be taken to your wallet, which will have no funds in it.
4.14 Click on the circular identicon in the top right corner, and select Settings
from the bottom of the menu.
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.
4.16 After that you can click on the select menu that says Mainnet
and select the option that says Ropsten
.
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.
5.1 In Metamask, click on Account 1
at the top of your wallet to copy your address.
5.2 Open a new tab, and search ropsten faucet
.
5.3 Each site should function the same effectively. Put your address in the text field and click Send me rETH
.
5.4 Alot of sites will be empty, or require a queue that takes several minutes. You only need a small amount.
5.5 Once you have a small amount of funds in your wallet, you're ready to go.
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.
- MONGO_DB_CONNECTION_STRING = mongodb://localhost:27017/
- ELEMENT_CONTENT_ADDRESSABLE_STORE_SERVICE_URI = /ip4/127.0.0.1/tcp/5001
- ETHEREUM_RPC_URL = Ehtereum Provider from 3.7
- 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
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.
We can start by opening up localhost:3000
in our browser and then clicking on the Wallet
link on the "Manage" card.
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.
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.
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.
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.
If you want more information on how to use the API interact with dids, you can read the documentation at localhost:3000/docs
.
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