Skip to content

transmute-industries/ride-share-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ride Share Demo

A demo dapp with transmute, react, express, ipfs, postgres and testrpc.

An Insomnia workspace is included to make testing the api easy.

Be sure to disable Metamask before running this demo

Getting Started With Docker

git clone https://github.com/transmute-industries/ride-share-demo.git
cd ride-share-demo
docker-compose up --build

Summary

Inside of ./dapp, sample data is generated and events are simulated via a command line tool (yarn reset).

On http://localhost:3000, a react app reads from ethereum and ipfs to reconstruct the data generated by the command line tool, using the transmute framework.

On http://localhost:3001/demo, an express postgres api reads from ethereum and ipfs to reconstruct the data generated by the command line tool, using the transmute framework.

This demo shows how a node command line tool, react web app and express postgres api can use the transmute framework to read and interact with smart contracts on ethereum and store data on ipfs.

What are Read Models?

Read Models are event sourced objects which represent a smart contract's state, and are built from its history.

By using Read Models, its easy to integrate smart contracts with existing databases and APIs.

The Transmute Framework provides a javascript api for smart contract read models that is easy to extend and runs in the browser and node.js, see ./dapp/lib/common for some methods using the transmute framework.

Possible Extensions

  • use express, postgres and transmute framework to create an api which persists data to ipfs and ethereum.
  • use express and postgres to store read models generated on command line or in web app for relational querying.
  • use transmute framework to provide an integrity log for postgres on IPFS and ethereum.

Without Docker

Install Global Node Dependencies

yarn global add truffle@beta ethereumjs-testrpc

Start Dependencies in Terminal

ipfs daemon
testrpc

Generate and Start Demo

cd ./dapp
yarn install
yarn reset
yarn start

IPFS is sometimes not fast enough with updates... if you see this:

/node_modules/transmute-framework/lib/TransmuteIpfs/TransmuteIpfs.js:165
stream.on("data", function (chunk) {

restart the demo... we will add retries to resolve this in the future... sorry :(

Built With

  • Transmute Framework
  • Solidity Smart Contracts
  • Truffle
  • Insomnia
  • Docker
  • Postgres
  • Express
  • IPFS
  • TestRPC

Future Work