• Stars
    star
    163
  • Rank 231,141 (Top 5 %)
  • Language
    Solidity
  • License
    MIT License
  • Created almost 2 years ago
  • Updated almost 2 years ago

Reviews

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

Repository Details

πŸ’Έ Write web apps in Solidity β€” a Solidity web framework / a proof-of-concept implementation of HTTP over Ethereum.

fallback() logo

fallback()

Docs | Simple Demo

Write web apps in Solidity β€” fallback() is a Solidity web framework / a proof-of-concept implementation of HTTP over Ethereum.

See the fallback() docs for more information:

Repository Structure

  • script/: Forge scripts

  • src/: Contract source code

    • example/: Example fallback() web apps

      • SimpleExample.sol: Simple example app

      • FullExample.sol: Example app with prettier HTML responses

      • create-server.js: Base TCP server creation logic

      • call-server.js: Example TCP-to-blockchain fallback() server implementation that uses eth_call to return responses

      • send-server.js: Example TCP-to-blockchain fallback() server implementation that uses eth_send* methods to process requests and return responses (modifies on-chain data)

        This server requires ethers as a dependency; run npm install first.

      • Dockerfile: Example one-container Docker setup with server + HAProxy for rate limiting and caching (used to deploy live demos to AWS Fargate)

    • html-dsl/: Solidity HTML DSL contracts

      • generate-dsl.js: Script which generates a Solidity DSL function for each valid HTML element
      • H.sol: Public API of Solidity HTML DSL
    • http/*.sol: Internal framework code related to HTTP parsing/handling

    • integers/*.sol: Integer libraries (e.g. integer-to-string code)

    • strings/*.sol: String libraries (e.g. string concatenation, string comparison, etc.)

    • HttpServer.sol: Extend the HttpServer or DefaultServer contracts with a WebApp to create a Solidity HTTP server

    • WebApp.sol: Extend this contract to define routes in a custom web app

  • www/: Docusaurus docs website

Testing

Unit

Forge unit tests are located in test/ directories, colocated with source code under src/.

Run tests with forge test --match-path "src/**/*.t.sol" -vvvvv".

Integration

To test that all the Solidity contracts work together, run forge script script/HttpServer.s.sol.

This script sends some example requests to the FullExampleServer in src/example/FullExample.sol and prints the output.

End-to-End

To test that the contracts work when deployed, run anvil to start a local testnet, then grab one of the generated private keys.

Deploy the example web app server with forge create --rpc-url http://127.0.0.1:8545 --private-key $PRIVATE_KEY src/example/FullExample.sol:FullExampleServer and grab the contract address.

Then run CONTRACT_ADDRESS=$CONTRACT_ADDRESS node src/example/server.js.

A TCP server will be started at http://localhost:8000 that will forward HTTP requests to the local deployment of the contract.

The server will return the data returned by the contract over TCP as well.

More Repositories

1

install-peerdeps

πŸ’» A command-line interface to install an NPM package and its peer dependencies automatically.
JavaScript
297
star
2

angular2-todo-app

Angular 2 beta example todo app and tutorial
JavaScript
15
star
3

farolito

Guiding the way to government benefits. A project for the Out of Pocket AI Hackathon, June 2024 in San Francisco.
TypeScript
8
star
4

hexooor.natecation.xyz

β¬’ Generate hexagonal Twitter NFT profile pictures client-side using HTML5 canvas: https://hexooor.natecation.xyz
TypeScript
7
star
5

schoology

check my grades
JavaScript
6
star
6

veryloudcloud

Learning/course-management system built with Node.js/MEAN stack
HTML
5
star
7

oganesson

A parser for chemical formula strings.
JavaScript
5
star
8

evmtx

TypeScript
5
star
9

grades.natecation.xyz

πŸ“Š Website with UCLA grade distributions from 2021-2023
TypeScript
5
star
10

element-bee

Node.js/Socket.io app for realtime periodic table quizzes
JavaScript
3
star
11

proactive-refresh-frontend

Frontend for the Proactive Refresh project submitted to TreeHacks 2023.
TypeScript
3
star
12

bukkit-web-wrapper

Node.js wrapper and authentication frontend for the Bukkit Minecraft server
JavaScript
3
star
13

print-anywhere

Network printing from anywhere via IPP
JavaScript
3
star
14

vuejs-user-management

Demo user management app written with Vue.js
HTML
3
star
15

schoology-bookmarklets

Chrome Extensions blocked? Use these bookmarklets to help navigate Schoology!
CSS
3
star
16

fake-twitter

fake twitter with nodejs standard lib
JavaScript
2
star
17

enlight-ycombinator

A writeup about the Y combinator for enlight.nyc
JavaScript
2
star
18

whsclubs

Check your club credit status with React and Flux
JavaScript
2
star
19

startum.co

StartUM (University of Michigan startup accelerator) website
JavaScript
2
star
20

jq-bgslider

A simple full-page jQuery background slider. Used on http://www.saffronofphilly.com/
JavaScript
2
star
21

fbball

Scrape Facebook Messenger to see who has the most baskets
JavaScript
2
star
22

natecation.xyz

Homepage for crypto projects.
HTML
2
star
23

doges-of-wallst

Algorithmic trading with cryptocurrencies
JavaScript
2
star
24

redux-bitcoin-price

Redux Bitcoin price tracker with async/await and fetch()
JavaScript
2
star
25

extension-warn-before-closing-canvas

Chrome extension that warns you before closing Canvas
JavaScript
2
star
26

resume

Nathan Leung's resume.
HTML
1
star
27

react-mobx-sine

React/MobX experiment, approximate trig functions
JavaScript
1
star
28

aplit-gatsby-project-website

Website for the Great Gatsby project in Mrs. Perlman's 2017-18 AP Literature class
HTML
1
star
29

node-basic

Basic node boilerplate
JavaScript
1
star
30

assets

HTML
1
star
31

ghost-runner

Ghost Runner App
CSS
1
star
32

euler-method-js

nice little website for euler's method
JavaScript
1
star
33

nodectf

A CTF platform written using Node.js, Express.js, and MongoDB.
JavaScript
1
star
34

apcs-quiz

Quiz app for APCS
1
star
35

help

i have no idea
1
star
36

javapaint

java paint program
Java
1
star
37

ionic-starter

Ionic Starter
JavaScript
1
star
38

vue-gradecalculator

Grade calculator app made with Vue 2 and Vuex
Vue
1
star
39

gci-checkers

Small Javascript checkers game
JavaScript
1
star
40

blog-old.nathanhleung.com

Old blog and website
CSS
1
star
41

books

Exercises from various books
Solidity
1
star
42

nathanhleung.github.io

Sets domain for project pages
HTML
1
star
43

strava

JavaScript
1
star
44

haskell-fun

fun with haskell
Haskell
1
star
45

school-java

Files from my Java programming class
HTML
1
star
46

nathanhleung

1
star
47

thedeviants.club

website for the deviants led by a$tro$hane
HTML
1
star
48

dominos-calculator

Domino's group pizza order calculator
HTML
1
star
49

canvas-fractals

Experiments with fractals using HTML5 <canvas>
JavaScript
1
star
50

pythag-live

live pythagorean theorem calculator built w vanilla.js!
JavaScript
1
star
51

miu-system

MIU system implementation in JS from Hofstadter's GEB
JavaScript
1
star
52

fellowship

HTML
1
star