Thursday, September 15, 2022

Decentralized College Tracker Using Solidity

(Blockchain Series)

I'm presenting here an academic project on blockchain technology. In the DLT (Distributed Ledger Technology) arena, there are several players and platforms but the most popular ones right now are Ethereum (maybe because of THE MERGE or ETH 2.0) and Bitcoin (being the grandpa of blockchain based cryptocurrency and papa of several sidechains and Multichain). 

Here, you can learn about deploying a Smart Contract written in Solidity for a specific use case over RSK Testnet - a BTC sidechain that supports EVM.

The tools required are:

  • Remix IDE
  • Solidity Programming Language
  • Metamask Wallet
  • Injected Web3 Provider (Ganache with Ropsten Testnet, RSK Testnet, etc.)
  • Compatible browser (Chrome, Brave, etc.)
Here's quick video on the same:



Agenda

It is becoming difficult to track down illegal colleges. Many students' careers are spoiled as they enroll in them. A solution is needed that can ensure transparency and integrity of the admission process. 

Background

In many parts of India, illegal colleges are run, which are not affiliated to any university. Many students enroll in these colleges without knowing that and in turn they end up having no jobs or colleges get shut down after some time, which ruins their career.

Business Logic

If the database of colleges is created over a decentralized blockchain then it would ensure that only authorized / verified colleges are able to admit students. This can be achieved by deploying a smart contract over a public blockchain. 

The above items are added as input variables for two structs named “College” & “Student”. 

Smart Contract Features


Project Reference Outputs



Actual screenshots are added in further sections. 

Smart Contract Main Functions

Function Name

Description

Input

Response

addNewCollege ()

Only university admin can add new college

cName, cAddress, cAdmin, cRegNo

Integer success response

viewCollegeDetails ()

Anyone can view college details

cAddress

Displays cName, cRegNo

blockCollegeToAddNewStudents ()

Only university admin can block colleges from adding new students

cAddress

Integer success response

unblockCollegeToAddNewStudents ()

Only university admin can unblock colleges from adding new students

cAddress

Integer success response

addNewStudentToCollege ()

Only approved college admin can add new student to college

sName, sPhone, sAddress

Integer success response

getNumberOfStudentsForCollege ()

Anyone can view total number of students in any college

cAddress

Displays totalNoOfStudents

viewStudentDetails ()

Anyone can view student details

sName

Displays sName, sPhone, courseEnrolled

changeStudentCourse ()

Only approved college admin can change student course enrollment

sName, courseEnrolled, newCourse

Integer success response

Note: All inputs are string except cAddress which is the unique ETH address of each college and cAdmin too is the unique ETH address of the University Admin.

Source Code

// SPDX-License-Identifier: MIT

// compiler version must be greater than or equal to 0.8.10 and less than 0.9.0

 

pragma solidity ^0.8.13;

 

