Giter Club home page Giter Club logo

dao1901's Introduction

Requirements:

  • node ^7.8.0
  • python 3.5
  • solc ^0.4.4
  • Truffle ^3.3.0
  • Testrpc ^3.0.5

Trello: https://trello.com/b/bVfPFfjM/tasks

Introduction

This application is divided in two sections, protocol and ui. Protocol folder manage all things related to Ethereum, whereas ui will import protocol as a npm module. This architecture offers a clean separation between front and back.

The UI is built with React, Redux, Redux-Saga, Bootstrap 4, etc.

Run the app with Testrpc and Truffle (recommended way)

At the root level, install all dependencies

npm install

In a separate tab, run testrpc

testrpc [-s toto]
or node_modules/.bin/testrpc

In a separate tab, compile and migrate the contracts

cd protocol
npm install
[truffle compile --compile-all]
truffle migrate

Attach a console

truffle console
or geth attach http://localhost:8545

Serve the app

npm run dev

=> Go to http://localhost:8080/

Run UI tests (using Jest)

npm run testUI

Run Smart Contract tests (using Mocha and Chai under the hood)

npm run testProtocol

If you work on the protocol, you may want to use npm link to avoid reinstalling the lib at each change.

npm run linkprotocol

Run the app with Geth

Launch the Geth node

geth --dev --rpc --rpcapi 'web3,eth,debug' --rpccorsdomain="*" --datadir /tmp/ethereum_dev_mode

To load the auto setup

geth --dev --preload autoSetupForGeth.js attach ipc:/tmp/ethereum_dev_mode/geth.ipc

Prepare contracts to be deployed, with python, based on a template

run

npm run compile

which is equivalent to

cd ./protocol/customDeploy
python3.5 compile.py ../contracts/Owned.sol
python3.5 compile.py ../contracts/Dao1901Members.sol
python3.5 compile.py ../contracts/Dao1901Votes.sol

Three files are created (one per contracts)

Then you need to do the following boilerplate stuff, either using autoSetup or manually

Auto Setup for Geth

In the geth console, load script "autoSetupForGeth.js" It will:

  • create 3 accounts if not already 3 (alias name alice, bob, carol)
  • run the miner (2 CPU)
  • load contract deployment functions
    loadScript("autoSetupForGeth.js");

then deploy contracts

var Dao1901Members = deployDao1901Members();
// when Dao1901Members is mined
var Dao1901Votes = deployDao1901Votes(Dao1901Members.address);

then serve the app

npm run start

The manual way with Geth

In the geth console

// check if accounts exists
personal.listAccounts 
// create account if no one exists
// it will set eth.coinbase automatically
personal.newAccount("");
// check eth.coinbase
eth.coinbase
// unlock your account
personal.unlockAccount(eth.accounts[0], "", 3600);

run the miner

miner.start(2)

Deploy the contracts

load the Dao1901Members deploy function and run it

loadScript("Dao1901Members.js");
var Dao1901Members = deployDao1901Members();

Wait Dao1901Members to be mined, then: same for Dao1901Votes

loadScript("Dao1901Votes.js");
var Dao1901Votes = deployDao1901Votes(Dao1901Members.address);

Wait Dao1901Votes to be mined

Type exit to quit the console

dao1901's People

Contributors

kurthalex avatar altais avatar vivi3n avatar msornay avatar acathla-fr avatar julienbrg avatar slashbinslashnoname avatar lekz974 avatar jdetychey avatar nammalvar avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.