This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| version: "3" | |
| services: | |
| ganache: | |
| build: | |
| context: . | |
| dockerfile: Dockerfile.ganache | |
| ports: | |
| - "8545:8545" | |
| dapp: | |
| build: . |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # using node alpine as base image | |
| FROM node:alpine | |
| # working dir ./app | |
| WORKDIR /app | |
| # Install the prerequisites to install the web3 and other ethereum npm packages | |
| RUN apk update && apk upgrade && apk add --no-cache bash git openssh | |
| RUN apk add --update python krb5 krb5-libs gcc make g++ krb5-dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # using node alpine as base image | |
| FROM node:alpine | |
| # working dir ./app | |
| WORKDIR /app | |
| # Copy react package.json | |
| COPY ./package.json . | |
| # install dependencies |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { Component } from 'react'; | |
| import { BrowserRouter as Router, Route } from "react-router-dom"; | |
| import './App.css'; | |
| import message from "./message"; | |
| class App extends Component { | |
| render() { | |
| return ( | |
| <Router> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { Component } from "react"; | |
| import axios from "axios"; | |
| let endpoint = "http://localhost:4000"; | |
| class Message extends Component { | |
| constructor(props) { | |
| super(props); | |
| this.state= { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const express = require("express"); | |
| const bodyParser = require("body-parser"); | |
| const cors = require("cors"); | |
| const app = express(); | |
| const contractAPIRoutes = require("./routes/contract-API"); | |
| const smartContractAPIRoutes = require("./routes/smart-contract-API"); | |
| const port = 4000; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const express = require("express"); | |
| const router = express.Router(); | |
| const logic = require("../../ethereum/logic"); | |
| router.get("/", async (req,res,next) => { | |
| let message = await logic.getMessage(); | |
| res.send(message); | |
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const express = require("express"); | |
| const router = express.Router(); | |
| const compile = require("../../ethereum/compile"); | |
| const deploy = require("../../ethereum/deploy"); | |
| // Compile the contract | |
| router.post("/compile", async function(req, res, next) { | |
| const result = compile(); | |
| res.send(result); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "name": "docker-ethereum", | |
| "version": "1.0.0", | |
| "description": "", | |
| "main": "./server/index.js", | |
| "scripts": { | |
| "test": "echo \"Error: no test specified\" && exit 1", | |
| "start": "nodemon ./server/index.js" | |
| }, | |
| "author": "", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const fs = require("fs-extra"); | |
| const {web3} = require("./web3"); | |
| const compileContract = require("./build/Message.json"); | |
| // Contract object deployed on network (ganache-cli or testnet or mainnet) | |
| // network can be selected in web3 file | |
| // cont | |
| const getContractObject = () => { | |