Skip to content

govt. can update or input citizen details and other organisation can check it with blockchain

License

Notifications You must be signed in to change notification settings

ovijitM/kyc-verification-with-blockchain

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

MIT License

Copyright (c) 2023 ovijit Karmakar

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

struct nid{
        bytes32 name;
        uint id;
        address add;
    }
contract KYC{

    mapping(address=>nid) internal details;
    mapping(uint=>bool) internal usedIds;
    mapping(address=>bool) internal usedAddresses;

    function setdts(string memory _name,uint _id, address _add) public {
        require(!usedIds[_id], "This ID has already been used");
        require(!usedAddresses[_add], "This address has already been used");
        details[_add]=nid(sha256(abi.encodePacked(_name)),_id,_add);
        usedIds[_id] = true;
        usedAddresses[_add] = true;
    }
    function checkczdts(address _address) public view returns(nid memory){
        return details[_address];
    }

    // function checkname(address _add) public virtual view returns(string memory){
    //     return details[_add].name;
    // }
    
}

contract verification{

    KYC KYCcontract;

    constructor(address _contract) {
        KYCcontract=KYC(_contract);
    }

  function submitdts(string memory _name, uint _id, address _add) public  view returns (bool) {
    nid memory storedDetails = KYCcontract.checkczdts(_add);
    bytes32 nameHash = sha256(abi.encodePacked(_name));
    if (storedDetails.id == _id && storedDetails.name == nameHash) {
        return true;
    }
    return false;
  }
}

About

govt. can update or input citizen details and other organisation can check it with blockchain

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published