contract DecentralizedCollegeTracker {

   

address universityAdmin;

uint256 public totalNoOfColleges;

uint256 public totalNoOfStudents;

 

constructor() public {

   universityAdmin = msg.sender;

}

modifier onlyAdmin() {

   require(msg.sender == universityAdmin);

   _;}

   

struct College {

   string cName;  

   address cAddress;

   address cAdmin;

   string cRegNo;

   bool isAllowedToAddStudents;

   uint totalNoOfStudents;

}

 

struct Student {

   string sName;  

   uint sPhone;

   string courseEnrolled;

}

 

mapping (address => College) colleges; //  Mapping a college's address to college

mapping (string => Student) students; //  Mapping a student's name to student

 

function addNewCollege(string memory collegeName, address add, address cAdmin, string memory regNo) public onlyAdmin {

   require(!areBothStringSame(colleges[add].cName,collegeName), "College already exists with same name");

   colleges[add]= College(collegeName,add,cAdmin,regNo,true,0);

   totalNoOfColleges++;

}

     

function viewCollegeDetails(address add) public view returns (string memory, string memory, uint) {

   return (colleges[add].cName,colleges[add].cRegNo, colleges[add].totalNoOfStudents);

}

 

function blockCollegeToAddNewStudents(address add) public onlyAdmin {

   require(colleges[add].isAllowedToAddStudents, "College is already blocked to add new students");

   colleges[add].isAllowedToAddStudents=false;

}

 

function unblockCollegeToAddNewStudents(address add) public onlyAdmin {

   require(!colleges[add].isAllowedToAddStudents, "College is already unblocked to add new students");

   colleges[add].isAllowedToAddStudents=true;

}

   

function addNewStudentToCollege(address add,string memory sName, uint sPhone, string memory courseName ) public {

   require(colleges[add].isAllowedToAddStudents, "This College is blocked to add new students");

   require(colleges[add].cAdmin == msg.sender, "Only College admin can add the new student");

   students[sName] = Student(sName,sPhone,courseName);

   colleges[add].totalNoOfStudents += 1;

   totalNoOfStudents++;

    }

   

function getNumberOfStudentsForCollege(address add) public view returns(uint){

   return (colleges[add].totalNoOfStudents);

    }

     

function viewStudentDetails(string memory sName) public view returns (string memory, uint, string memory) {

   return (students[sName].sName,students[sName].sPhone, students[sName].courseEnrolled);

}

     

function changeStudentCourse(address add, string memory sName, string memory newCourse) public {

   require(!areBothStringSame(students[sName].courseEnrolled,newCourse), "Student already enrolled to same course");

   require(colleges[add].cAdmin == msg.sender, "Only College admin can change the student course");

   students[sName].courseEnrolled=newCourse;

}

 

function areBothStringSame(string memory a, string memory b) private pure returns (bool) {

   if(bytes(a).length != bytes(b).length) {

   return false;

   } else {

   return keccak256(bytes(a)) == keccak256(bytes(b));

   }

   }

 

}

Application Binary Interface

