Skip to content

A smart contract with a user interface for four actors participating in collecting, signing and verifying the one time mandate needed for investing in mutual fund SIPs

Notifications You must be signed in to change notification settings

FionaCang/otm-poc-ethereum

 
 

Repository files navigation

One Time Mandate POC using Ethereum

The project consists of UI screens and a backend smart contract to sign and verify an investor's one time mandate for investing in mutual fund SIPs with his bank.
The UI screens are as follows:
(1) RIA - Registered Investment Advisor: This person collects the details of the mandate from investor via email or phone call. Only base fields are collected for the purpose of this POC
(2) Investor - Verifies the information in the one time mandate submitted by the investor. The investor signs by providing his bank account number, date of both and any other unique identifier known to him and his bank, along with his Ethereum account
(3) CAMS (Transfer Agency) - Verifies and validates new mandates recieved. After verification, sends details to the bank for processing.
(4) Investor's Bank - Receives verified CAMS mandates. Decodes the user signature recieved by forming a hash with the registered user details (in this case bank account number + date of birth + unique identifier) and calls an ecrecover solidity function to check the address of the signer of the signature. If the signer of the signature is the given investor address (sent by CAMS), then the bank approves the mandate.
Developer Note: The smart contract needs to hosted on a reliable instance or a local geth node needs to fired up.
A total of six accounts are precreated with funds. Please do replace them with 6 new funded accounts for the following persons:
CAMS/RIA - 1
Investor Accounts - 4
Bank Accounts - 1
This logic can be extended to other domains and areas where user signature needs to verified and validated by multiple parties. It obviates the need for paper signatures and time consuming processes like courier of documents.

Deployment Information and Overall Flow

  1. Navigate to C:\Users{user}\AppData\Roaming\Ethereum and delete the "testnet" directory

  2. Launch testnet

geth --testnet --fast --cache=512 --rpc --rpccorsdomain --rpcapi "*" console

  1. Create 6 new accounts using personal.newAccount(). Unlock all accounts permanently

personal.unlockAccount(eth.accounts[0],"pass",0)
personal.unlockAccount(eth.accounts[1],"pass",0)
personal.unlockAccount(eth.accounts[2],"pass",0)
personal.unlockAccount(eth.accounts[3],"pass",0)
personal.unlockAccount(eth.accounts[4],"pass",0)
personal.unlockAccount(eth.accounts[5],"pass",0)
personal.unlockAccount(eth.accounts[6],"pass",0)

  1. Start mining and generate ether on coinbase accounts

  2. After a few minutes, transfer ether to all other accounts and fund them

eth.sendTransaction({from:eth.coinbase, to:eth.accounts[1], value: web3.toWei(0.05, "ether")})
eth.sendTransaction({from:eth.coinbase, to:eth.accounts[2], value: web3.toWei(0.05, "ether")})
eth.sendTransaction({from:eth.coinbase, to:eth.accounts[3], value: web3.toWei(0.05, "ether")})
eth.sendTransaction({from:eth.coinbase, to:eth.accounts[4], value: web3.toWei(0.05, "ether")})
eth.sendTransaction({from:eth.coinbase, to:eth.accounts[5], value: web3.toWei(0.05, "ether")})
eth.sendTransaction({from:eth.coinbase, to:eth.accounts[6], value: web3.toWei(0.05, "ether")})

The accounts are allocated to the users in the following manner in the code:

0 -> CAMS
1 -> Investor 1
2 -> Investor 2
3 -> CAMS
4 -> Bank
5 -> Investor 3
6 -> Investor 4

  1. Copy the contents of OTMMandate.sol into Remix and generate web3 deploy

  2. Paste web3 deploy in js console and save the contract address

  3. Update 'accounts.js' with abi and contract address

  4. Launch and initialize contract by opening RIA.html first, so that variable 'owner' in the contract gets initialized to the CAMS address

10.Create RIA transaction by hitting submit. Wait till bottom text gets changed to 'Mined'. If errors exist check console.

  1. Navigate to investor page and check if new investor registration is visible

  2. Sign the relevant fields and hit submit to start a new transaction

  3. Open CAMS.html. Investor record should be displayed after investor signature transactions gets confirmed

  4. Hit on Verify & Send to Bank. Note Mandate ID. Wait for transaction to get mined.

  5. Open Bank.html and query the record with Mandate ID by hitting Get Record

  6. When record is displayed, fill in correct fields (as before) and click 'Verify'

  7. If 'Success' is displayed hit 'Approve Mandate' and wait for transaction to get Mined

  8. Go back to CAMS.html after transaction gets mined to verify whether bank status changed to 'true'

About

A smart contract with a user interface for four actors participating in collecting, signing and verifying the one time mandate needed for investing in mutual fund SIPs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 97.9%
  • HTML 2.1%