An Ethereum based Blockchain solution for kyc process.
Installation of geth : https://geth.ethereum.org/docs/install-and-build/installing-geth
Setting up private network using geth:
- geth --datadir ./datadir init ./genesis.json (In the KYC-Blockchain directory)
- geth --datadir ./datadir --networkid 9986944 --rpc --allow-insecure-unlock console
- personal.newAccount('password')
- personal.newAccount('password')
- personal.newAccount('password')
- personal.unlockAccount(‘Address of 1st Account’, ‘password of the account’, 0)
- miner.start()
Installation of truffle : https://www.trufflesuite.com/docs/truffle/getting-started/installation
Setting up truffle framework to interact with geth network:
- truffle init
- truffle compile
- truffle migrate --network development
- truffle console --network development
- let kyc = await KYC.deployed()
- KYC.sol - Contract contains code for admin functionalities and inherits BankInterface.sol
- BankInterface.sol - Contract contains code for bank,customer and kyc functionalities.
Important:
- There should be min of 3 banks to ensure 1/3rd quorum in the network.
- Static sized array kycRequest[5] = Assuming that the user might not have more than 5 accounts ( to avoid consuming more gas ) Array of Value: Eg : ['0x5B38Da6a701c568545dCfcB03FcB875f56beddC4','0xAb8483F64d9C6d1EcF9b849Ae677dD3315835cb2','0x4B20993Bc481177ec7E8f571ceCaE8A9e22C02db']
- To upvote = Customer is checked in request list and not customer list
- To downvote = Customer is checked in customer list and not request list
- constructor():
- In BankInterface.sol sets the following: _isAllowed = false; totalBanks = 0; refresh = false;
- In Kyc.sol sets : first account that initiates the transaction as super admin.
- The first address that initiates a transaction will become the super admin.
- Only super admin can add other bank as admins ( Assuming that in a network there will be multiple admins based on the requirement) , hence added this feature.
- addAdmins() - To add admins.
- addBank() - To add banks to the network.
- getBankDetails() - Function used get banks unique address.
- addRequest() - To add customers kyc request ( name and data )
- upVote() - Functionality that depicts a bank validates the data and upvote stating the customer data is valid.
- downVote() - Functionality that depicts a bank validates the data and downvote stating the customer data is invalid.
- addCustomer() - To add customer to global customer list post authenticity of the customer is met.
- getCustomerStatus() - Used to get customer kyc status , This works only when user is added to global customer list.
- viewCustomer() - Get the data of the customer added to global customer list
- modifyCustomer() - Function used when when customer wants to update this data.
- removeCustomer() - Function used to remove a customer from global customer list and also from request list if present.
- reportBank() - Function used by other banks to report against bank incase of malicious activities found.
- getBankReport() - Function used to get number of banks that have reported against it.
- modifyBank() - Only Admin user can perform this activity to set kycPermission of bank to false incase the bank is reported as malicious by 1/3rd of the network
- removeBank() - Function used only by admin to remove bank if the number of reports against is greater than 1/3rd nodes in the network
- Double spending problems are taken care like:
- Adding already existing bank as admin.
- Ensuring that a bank cannot vote twice for the same customers data.