Skip to content

Latest commit

 

History

History
135 lines (101 loc) · 8.9 KB

README.md

File metadata and controls

135 lines (101 loc) · 8.9 KB

Dog Registry DAPP using ~ Dog NFTs 🐶

Table of Contents

  1. Project Outline
  2. Benefits of using our Dapp Vs Centralized registry application
  3. How our application works
  4. Step 1: Preparation steps before testing the dapp locally
  5. Step 2: Running the application
  6. Step 3: Navigating through the app
  7. Improvements
  8. Project Challenges
  9. Summary

Project Outline

The goal of our Dog Registry Application is to increase the confidence of dog owners in the genetic history of their dogs while supporting responsible breeders, veterinarians, and sales agreements.

The American Kennel Club has maintained a registry of pure breed dogs since 1884 as a means of maintaining the integrity of breed lineages and the integrity of those involved in dog breeding. The AKC is an advocate for pure breed dog ownership, canine health, and promotion of responsible dog ownership and breeding. Currently, the AKC maintains paper and electronic breed records that are held incen tral authority. Persons who wish to breed their dogs must pay fees to register the sire, the dame, and the resulting litter of puppies. Further fees are paid for registration of health, genetics, sale, and ownership. Each certification is held separately, fees are charged to access each record. See: https://www.akc.org/register/.

Benefits of using our Dapp Vs. Centralized Registry Dog applications

The application that we have developed uses smart contracts and blockchain technology to verify and store dog registry data on a blockchain contract. Establishment of provenance and authenticity is a major application use of blockchain technology, yet to date, the technology is not widely used by pet animal enthusiasts. The few current examples of blockchain in animal breeding are associated with food production e.g. Hendrix Genetics. Blockchain technology is very suitable for authenticating and tracking provenance of both purebred and rescue pet animals.

Benefits of using a decentralized application (DAPP) compared to traditional dog registries:

  • Verify dog breed lineage easily
  • Prevent fraud activities
  • Improve transparancy
  • Realtime accounting
  • Cost reduction for registrations
  • Imutability
  • Decentralized ledger accessible to the public
  • Increased trust in record keeping
  • Programable sytstem

The registry dapp tracks a puppy from broker to new owner in a single, immortal, blockchain smart contract that is accessable to all key actors in the process. For each litter the blockchain record has relavent identities, certifications and information (Figure 1). The broker or kennel club, certifys a veterinarian, and buyer/ owner are also recorded along with the certifications given by each entity.

This blockchain application introduces a heretofore unprecedented level of transparency to dog breeding and increases the confidence of dog owners in the veracity of breeding information while supporting responsible breeders, veterinarians, and brokers.

Diagram

How our application works

This application app.py is a front end that allows you to interact with a back end smart contract deployed on an ethereum test network.

Step 1: Preparation steps before testing the dapp locally

  1. Set up Ganache for a blockchain environment
  2. Import ganache account to your metamask using the provided private keys
  3. Import DogNFT.sol and DogRegistry.sol to Remix IDE
  4. Compile and Deploy DogRegistry.sol using injected provider metamask for your environment on Remix IDE
  5. Copy the deployed smart contract address into your .env environment
  6. Add Pinata API keys to .env file.

Note Use SAMPLE.env file as a template and change the file name from SAMPLE.env to .env after adding your Pinata API key and deployed contract address.

Step 2: Running the application

Make sure you still have ganache open and running and proceed to run the app.py application.

The application requires streamlit so if you don't have it installed, use pip install streamlit to install from your Terminal and then proceed.

Use Terminal to cd into the dog-registry-blockchain-app/ directory and use streamlit to run the app.py with the following command.

streamlit run app.py

Step 3: Navigating through the app

Use the select accounts on the sidebar panel to select the account that will be executing function calls on the smart contract.

  • Step 1 : Add Broker
    • The contract deployer can assign a broker role account by calling the addBroker to add broker address and a broker Id
    • The broker role has the ability to add a veterinary doctor by calling the addVeterinaryDoctor function
    • The broker role has the ability to add a dog breeder by calling the addDogBreeder function
    • To check if an address is a broker call isBroker and provide an ethereum address
  • Step 2: Add Veterinary Doctor
    • Only addresses with a broker role can add a new veterinary doctor by calling addVeterinaryDoctor function
    • The Veterinary doctor is the only role that can add a health report for a reigstered puppy by calling addPuppyReport function
    • To check if an address is a veterinary doctor call isVeterinaryDoctor and provide an ethereum address
  • Step 3: Add Dog Breeder
    • The broker role is the only role that can add a dog breeder by calling addDogBreeder function
    • The dog breeder role has the ability to register a puppy by calling registerDog or addDog functions
    • To check if an address is a dog breeder call isDogBreeder and provide an ethereum address
  • Step 4: Register Dog
    • Only addresses with a dog breeder role can call registerDog to register a puppy.
    • To register Dog provide a dog_owner address, name, breed, dame, sire, initialAppraisalValue, litterID, litterSize, birthDate, then upload an image on the front end to generate a tokenURI and tokenJSON uploaded through pinata ipfs.
    • The registerDog is a function from Dog NFT smart contract smart contract to register a dog via an ERC721 NFT token
    • Produces an NFT for the puppy.
      • The owner recieves a non-fungible token (NFT) unique to their new dog along with access to the breeding and health records.
  • Step 5: Add Puppy Health Records
    • A veterinary doctor role can add puppy health record by calling addPuppyReport function
    • The front end provides inputs to call the contract funtion via text inputs
  • Step 6: Appraise Dog
    • Only addresses assigned a token id belonging to a puppy NFT can appraise the the puppy's value by calling Appraisal function
    • The front end provide an input for a token ID, new appraisal amount and details for the appraisal report
    • There is also a funtion ownerOf that takes in a token Id uint value to check the current owner of the NFT DOG token
  • Step 7: Get the appraisal report History
    • The front end application provides one uint input for a token ID
    • When you click the 'get appraisal report' button, we a checking for contract events from the Appraisal function
    • We are also using the token ID as a filter by adding .createFilter to get the appraisal reports for the token

When you complete all the steps you should be able to view the NFT of the DOG token like shown in the figure below.

Dog Registry Screenshot

Improvements

  • Create marketplace functionalities for our dog registry system
    • Our next feature would be to add a marketplace to conduct sales for registered puppies
    • Add functionalities to bid for NFT tokens

Project Challenges

  • Setting up smart contracts to work with our idea
    • Problems with struct having too many variables giving "Stack too deep" solidity error.
      • Cleared the error by reducing amounts of variable used
    • Implementing NFTs to our project
    • Implementing a trading capabilities to our dog NFTs
  • Getting project done within a short period of time
  • Splitting project work load with team members

Summary

  • Our final project presentation for University of Minnesota Fintect Bootcamp.
    • Here's a presentation to go along with this project
  • Collaborators