Example of an application to rent items.
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.
Provide methods to include items to rent and hire ordered items.
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
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 the contract with truffle:
$ npm run compile
Start testrpc connection:
$ npm start
For a better understanding of a local blockchain connection, this lecture may be useful: Connecting to the network
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.
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.
Truffle console can be used to interact with Renthereum. For example:
$ npm run console
truffle(test)> Renthereum.deployed().itemsCount.call(); // 0