[

            {

                        "inputs": [

                                    {

                                                "internalType": "string",

                                                "name": "collegeName",

                                                "type": "string"

                                    },

                                    {

                                                "internalType": "address",

                                                "name": "add",

                                                "type": "address"

                                    },

                                    {

                                                "internalType": "address",

                                                "name": "cAdmin",

                                                "type": "address"

                                    },

                                    {

                                                "internalType": "string",

                                                "name": "regNo",

                                                "type": "string"

                                    }

                        ],

                        "name": "addNewCollege",

                        "outputs": [],

                        "stateMutability": "nonpayable",

                        "type": "function"

            },

            {

                        "inputs": [

                                    {

                                                "internalType": "address",

                                                "name": "add",

                                                "type": "address"

                                    },

                                    {

                                                "internalType": "string",

                                                "name": "sName",

                                                "type": "string"

                                    },

                                    {

                                                "internalType": "uint256",

                                                "name": "sPhone",

                                                "type": "uint256"

                                    },

                                    {

                                                "internalType": "string",

                                                "name": "courseName",

                                                "type": "string"

                                    }

                        ],

                        "name": "addNewStudentToCollege",

                        "outputs": [],

                        "stateMutability": "nonpayable",

                        "type": "function"

            },

            {

                        "inputs": [

                                    {

                                                "internalType": "address",

                                                "name": "add",

                                                "type": "address"

                                    }

                        ],

                        "name": "blockCollegeToAddNewStudents",

                        "outputs": [],

                        "stateMutability": "nonpayable",

                        "type": "function"

            },

            {

                        "inputs": [

                                    {

                                                "internalType": "address",

                                                "name": "add",

                                                "type": "address"

                                    },

                                    {

                                                "internalType": "string",

                                                "name": "sName",

                                                "type": "string"

                                    },

                                    {

                                                "internalType": "string",

                                                "name": "newCourse",

                                                "type": "string"

                                    }

                        ],

                        "name": "changeStudentCourse",

                        "outputs": [],

                        "stateMutability": "nonpayable",

                        "type": "function"

            },

            {

                        "inputs": [

                                    {

                                                "internalType": "address",

                                                "name": "add",

                                                "type": "address"

                                    }

                        ],

                        "name": "unblockCollegeToAddNewStudents",

                        "outputs": [],

                        "stateMutability": "nonpayable",

                        "type": "function"

            },

            {

                        "inputs": [],

                        "stateMutability": "nonpayable",

                        "type": "constructor"

            },

            {

                        "inputs": [

                                    {

                                                "internalType": "address",

                                                "name": "add",

                                                "type": "address"

                                    }

                        ],

                        "name": "getNumberOfStudentsForCollege",

                        "outputs": [

                                    {

                                                "internalType": "uint256",

                                                "name": "",

                                                "type": "uint256"

                                    }

                        ],

                        "stateMutability": "view",

                        "type": "function"

            },

            {

                        "inputs": [],

                        "name": "totalNoOfColleges",

                        "outputs": [

                                    {

                                                "internalType": "uint256",

                                                "name": "",

                                                "type": "uint256"

                                    }

                        ],

                        "stateMutability": "view",

                        "type": "function"

            },

            {

                        "inputs": [],

                        "name": "totalNoOfStudents",

                        "outputs": [

                                    {

                                                "internalType": "uint256",

                                                "name": "",

                                                "type": "uint256"

                                    }

                        ],

                        "stateMutability": "view",

                        "type": "function"

            },

            {

                        "inputs": [

                                    {

                                                "internalType": "address",

                                                "name": "add",

                                                "type": "address"

                                    }

                        ],

                        "name": "viewCollegeDetails",

                        "outputs": [

                                    {

                                                "internalType": "string",

                                                "name": "",

                                                "type": "string"

                                    },

                                    {

                                                "internalType": "string",

                                                "name": "",

                                                "type": "string"

                                    },

                                    {

                                                "internalType": "uint256",

                                                "name": "",

                                                "type": "uint256"

                                    }

                        ],

                        "stateMutability": "view",

                        "type": "function"

            },

            {

                        "inputs": [

                                    {

                                                "internalType": "string",

                                                "name": "sName",

                                                "type": "string"

                                    }

                        ],

                        "name": "viewStudentDetails",

                        "outputs": [

                                    {

                                                "internalType": "string",

                                                "name": "",

                                                "type": "string"

                                    },

                                    {

                                                "internalType": "uint256",

                                                "name": "",

                                                "type": "uint256"

                                    },

                                    {

                                                "internalType": "string",

                                                "name": "",

                                                "type": "string"

                                    }

                        ],

                        "stateMutability": "view",

                        "type": "function"

            }

]

This can be copied directly from the ABI button in the REMIX IDE window

Screenshots

Before Deployment


After Deployment

After Transactions


Transaction Evidence 

  • SC Deployment Addresses =>           
    • From: 0x63FD4b19801e31e5c4020D7f8e7298530E2586AE
    • To: 0x0000000000000000000000000000000001000008
  • Genesis Block => 
    • 0x87b39d18522397f40fe98143eacbe6888ec3cc3dd5747ec2514aad131b8c50f7
  • Transaction Hashes =>  
    • 0x87b39d18522397f40fe98143eacbe6888ec3cc3dd5747ec2514aad131b8c50f  
    • 0x5f662d57165051dd4ceaba8c54c377fd5311a07f16d98f6de22b3be554941fbb
    • 0x6b706f5b110b5965204486aa20d3cf5fc8a57fdb0e9ae82063b4e780562598e4
    • 0xb0e46d0a779ce162a885ca6f02dc501fa873713298e6b4198f2574c0a320b771
    • 0xf816854af5f5beeb6f2fc607820bd69bd4908805db20b6be3b656c8059d9d469
    • 0x8135849b0432dc2a5e6afa7d63abf3aa21cef218aa1ff047ecfd27b553a73c28
    • 0xc713d6aba41af2000537e8d84af936a8540deea43c42427151b215f9c38746f1
    • 0x8135849b0432dc2a5e6afa7d63abf3aa21cef218aa1ff047ecfd27b553a73c28

Conclusion

