Sitemap
Compound Labs

Compound is an algorithmic, autonomous interest rate protocol built for developers, to unlock a universe of open financial applications.

Follow publication

Setting up an Ethereum Development Environment

10 min readFeb 10, 2020

--

Ethereum Development Key Concepts

Installing MetaMask

MetaMask network switcher screenshot

Installing the Solidity Compiler (solc)

solc MySmartContracts.sol

Installing Web3.js

<script src="https://cdn.jsdelivr.net/npm/web3@latest/dist/web3.min.js"></script>
npm install web3## oryarn add web3
const Web3 = require('web3');
const web3 = new Web3('http://localhost:8545');
const web3 = new Web3('https://mainnet.infura.io/v3/_YOUR_API_KEY_'); // Infura can also access public test nets 
// by changing the subdomain.
// Eg: https://ropsten.infura.io/v3/_YOUR_API_KEY_

Infura

Ganache CLI

ganache-cli

Testing Out Compound’s Smart Contracts

ganache-cli -f https://cloudflare-eth.com
## Installs Ganache CLI globally so you can run it
## anywhere with `ganache-cli`
npm install -g ganache-cli## or: yarn global add ganache-cli

Programming Your First DApp

Writing a Smart Contract with Solidity

mkdir first-ethereum-dappcd first-ethereum-dapp/
touch FirstContract.sol## or on non-bash Windows CLI: fsutil file createnew FirstContract.sol 0

Compiling a Solidity Smart Contract

solc --bin --abi -o ./build FirstContract.sol

Configuring Your Project and Local Development Environment

npm init -y## OR if you're a yarn person## yarn init -y
npm install web3 ganache-cli http-server## alternatively
## yarn add web3 ganache-cli http-server
npm install -g npx## or: yarn global add npx
cd first-ethereum-dapp/npx ganache-cli

Deploying to Your Local Test Net

touch deploy.js
node deploy.js
> FirstContract was successfully deployed!
> FirstContract can be interfaced with at this address:
> 0x702f935d608Aadf90323310c489B2903af20AA43

Writing the Front-End Web Page of our DApp

touch index.html

Running Your New Full-Stack DApp

npx http-server> Starting up http-server, serving ./
> Available on:
> http://127.0.0.1:8080
> Hit CTRL-C to stop the server
A screenshot of the front-end web page of our Ethereum DApp example

--

--

Compound Labs
Compound Labs

Published in Compound Labs

Compound is an algorithmic, autonomous interest rate protocol built for developers, to unlock a universe of open financial applications.

Responses (6)