Developer-Guide

Overview

This guide shows you how to setup the developer environment to contribute to project.

We recommend reading the SmartVault Design Document for background information and design choices taken.

Install the CLI

The CLI provides all the wallet operations without having to install or setup the source code. Run npm install -g @hashmesan/smartvault. For usage, see our examples.

Setup Development Environment

The main branch has the stable changes. The develop branch is used for development. Features are merged into develop, tested, and merged back to main.

Checkout the source

git clone git@github.com:hashmesan/harmony-totp.git
git checkout develop

Install global dependencies

yarn global add truffle@5.1.67
yarn global add ganache-cli@6.12.2

Install dependencies

Always install dependencies at the base directory because there are common libraries (in library) which are shared across relayer, cli, and webclient.

yarn install

Compile smart contracts

truffle compile

Setup Web client

cd webclient && yarn install
yarn dev # runs webpack-dev-server

Setup Relayer

cd relayer && yarn install

Configure the keys for relayer.

Create a file in relayer/.env

PRIVATE_KEY=
IPFS_ID=
IPFS_SECRET=

Get an IPFS account from infura and they will provide an IPFS ID and Secret to fill out in the config. Create a harmony wallet & provide a private key with some ONE coins to pay for transaction fees as a relayer. On testnet, you can get this for free on https://faucet.pops.one/

You can run without IPFS account. When you create an account, don't pass domains information and it will skip register ENS. See code

Development Workflow

Depending on the feature you are building, you do not have to run all of the components. We already run the mainnet0 (shard0) and testnet3 (shard0 and shard3). If your work is limited to testnet & mainnet, you don't have to run relayer. If you are doing heavy development on the smart contract it may be more efficient to do your testing on development network.

Untar a prebuilt ganache db which contains the ENS smart contracts already deployed to 0xD29154f92F4825202768961ca44d1ffE26C11F76

tar xvf ganache-db.tar

and run it sh ganache.sh on a separate terminal.

Webclient config.js refers to development Truffle always refers to development. Make sure you run truffle with --network development.

Send ONE in development

truffle console
> web3.eth.getAccounts().then(accounts=>firstAccount=accounts[0]);
> web3.eth.sendTransaction({from: firstAccount, to: "", value: web3.utils.toWei("2.0")});

Building Dapps

There's a world of possibilities in implementing dapps, and defi into the wallet. Aave, Balancer, Curve, Uniswap, Yearn, Compound can be found in other wallets like argents, loopring, and gnosis.

See Integration Dapps