The smart contract when deployed on a large scale will enable transparency and integrity in the process of education. Further, several more features can be added into this SC like upvoting of colleges, transfer of students from one college to another, etc. Here, only the basic features have been added to demonstrate the business logic that is required as a solution. There are also ways to develop a frontend to access the SC features e.g. React.js. Those interested can even build a dAPP / DAO around this idea. 

A summary of the project is given below:

  • Smart Contract = DCTPAU.sol
  • Functions = 09 nos.
  • Lines of Code = 86
  • SC Deployment cost = 0.00003441 tRBTC
  • Total Transaction cost = 0.0000084 tRBTC
  • Cumulative Cost = 0.00004281 tRBTC
Note: The SC was deployed on RSK Testnet (Bitcoin Sidechain) where the cryptocurrency is RBTC / tRBTC.

Tuesday, September 13, 2022

SHADOW OF THE BLACKGHOST

(EFFECT OF BLACKLISTING AND GHOSTING ON YOUR CAREER AND LIFE) - Life Coaching Series


He’s a published author, a doctoral scholar, a mentor, a business consultant and much more. He has worked with fortune 500 companies with his career spanning across 2 decades and 4 continents. He has also won a few professional & business awards and has led a quite successful life from the POV of a common man.

But strange as it may seem, he’s grounded since the last 2 years and unable to find any meaningful employment. He’s not outdated or redundant since he has upskilled himself in the recent years, has an ATS compliant CV and an excellent LI profile. Furthermore, he has a good network of former colleagues and clients who he can always contact and quote for any reference check. He’s bemused and dismayed at his present predicament. He has been applying to several relevant and matching positions online at many popular jobsites since that has become the norm in the post-covid era. There have been several occasions when he has encountered the following patterns explained further.


Note: The above process flow is from the POV of the jobseeker and does not depict the hiring process.

At different stages of the hiring process, he has experienced something called as “GHOSTING”. A brief snapshot of the scenarios is listed below as shown in the above diagram:

  • a.       No further communication after receiving an initial shortlist email from the recruiter
  • b.       Recruiter does not respond to phone calls or emails after the initial screening call
  • c.       There is no interview / meeting link received after it has been scheduled OR recruiter gives a “NO SHOW” for the pre-scheduled interview
  • d.       Recruiter does not update the status or communicates further process after the interview
  • e.       Recruiter literally acts like a ghost and becomes uncontactable OR passes the buck asking you to contact someone else in the organization who has no idea about your status of application
  • f.        Recruiter ditches you at the last minute and conveys a rejection (usually without justifying any reason) after finalizing terms of the offer

When these similar scenarios keep repeating over and over again, he gets into action. Being an adept and seasoned professional, he reviews his digital presence by doing a basic OSINT exercise on his own online accounts. Here’s the summary of what he finds initially:

  • 1.     LinkedIn profile has a social score of 90 and all his data is verified
  • 2.     Resume has an ATS score of 84 and all the information is true to the best of his knowledge
  • 3.     Other social network profiles do not have any offensive, violent, abusive, sexual, or objectionable content
  • 4.     All his online accounts are secure with 2-step verification enabled
  • 5.     SEO ranking of his name and associated identities is also good
  • 6.     He doesn’t have any unknown contacts / unverified accounts connected to his social network

So, he wonders that he is probably amid a “Mid-Life Crisis” and eventually things will change for the better. But there are questions that keep haunting him night and day –

i.      How will I explain this gap in my career? Sundry projects / freelancing / part-time work / volunteering are not going to add up to anything worthwhile!

ii.    Why am I going through such a rough phase? Never been removed or laid-off from any job, never had behaviour or character questioned, never lied or misrepresented facts, never hidden anything relevant, never been into any type of criminal activities or misconduct, never been into any type of political activism or never committed any type of fraud, then why?

