• Stars
    star
    194
  • Rank 200,219 (Top 4 %)
  • Language
    JavaScript
  • Created about 7 years ago
  • Updated about 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

🛰️ A boilerplate Truffle Box project with Next.js for rapid Ethereum Dapp development

Truffle and Next.js


comet

Rapid Ethereum Dapp Development

made for ethereum to the moon MIT license


A Minimal Smart Contract Development Boilerplate

Truffle is great for developing Solidity smart contracts, but building a React frontend for a smart contract is often a chore. Next.js is one of the easiest ways to build such a frontend and the integration between Truffle and Next.js is what this boilerplate is trying to demonstrate.

There are two major features:

  • A plain truffle init project is used as the base (along with a SimpleStorage example contract).

  • A Next.js project resides in the client directory with a symlink to the output folder of the contract ABI definitions. The Next.js app also provides a simple skeleton for connecting to and interacting with the smart contract on a network.

For more information on how the frontend works, go read the README.md located in the client directory.

Installation

  1. Install Truffle globally.

    npm install -g truffle
  2. Download the box. This also takes care of installing the necessary dependencies.

    truffle unbox adrianmcli/truffle-next
  3. Run the development console.

    truffle develop
  4. Compile and migrate the smart contracts. Note inside the development console we don't preface commands with truffle.

    compile
    migrate
  5. Run the next.js server for the front-end. Smart contract changes must be manually recompiled and migrated.

    // Change directory to the front-end folder
    cd client
    // Serves the front-end on http://localhost:3000
    npm run dev
  6. Truffle can run tests written in Solidity or JavaScript against your smart contracts. Note the command varies slightly if you're in or outside of the development console.

    // If inside the development console.
    test
    
    // If outside the development console..
    truffle test

Running with MetaMask

Since truffle develop exposes the blockchain onto port 9545, you'll need to add a Custom RPC network of http://localhost:9545 in your MetaMask to make it work.

Running with TestRPC

We highly recommend using truffle develop over testrpc, but if you want to use testrpc, there are a couple things you need to do:

  • Change Line 6 of client/lib/getWeb3.js to use localhost:8545 instead of localhost:9545 so we refer to testrpc instead of truffle develop.

  • Run your testrpc with the following command (because reasons):

    testrpc --gasLimit 6721975 --gasPrice 100000000000
    

More Repositories

1

eth95

🛠️ A smart contract UI for your Ethereum dapp project
TypeScript
527
star
2

web3-vs-ethers

A basic cheatsheet of Web3.js vs Ethers (along w/ example apps!)
JavaScript
377
star
3

react-rotating-text

📝 A simple react component to display an array of words/sentences with a typewriter effect.
JavaScript
223
star
4

react-reveal-text

✨ A small react library for animating the revealing of text.
JavaScript
186
star
5

dapp-boilerplate

⚡A minimal types-first boilerplate for Ethereum frontend dapp development.
TypeScript
112
star
6

omg-counters

😍 Increment decrement counters using various frontend frameworks.
48
star
7

truffle-react

⚛️ A boilerplate Truffle Box project with Create React App for rapid Ethereum Dapp development
JavaScript
46
star
8

firebase-nextjs-example

An example app for using firebase with Next.js
JavaScript
19
star
9

js-state-encapsulation

Examples of state encapsulation in Javascript
JavaScript
19
star
10

ganache-jest-example

🚀 Minimal Solidity contract testing with Ganache and Jest
JavaScript
15
star
11

next-boilerplate

📐 A modern universal boilerplate for React applications using Next.js.
JavaScript
14
star
12

styled-mui-next

An example application of using Styled-Components and Next.js with Material-UI
JavaScript
13
star
13

drizzle-react-from-scratch

Trying to learn Drizzle by making projects with it from scratch
JavaScript
9
star
14

react-build-dist

A simple utility for compiling your React components to standalone modules.
JavaScript
9
star
15

rehydrate-workshop

A small collection of basic components built with Rehydrate 💧.
OCaml
7
star
16

simple-js-blockchain

🔗 A simple JS blockchain using only Flow types and functions
JavaScript
6
star
17

ethbtc-example

JavaScript
5
star
18

with-redux-combineReducers

JavaScript
3
star
19

react-build-lib

A simple utility for compiling your React components to CommonJS modules.
JavaScript
3
star
20

nextjs-symlink-bug

JavaScript
3
star
21

olis

A collaborative chat platform for the web built with Meteor and React
JavaScript
3
star
22

hodlbuddy

A script for me to see how much my cryptocurrency portfolio is worth
JavaScript
2
star
23

nouns.run

TypeScript
2
star
24

zenith

🌌 A better API wallet for ZenCash
JavaScript
2
star
25

meta-auth-example

An example usage of MetaAuth with a React frontend and an Express backend
JavaScript
2
star
26

create-react-app-brunch

Create simple configurable React apps with a Brunch-based CLI.
JavaScript
2
star
27

simple-express-jest

A simple ExpressJS and Jest starter project for absolute beginners
JavaScript
2
star
28

learn-more-cs

A simple project for us to track and manage our learning of certain computer science principles.
2
star
29

dev-react-component

A minimalistic boilerplate for publishing a React component to NPM.
JavaScript
2
star
30

twilio-sms-verification-example

A minimalistic example of SMS verification with Twilio using a React app and a Node server.
JavaScript
1
star
31

web3-CI-bug

1
star
32

simple-zap

An attempt to demonstrate a simple zap contract
Solidity
1
star
33

hangtight.club

🎟️ A queue ticketing system for Nounish events!
Solidity
1
star
34

consensys-rxjs-talk

Example project for my RxJS talk w/ ConsenSys (along w/ a Drizzle-Utils demo)
JavaScript
1
star
35

practice-typing

A simple Angular 2 app to help people practice typing phrases on their keyboard.
TypeScript
1
star
36

track-page-requests

A node.js script for tracking page requests
JavaScript
1
star
37

repro-ganache-bug

JavaScript
1
star
38

defi-experiments

TypeScript
1
star
39

web3-CI-bug-npm

1
star
40

cruise-reviews

JavaScript
1
star
41

lookintodefi

1
star
42

hackernews-node

TypeScript
1
star
43

bc-parks

JavaScript
1
star
44

repro-eth-block-tracker-bug

JavaScript
1
star
45

non-overwhelming-zkp

1
star
46

decoder-import-bug

JavaScript
1
star
47

buidler-deploy-repro

A reproduction repo of buidler deploy not showing contract addresses for a local deploy
JavaScript
1
star