Image for post
Image for post

Proof of Existence

Birth registration on the blockchain, giving people ownership of their identities.

We love expressing our selves from what we wear, what we watch, how we talk and the people we surround our selves with.

But what if you couldn’t prove you existed?

That’s the reality for over 1.1 billion people who have no proof of their identity. They live with this burden facing social, financial and educational exclusion every day.

A single piece of paper ratifies our existence under the law, unlocking our human rights to a name, an age, a parentage, and a nationality,

but this is a piece of paper that every 4th child doesn’t receive.

A birth certificate.

A birth certificate is like a breeder document, it’s key for obtaining other documents, those documents allow you to get other documents.

The number one requested document to obtain a passport is a birth certificate.

A passport helps us in opening up a bank account, getting a driver’s license, and traveling among other opportunities.

These chains of events might restrict you later in life to vote, apply for certain jobs, travel abroad, open a bank account, receive social services or get a marriage license.

Invisible to the system, without a birth certificate children face friction when trying to register in public schooling or receiving healthcare services.

230 million children under the age of 5 are unregistered.

Places like Pakistan have registration rates of only 33% for kids under the age of 5. Other countries like Bangladesh at 20%, Chad at 12%, Somalia, Ethiopia, Zambia and Liberia at less than 4%.

The lack of data could mean these numbers are much bigger.

Every 4th child under the age of 5 is invisible…

When they’re invisible, they’re vulnerable to exploitation, human trafficking, conscription, child marriage, and labor. Their right to justice diminishes…

They can be tried as an adult in court, with no way to prove their relation to their parents, they’ll struggle to inherit assets. In the face of natural disasters or conflict search and rescue will be problematic.

This is a crucial document many loose when homeless, and fleeing from violence or natural disaster.

Not only is this hard to maintain it’s hard to obtain, it can get lost in shipping, taking weeks to months to mail, without a guarantee that it reaches the intended person. While being unaffordable for many who struggle to make a dollar a day (~1 billion people).

So is digital registration on the table?

Storing this data digitally isn’t enough what if it gets hacked, this is some of the most important data about you, it’s your identity. What if your government falls apart or is corrupt. What if someone tries to tamper with your data or identity theft?

But what if you could own your data? If your certificate was always there and backed up, you didn’t need to worry about the system getting hacked or tampered with or your country falling apart? It would be significantly more affordable and efficient possibly less than than a week to process.

These are all things a blockchain-based registration system could help with.

A permanent record the blockchain

Blockchains are decentralized ledgers that are immutable, meaning once the data is on this ledger it can’t be changed or tampered with.

Because blockchains are decentralized they need multiple nodes to be taken over for the system to be compromised, unlike the centralized civil registration systems we currently have which only need one point of failure for the entire system to become vulnerable. So your birth certificate is almost always backed up.

I decided to build a POC decentralized birth registration system. A decentralized application(Dapp) is an application with a smart contract as its backend.

A smart contract is self-executing code on the blockchain because it’s on the blockchain, the code can’t be changed once it’s deployed. Similar to contracts in the real world multiple parties agree that if an event occurs it generates an action. The contract ensures this happens, with a smart contract we have the same assurance but with code, you don’t need to trust the parties you’re dealing with, just trust the code.

The biggest platform for deploying these Dapps is Ethereum. I deployed this Dapp to the Ropsten Testnet, which follows the exact same protocols as the regular Ethereum network but was built by developers for testing out their Dapps before deploying it onto the Mainnet.

Interacting with and deploying with the smart contract cost’s gas, Ether (Ethereums cryptocurrency), but this is a tiny amount in cents. Using Ropsten Ether Faucet I got free “fake” ether to use on the test net.

The Dapp allows only government accounts to register citizens and create a digital birth certificate. Once the certificate is created the government transfers it into the person’s account, granting them full ownership of it forever.