There are many such cases of innocent individuals whose career and life has been affected by a term called as “BLACKLISTING”. It is the blackhole of the HR domain that very much exists but is denied by everyone in the industry. I’m not referring to a plain simple case of blacklisting of prospective candidates by individual recruiters for genuine or not-so genuine reasons. That is done by every other company on the planet over their internal database. What I’m referring to is the maintaining of a very large database of persons and other entities that is subscribed to by several large corporates including background screening and verification companies. Such databases are often stored secretively and shared with select few members within the HR domain in the corporate world. Prima facie, there shouldn’t be any problem in doing so since organizations need to keep a tab on who enters their organization as it is all about brand management and goodwill. The problem lies in the legitimacy and integrity of the data that is often scoured from several sources including third party operators, contractors, and sub-contractors. The moot question is – How reliable are those players and who owns the accountability for maintaining such a database? Let me clarify that I’m not referring to data protection laws or right to privacy legislation here at all.  Please note that this is something maintained privately and is not a government database like “Early Warning System” (EWS) of the UK or “Global Internet Forum To Counter Terrorism” (GIFCT, maintained by internet & social media giants) of the US that is referred to by government agencies or SITA Goods & Passenger Tracking System (S-GPTS, aviation industry) accessed by most airport authorities worldwide.

A few names that I’m aware of are First Advantages Esteem, Lexis Nexis, Skynet, World Check Database, Refinitiv World Check Risk Intelligence, Facebook Secret Blacklist, etc. There are big corporations that maintain some of this type of database like Thomson Reuters, Stratfor, Pinkerton Global Intelligence, etc. Once your name / identity gets inserted into it, a tag / label is attached which can classify you as a “Heightened Risk Individual” or “Dangerous Person” or similar category for no mistake of yours. The database need not mention anything to justify the tag or could also contain falsified information. This is sufficient to deny any opportunity in the corporate world and even bring you under the radar of various government and / or private agencies. Further, forget about correction, there is little you can do to even request access to such data as an individual.     

This type of approach can lead to a tragic “comedy of errors” (compiled from real-life incidents from various sources) as shown below:

Name (changed to protect identity)

Blacklist Tag

Actual incident(s)

Mohammed Imran

Narcotic

Bought tranquilizers to manage anxiety / stress without a doctor’s prescription from a local pharmacy

Chruen Cassidy

Terrorist

Profusely sweating at an airport due to stress and physical exhaustion

Disha Saxena

Lazy & Quarrelsome

Altercation with local community members on the issue of hygiene and cleanliness

T. Bala

Politically Exposed Person

Tweeting in support of his home government over a national issue while working overseas

Navneet Singh

Social misfit

Unable to communicate effectively in English in spite being a good software developer

Alex Mayor

Fraudster

Defaulter for personal credit card payment of a miniscule amount

Akash Jain

Anarchist

Online search for terms like “crude bomb”, “anarchy”, etc. to gather general information in order to write a fiction novel

One can easily see from the above table that such data can be unverified, biased, outdated, or irrelevant. How names of simple & unsuspecting individuals make it to such kind of databases will be largely unknown, unless thoroughly investigated. 

Is it just a complex algorithm or a mean person behind it will remain a mystery until the shadow of the “BLACKGHOST” is exorcized!

So, if you meet with ghosting repeatedly, you can be sure that your name has been blacklisted. You need to prep-up your act and perform your own due diligence before it destroys your peace of mind.

Contact the author to know more about identity management, online reputation management and OSINT.

References:

https://mikesouth.com/free-speech/the-internet-blacklist-database-72337/

https://www.refinitiv.com/en/products/world-check-kyc-screening

https://www.mirror.co.uk/money/revealed-secret-international-blacklist-can-7332879

https://www.theguardian.com/uk/2009/mar/16/blacklisted-workers-hotline

https://insights.dice.com/2019/03/12/exploring-secret-practices-tech-recruiters/

https://forums.studentdoctor.net/threads/pharmacist-blacklisted-on-global-database-esteem.1370449/

https://www.bindmans.com/insight/blog/world-check-database-due-diligence-or-blacklist

https://www.zdnet.com/article/inside-the-global-terrorism-blacklist-secretly-shadowing-millions-of-suspects/

