/renthereum-workshop-contracts

Ethereum use case: app to rent items.

Primary LanguageJavaScriptApache License 2.0Apache-2.0

Ethereum Workshop: Renthereum.

Example of an application to rent items.

Build Status

NOTE: Swapy Network together with Ethereum BH Meetup Group is going to host a Ethereum workshop in Belo Horizonte, Brazil. This repository was created for educational purposes only.

Table of Contents

Contracts

Provide methods to include items to rent and hire ordered items.

Setup

Install Dependencies

Install Node v8.9.1

Truffle is used for deployment. We run the version installed from our dependencies using npm scripts, but if you prefer to install it globally you can do:

$ npm install -g truffle

Install project dependencies:

$ npm install

Environment

For set up your wallet, an environment file is necessary. We provide a sample.env file. We recommend that you set up your own variables and rename the file to .env.

sample.env

# To get the twelve words, you need to set up
# your account on the MetaMask extension.

export WALLET_MNEMONIC="twelve words mnemonic ... potato bread coconut pencil"

After that, make available your environment file inside the bash context:

$ source .env

Compile

Compile the contract with truffle:

$ npm run compile

Start local network

Start testrpc connection:

$ npm start

For a better understanding of a local blockchain connection, this lecture may be useful: Connecting to the network

Deploy

Run our migrations:

$ npm run migrate

We're running the application in a local network defined in truffle.js.

After the transaction mining, the Rethereum is disponible for usage.

Run tests

We're using Truffle's test support. The script scripts/test.sh creates a local network and calls the unit tests.

Type

$ npm test

and run the Renthereum tests.

Interact with Renthereum

Truffle console can be used to interact with Renthereum. For example:

$ npm run console
truffle(test)> Renthereum.deployed().itemsCount.call(); // 0