Secure Credit Reporting on the Blockchain :: Proof-of-Concept Implementation
We have implemented all aspects of our approach as explained in the paper. Our implementation is in Solidity, which is the most widely-used language for developing Ethereum smart contracts.
- code.zip: The implementation (each component of our approach is put into a different .sol file)
- paper.pdf: The main paper
There is a wide variety in the compilers and tools available for deploying and interacting with Solidity smart contracts on the Ethereum network. We provide a short guide using Metamask and Remix, Ethereum Foundation’s official IDE for Solidity. We show how one can deploy our smart contracts on a so-called “testnet”, i.e. an Ethereum network with full functionality meant for testing decentralized applications where one can get free money and the units are otherwise worthless. We will use the Ropsten testnet.
Please follow these steps:
- Install the Metamask extension on your browser. (https://metamask.io/)
Metamask allows you to interact with Ethereum networks seamlessly.
- Accept its licence agreement and create a password. Metamask will provide you with a series of words that you can use to recover the password if you forget it.
- Switch to the “Ropsten Test Network” from the top-left corner of the Metamask extension window.
- In order to perform function calls in an Ethereum network, one needs to pay for their execution (pay for “gas”). In Ropsten, you can get free cryptocurrency units to pay for testing smart contracts. To get free testnet money units, go to https://faucet.metamask.io/ and request 1 ether. It takes a few (at most ~35) seconds for the transaction to go through. When it does, your balance will be updated in Metamask:
- Now that we have ether at our disposal, we can deploy our contracts. Go to remix.ethereum.org and input the code of one or several of the contracts provided at the beginning of this page. Then compile the code.
- Go to the “Run” tab and choose “Injected Web3” as the environment.
- In order to deploy a contract, choose it and click “create”.
- Creating a contract is considered a transaction and you have to pay for its gas. That is why a message from Metamask pops up. Click the “submit” button to accept this transaction. As usual, it takes a few seconds for it to go through and enter the blockchain.
- When the contract enters the Blockchain, it appears in the bottom-right pane and you can interact with it by calling its functions.
For example, this is a public_record_factory contract and one can call its create_public_record function to create a public_record contract. After clicking it and authorizing the transaction, the address of the resulting public_record contract can be found in the log.
- You can add new contracts to the right pane, using their addresses. For example, to interact with our new public_record contract, we first choose “public_record” from the dropdown list, then paste the address obtained from the log and click the “At Address” button.
We can now interact with this new contract in the same manner:
The functionalities of our contracts are explained in the paper.