Mick00 / carfax-on-blockchain

Typescript version of Scaffold-Eth 🏗
MIT License
0 stars 0 forks source link

Cars On Blockchain

Getting started

  1. Start by cloning the repo to your PC
  2. Generate the API to interact with the contracts with yarn package
  3. Follow the instructions for the front end you want to use

Protocol Frontend

To start the server, you can simply run yarn start:frontend

Registrar Frontend

You will need to have an IPFS node to store your files. You can use IPFS Desktop for that, make sure to run it in administrator mode.

Setting up the DB with docker

you need to have docker and docker compose https://docs.docker.com/compose/install/

  1. go in the root project and simply type this command: docker-compose up
  2. you can now see your db in docker and is on the localhost:3306

Working with prisma

  1. you need to modify the schema.prisma file under the prisma folder
  2. for the first migration you need to call this command in the root folder : npx prisma migrate dev --name init
  3. Then for the other migrations command : npx prisma migrate dev --name added_job_title
    Detailed documentation: https://www.prisma.io/docs/concepts/components/prisma-migrate

to make a introspection db -> prisma schema

  1. make the change in the mysql db and then update the schema
  2. with this command : npx prisma introspect --force
    Detailed documentation: https://www.prisma.io/docs/concepts/components/introspection

    Prisma client (used to make queries using objects )

  3. install it :npm install @prisma/client
  4. using the client to make queries using objects
    ex: querying a frequency record
    1. import the @prisma/client by adding the line : const { PrismaClient } = require("@prisma/client")
    2. make a object frequency by calling the PrismaClient() constructor : const prisma = new PrismaClient()
    3. make the query in this query we are asking for the first record (the fonction needs to be async) : const frequency1 = await frequency.findFirst()
    4. we can now access the frequency object like this : frequency1.days

Launching the server

run the command yarn start:registrar

🏗 This project uses Scaffold-Eth Typescript

Typescript

This is the typescript repo of scaffold-eth and it uses hardhat and vite. The directories that you'll use are:

packages/vite-app-ts/
packages/hardhat-ts/

Quick Start

Running the app

  1. install your dependencies

    yarn install
  2. start a hardhat node

    yarn chain
  3. run the app, open a new command prompt

    # build hardhat & external contracts types
    yarn contracts:build 
    # deploy your hardhat contracts
    yarn deploy
    # start the app
    yarn start 
  4. other commands

    # rebuild all contracts, incase of inconsistent state
    yarn contracts:rebuild
    # run hardhat commands for the workspace, or see all tasks
    yarn hardhat 'xxx'
    # run subgraph commands for the workspace
    yarn subgraph 'xxx'

Overview

Everything you need to build on Ethereum! 🚀 Quickly experiment with Solidity using a frontend that adapts to your smart contract:

image





Guides

Documentation

🏃💨 Speedrun Ethereum

Register as a builder here and start on some of the challenges and build a portfolio.

🏁 Make sure to click on the typescript tab!





More Information!

📚 Documentation

Documentation, tutorials, challenges, and many more resources, visit: docs.scaffoldeth.io

Eth-hooks documentation is here. Learn how to use the contexts here.

🔭 Learning Solidity

Read the docs: https://docs.soliditylang.org

Go through each topic from solidity by example editing YourContract.sol in 🏗 scaffold-eth

🛠 Buidl

Check out all the active branches, open issues, and join/fund the 🏰 BuidlGuidl!

Follow the full Ethereum Speed Run

💬 Support Chat

Join the telegram support chat 💬 to ask questions and find others building with 🏗 scaffold-eth!

🙏🏽 Support us!

Please check out our Gitcoin grant too!

🔐 P.S.About keys

You need an RPC and API keys for testnets and production deployments, create an Alchemy account and replace the value of ALCHEMY_KEY = xxx in packages/vite-app-ts/.env with your new keys.