https://www.zdnet.com/article/skynet-nsa-terrorist-terminator/ 


Thursday, May 12, 2022

CONSUMERISM KILLS...EVENTUALLY!

(Life Coaching Series)

Last week, I was doing some quick errands to buy some pending grocery and sweets to cross my home-shopping checklist. I just happened to be on my toes for hours with constant updates over my mobile which included targeted ads across various apps and services that I regularly use. Let me tell you that I prefer walking out to buy my grocery rather than order it online, even in the post-covid era. Throughout my shopping spree, I was bombarded with “relevant” ads, some of which are listed below along with my take on them:    

 


For starters, water is made potable by several methods that include filtration, distillation, reverse osmosis, ultraviolet radiation, etc. Each of these processes along with cleaning the water depletes the mineral content in it. Consumption of such water form bonds with the minerals inside our body and is passed out through urine and sweat; thereby depleting our mineral intake. Firstly, they deplete the minerals from water to make it potable and then they add minerals to make it healthy. I would rather drink directly from a natural and clean pond than falling for this gimmick.


In the last decade, it has become the norm in our nation to gift chocolates on auspicious occasions and festivals. Thanks to this excellent ad that has carefully and consciously manipulated our thought process. We are a nation that celebrates at least three festivals per month (refer any Hindu Panchang i.e. Ephemeris) where each festival has an associated culinary diet that is most suited to the season and region. For example, “thandai” (natural home-made cold drink that cools the body) at Holi (around March / April) which is the onset of summer or “tilgud” (natural home-made sweet rich in oil content) at Makar Sankranti (around mid of January) during autumn. Why do we need to replace such a rich and healthy tradition with fermented and preservative infused food?


As far as I know, cold-pressed oil (still available in rural India) poses the least risk to our health since it is free of man-made chemicals and good cholesterol is preserved. In the modern refinery, filtration of oil takes place in the presence of CMR (Carcinogenic-Mutagenic-Reprotoxic) substances. No matter, what the brands might claim the end product is certainly a risky proposition. Any given day, I would bet on unrefined / unfiltered cold-pressed oil to keep my heart beating normally.  


With the advent of shopping malls and supermarkets, we have unwittingly started consuming processed vegetables instead of fresh vegetables. Most of us are unaware that the preservatives, artificial colors and artificial flavoring used for processed food often contain CMR substances and are never listed on the label. Is it just our ignorance or is it our fast-paced lifestyle that makes us too lazy to work with fresh vegetables?

Each of these ads are an example of brilliant consumerism and are probably used as case studies at B-schools. But the moot point is – where do we draw the line? This kind of consumerism is like a slow poison that kills both the consumer and the society in a gradual manner.

I’m neither a nutritionist or a medical doctor; but as a systems / process auditor I have had the opportunity to audit entire food chains across India & Africa. What I am presenting here is out of direct experience from years of observation, both as an auditor and a consumer. Just like you, I’m a consumer first and an auditor later. So, it does concern me when I find that I’m unaware of what goes inside my body willingly.

Remember that each time you eat, you are either fighting disease or feeding it!

Follow this simple formula to stay fit – OPPRESS:


Oil – Reduce your intake of oil and fried food

Processed – Avoid anything that is labelled as “processed” since it is mostly less natural than you think

Packaged – Avoid anything that is labelled as “packaged” since it is mostly less natural than you think

Refined – Avoid anything that is labelled as “refined” since it is mostly less natural than you think

Excess – Avoid any type of overindulgence including food for thought viz. digital exposure  

Sugar – Reduce the intake of sugar and sugar-based foods

Salt – Reduce consumption of salt and salt-based foods

This way you can OPPRESS any disease with ease and stay fit for a longer period. And, don’t take my advice with a pinch of salt – Just try it out and you will feel the difference!

Books By Dr. Prashant A U

  🔐 "ManusCrypt: Designed for Mankind" by Prashant A Upadhyaya 🔐 🚀 Revolutionizing Information Security for the Human Era! 🚀 ...