Toolbox for building this Dapp

  • Metamask chrome extension wallet for making gas payments every time we interact with the Dapp.
  • Remix online IDE for writing, compiling and deploying Dapps in solidity(Ethereum’s programming language similar to javascript)
  • Ropsten Ether Faucet to get free fake ether.
  • Ethereum Ropsten Test Network, the network I deployed the contract to, it follows the same protocols as the main Ethereum network.
  • Web.3 connecting the smart contract to the frontend allows us to interact with the blockchain

Breaking down the smart contract

First, we define the compiler version using pragma solidity^ and instantiate our contract.

pragma solidity ^0.4.0;
contract MyPropertyContract
{

Create a person struct to hold some of the fields of our persons certificate: where they were born, their full name, their guardian’s name

struct Person 
{
address ownerAddress;
string location;
string name;
string parent;
string date;
uint landID;
}

We set the owner of the contract to whoever deployed it, in our case we’d want it to be the government. We create a counter to keep track of how many people we have registered in our contract.

address public owner;
uint public totalCounter;
function RegContract() public
{
owner = msg.sender;
totalCounter = 0;
}

We want certain functions to be available only to the government so we create a modifier called gov. We initialize two events; one for registering a person and one for transferring their certificate.

modifier gov
{
require(msg.sender == owner);
_;
}
event Register(address _owner, uint _ID);
event Transfer(address indexed _from, address indexed _to, uint _ID);

We link addresses to their person structs through a mapping called people.

mapping (address => Person[]) public people;

We create a function for registering a person(only available to the government) that takes in the details of the person as parameters and passes them as fields of the person struct. We increase the total counter and set the ID for that person at that counter.

We push the certificate to the government’s people mapping and trigger the register event.

function registerperson(string _location, string _name , string _parent, string _date) public gov
{
Person memory myPerson = Person(
{
ownerAddress: msg.sender,
location: _location,
name: _name,
parent: _parent,
date: _date,
ID: totalCounter
});
__people[msg.sender].push(myPerson);
totalCounter = totalCounter + 1;
Add(msg.sender, totalCounter);
}

A function for transferring the certificate will take its ID and the address of the new account. But before we do this we need to make sure we own the certificate by checking if it’s in our mapping.

Then we copy the property into the new person’s people mapping and delete it from the owners, then trigger the transfer event.

function transferID(address _newaccount, uint _ID) public gov returns (bool)
{
for(uint i=0; i < (__people[msg.sender].length);i++)
{
if (__people[msg.sender][i].ID == _ID)
{
Person memory myPerson = Person(
{
ownerAddress:_newaccount,
location: __ownedLands[msg.sender][i].location,
name: __ownedLands[msg.sender][i].name,
parent: __ownedLands[msg.sender][i].parent,
date: __ownedLands[msg.sender][i].date,
ID: _ID
});
__people[_newaccount].push(myPerson);
delete __people[msg.sender][i];
Transfer(msg.sender, _newaccount, _ID);
return true;
}
}

To view the details of someone’s account, we go through the struct details of the person in the index of that account.

function getPerson(address _owner, uint _index) public returns (string, string , string, string, address,uint)
{
return (__people[_owner][_index].location,
__people[_owner][_index].name,
__people[_owner][_index].parent,
__people[_owner][_index].date,
__people[_owner][_index].landID);
__people[_owner][_index].ownerAddress,
}

To know how many IDs the account has we’ll use this function

function getNoOfID(address _owner) public returns (uint)
{
return __people[_owner].length;
}
}

This Dapp doesn’t have real validity because the government isn’t actually the one registering people, but if it was used alongside the government it could revolutionize our civil registration systems which are currently broken and at risk.

But more importantly, it can help bring back prosperity to people’s lives, giving them autonomy over their identities and put every 4th invisible child back into the picture.

Hope you learned something! Feel free to reach out on LinkedIn or subscribe to my newsletter to stay connected :)

Written by

Playing around with blockchain and machine learning. 17. Trying to understand my self and the world.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store