Git Product home page Git Product logo

arvindkalra / express-box Goto Github PK

View Code? Open in Web Editor NEW
49.0 4.0 21.0 349 KB

A truffle box to serve as the foundation of any Truffle and Express.js dApp. This Box Uses NodeJS(Express JS) to provide API endpoints to the Ethereum Blockchain smart contract so that this smart contract can be used in Android Apps as well.

HTML 24.09% JavaScript 55.05% CSS 4.70% Solidity 16.16%
truffle-box truffle nodejs ethereum-blockchain ganache-cli solidity

express-box's Introduction

Express-Box

To Be Used as Truffle Box Creating API Endpoints for Ethereum Blockchain.

We use personalised blockchain for Ethereum BlockChain Development. This personalised blockchain is made in the GanacheCLI.

The Smart Contract Written in solidity language is deployed on this Ethereum Blockchain. Smart Contract is Immutable hence, once deployed it can't be changed.

A truffle box to serve as the foundation of any Truffle and Express.js dApp.

This Box Uses NodeJS(Express JS) to provide API endpoints to the Ethereum Blockchain smart contract so that this smart contract can be used in Android Apps as well.

Pre-Requisites

  1. NodeJS
  2. A Package Manager for NodeJS, such as Yarn or npm (comes pre-installed with NodeJS)
  3. GanacheCLI
  4. Truffle

Installation

  1. Install Truffle and Ganache CLI globally. If you prefer, the graphical version of Ganache works as well!
npm install -g truffle
npm install -g ganache-cli
  1. Download the box. This also takes care of installing the necessary dependencies.
truffle unbox arvindkalra/express-box

  1. Install all the node modules required by running:
// install all the node modules using npm
npm install

or if you prefer yarn

//install all the node modules using yarn
yarn install
  1. Start truffle development console using
truffle develop
  1. Inside the truffle console run compile to compile the contracts

  2. You can see that a new /build folder has been created in the root directory which contains the compiled contracts.

  3. Now these contracts need to be deployed on the Blockchain. For this, run migrate inside the truffle development console

  4. To run the Express server yarn start or npm start

  5. In the browser window open http://localhost:3000/.

Collaborators

  1. ARVIND KALRA
  2. PRANAV SINGHAL

express-box's People

Contributors

7flash avatar arvindkalra avatar georgewl avatar onlyonejmjq avatar pranav-singhal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

express-box's Issues

Docs outdated

the docs need to be updated to support truffle develop

Compilation Error

I unboxed the repo and did npm install
then truffle compile, I got this error

Compiling ./contracts/ConvertLib.sol...
Compiling ./contracts/MetaCoin.sol...
Compiling ./contracts/Migrations.sol...

Compilation warnings encountered:

/Users/iSh3lan/Udacity/Block Chain/Project 5/ExpressBox/contracts/MetaCoin.sol:15:2: Warning: This declaration shadows an existing declaration.
        function MetaCoin() public {
 ^ (Relevant source part starts here and spans across multiple lines).
/Users/iSh3lan/Udacity/Block Chain/Project 5/ExpressBox/contracts/MetaCoin.sol:10:1: The shadowed declaration is here:
contract MetaCoin {
^ (Relevant source part starts here and spans across multiple lines).



/Users/iSh3lan/Udacity/Block Chain/Project 5/ExpressBox/contracts/ConvertLib.sol:1:1: SyntaxError: Source file requires different compiler version (current compiler is 0.5.0+commit.1d4f565a.Emscripten.clang - note that nightly builds are considered to be strictly less than the released version
pragma solidity ^0.4.17;
^----------------------^
,/Users/iSh3lan/Udacity/Block Chain/Project 5/ExpressBox/contracts/MetaCoin.sol:1:1: SyntaxError: Source file requires different compiler version (current compiler is 0.5.0+commit.1d4f565a.Emscripten.clang - note that nightly builds are considered to be strictly less than the released version
pragma solidity ^0.4.17;
^----------------------^
,/Users/iSh3lan/Udacity/Block Chain/Project 5/ExpressBox/contracts/MetaCoin.sol:15:2: SyntaxError: Functions are not allowed to have the same name as the contract. If you intend this to be a constructor, use "constructor(...) { ... }" to define it.
        function MetaCoin() public {
 ^ (Relevant source part starts here and spans across multiple lines).
,/Users/iSh3lan/Udacity/Block Chain/Project 5/ExpressBox/contracts/Migrations.sol:1:1: SyntaxError: Source file requires different compiler version (current compiler is 0.5.0+commit.1d4f565a.Emscripten.clang - note that nightly builds are considered to be strictly less than the released version
pragma solidity ^0.4.17;
^----------------------^
,/Users/iSh3lan/Udacity/Block Chain/Project 5/ExpressBox/contracts/MetaCoin.sol:15:2: Warning: This declaration shadows an existing declaration.
        function MetaCoin() public {
 ^ (Relevant source part starts here and spans across multiple lines).
/Users/iSh3lan/Udacity/Block Chain/Project 5/ExpressBox/contracts/MetaCoin.sol:10:1: The shadowed declaration is here:
contract MetaCoin {
^ (Relevant source part starts here and spans across multiple lines).

,/Users/iSh3lan/Udacity/Block Chain/Project 5/ExpressBox/contracts/MetaCoin.sol:23:3: TypeError: Event invocations have to be prefixed by "emit".
                Transfer(msg.sender, receiver, amount);
                ^------------------------------------^
Compilation failed. See above.
Truffle v5.0.2 (core: 5.0.2)
Node v11.2.0
                    

Incorrect file paths

After running npm start, you'll get Error: Cannot find module '../build/contracts/MetaCoin.json'

Unboxing fails, throwing an error

npm ERR! code 128
npm ERR! Command failed: C:\Users\myUser\AppData\Local\Programs\Git\cmd\git.EXE clone -q https://github.com/debris/bignumber.js.git C:\Users\myUser\AppData\Roaming\npm-cache_cacache\tmp\git-clone-af206b19 --config core.longpaths=true
npm ERR! warning: templates not found C:\Users\myUser\AppData\Local\Temp\pacote-git-template-tmp\git-clone-00db848d
npm ERR! fatal: early EOF
npm ERR! fatal: The remote end hung up unexpectedly
npm ERR! fatal: index-pack failed
npm ERR! error: RPC failed; curl 56 OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 10054
npm ERR!

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\myUser\AppData\Roaming\npm-cache_logs\2018-05-01T08_57_08_479Z-debug.log

at ChildProcess.exithandler (child_process.js:272:12)
at ChildProcess.emit (events.js:159:13)
at maybeClose (internal/child_process.js:943:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5)

OS: Win10
Node: 9.3.0
NPM: 5.5.1

How to use metaMask with express?

I just install the metaMask plugin into the chrome. and run the project with npm start.
Then I found the backend(express server) can't find the metamask, and create a new wed3 provider.
Because the metamask is a chrome plugin, and how can I use the metamask's provider?

Alert :There was an error fetching your accounts.

First I want to highlight this:
In read me there is npm server.js did you mean node server.js

The main point is:
I see this message from metamask in the console:
inpage.js:1 ATTENTION: In an effort to improve user privacy, MetaMask stopped exposing user accounts to dapps if "privacy mode" is enabled on November 2nd, 2018. Dapps should now call provider.enable() in order to view and use accounts. Please see https://bit.ly/2QQHXvF for complete information and up-to-date example code.
and I get this error:

  1. alert is not defined at line 15 in app.js

Should it be updated to have provider.enable()?

Compilation Error

I unboxed the repo and did npm install
then truffle compile, I got this error

Compiling ./contracts/ConvertLib.sol...
Compiling ./contracts/MetaCoin.sol...
Compiling ./contracts/Migrations.sol...

Compilation warnings encountered:

/Users/iSh3lan/Udacity/Block Chain/Project 5/ExpressBox/contracts/MetaCoin.sol:15:2: Warning: This declaration shadows an existing declaration.
        function MetaCoin() public {
 ^ (Relevant source part starts here and spans across multiple lines).
/Users/iSh3lan/Udacity/Block Chain/Project 5/ExpressBox/contracts/MetaCoin.sol:10:1: The shadowed declaration is here:
contract MetaCoin {
^ (Relevant source part starts here and spans across multiple lines).



/Users/iSh3lan/Udacity/Block Chain/Project 5/ExpressBox/contracts/ConvertLib.sol:1:1: SyntaxError: Source file requires different compiler version (current compiler is 0.5.0+commit.1d4f565a.Emscripten.clang - note that nightly builds are considered to be strictly less than the released version
pragma solidity ^0.4.17;
^----------------------^
,/Users/iSh3lan/Udacity/Block Chain/Project 5/ExpressBox/contracts/MetaCoin.sol:1:1: SyntaxError: Source file requires different compiler version (current compiler is 0.5.0+commit.1d4f565a.Emscripten.clang - note that nightly builds are considered to be strictly less than the released version
pragma solidity ^0.4.17;
^----------------------^
,/Users/iSh3lan/Udacity/Block Chain/Project 5/ExpressBox/contracts/MetaCoin.sol:15:2: SyntaxError: Functions are not allowed to have the same name as the contract. If you intend this to be a constructor, use "constructor(...) { ... }" to define it.
        function MetaCoin() public {
 ^ (Relevant source part starts here and spans across multiple lines).
,/Users/iSh3lan/Udacity/Block Chain/Project 5/ExpressBox/contracts/Migrations.sol:1:1: SyntaxError: Source file requires different compiler version (current compiler is 0.5.0+commit.1d4f565a.Emscripten.clang - note that nightly builds are considered to be strictly less than the released version
pragma solidity ^0.4.17;
^----------------------^
,/Users/iSh3lan/Udacity/Block Chain/Project 5/ExpressBox/contracts/MetaCoin.sol:15:2: Warning: This declaration shadows an existing declaration.
        function MetaCoin() public {
 ^ (Relevant source part starts here and spans across multiple lines).
/Users/iSh3lan/Udacity/Block Chain/Project 5/ExpressBox/contracts/MetaCoin.sol:10:1: The shadowed declaration is here:
contract MetaCoin {
^ (Relevant source part starts here and spans across multiple lines).

,/Users/iSh3lan/Udacity/Block Chain/Project 5/ExpressBox/contracts/MetaCoin.sol:23:3: TypeError: Event invocations have to be prefixed by "emit".
                Transfer(msg.sender, receiver, amount);
                ^------------------------------------^
Compilation failed. See above.
Truffle v5.0.2 (core: 5.0.2)
Node v11.2.0
                    

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.