GithubHelp home page GithubHelp logo

document-registry-rust's Introduction

DOCUMENT-REGISTRY-RUST

This is a icp canister application that helps users verify documents that have been issued by an organization.

The application uses the encryption method sha256 and to produce a distinct key that is identifiable to that single issued document.

Canister Parameters

  • Users have the ability to add documents to the contract and they can also delete the documents they added.
  • Other users can verify if a document already exists on the registry.

Use Cases

  1. This Dapp can be used by document issuing organizations, like schools, business, e.t.c.
  2. It can be used to ensure validity of a perticular document, and help reduce the effect of forgery in the professional world.

UPDATE Due to feedback

I added the following features due to feedbacks from the dacade platform

  1. A ICRC1-Ledger to enable the doc registry canister accept payments of dummy tokens.
  • when users try to add a document they pay a fee

  • when users try to verify a document they pay half the fee.

    To set up this ledger follow the next instructions

    • Start by creating the following identities on your dfx instance, these identities make the creation of the ledger seamless. For more information about the identities check the ICRC1 tutorial

      # The minter identity
      dfx identity new minter
      
      # The archive controller
      dfx identity new archive_controller
    • Then proceed to deploy the ICRC1 Ledger, a script has been supplied for that. This sets up the ledger.

      npm run deploy-ledger
    • Now you can run the faucet script which mints new tokens to the doc reg canister. <amount> is a placeholder for any amount of tokens in e8s you want to mint

      # npm run faucet <amount>
      npm run faucet 100_000_000_000
  1. An init function which takes the text format of the admin principal (where the fee will be sent to) and the fee to be paid. This init function is called as we deploy the doc registry. A helper script has been provided for that.

    # npm run deploy-docreg <fee>
    npm run deploy-docreg 10_000

    <fee> is the place holder for the fee you want users to pay to add documents. Also recall that users pay half this fee to verify any document.

More Information

To learn more before you start working with docregistry, see the following documentation available online:

Running the project locally

To test project locally, use the following commands:

# Starts the replica, running in the background
dfx start --background --clean

# deploy the icp ledger
npm run deploy-ledger 

# deploy the doc reg canister
# npm run deploy-docreg <fee>
npm run deploy-docreg 10_000

# run the faucet
# npm run faucet <amount>
npm run faucet 100_000_000_000

Once the job completes, your application will be available at

http://localhost:4943?canisterId={candid_ui_id}&id={canister_id}

Testing the application

  1. First thing to do is to generate the hash of the document you wish to upload. Run any of the following commands on your terminal and copy the document hash.
  # For Linux users
  # sha256sum <path to document>
  sha256sum ./examples/AttendanceCertificate.pdf

  # For window users using powershell
  # Get-FileHash <path to document> -Algorithm SHA256 | Select-Object Hash
  Get-FileHash ./examples/CertificateOfAdoption.pdf -Algorithm SHA256 | Select-Object Hash

  # For Mac OS users
  # shasum -a 256 <path to document>
  shasum -a 256 ./examples/DegreeCertificate.pdf
  1. Next go to the candid UI link generated and test out the application.

  2. Trying adding documents and use the get_admin_balance function to check if the admin balance is truly increased.

document-registry-rust's People

Contributors

tamara-ebi-pere-victor avatar

Watchers

 avatar

Forkers

ujayata eatahine

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.