Sunday, October 23, 2022

AHAMEVYAHAM by Prashant A U

 


Hey guys! 

I have started a new youtube channel for all. 

Watch interesting stuff on Product Management, Artificial Intelligence, Blockchain, Cybersecurity, Machine Learning, Data Science, Digital Transformation, Operational Excellence, Life Coaching, Neuro-Linguistic Programming, Vedic Astrology, etal. Subscribe & stay tuned for more..! :-) 

Check this out: https://exceptional-motivator-8636.ck.page/ab3ac88f26 

I have created these playlists for you so that you can choose to watch videos that interest you:

ETS: Emerging Technologies

PMS: Product Management

OES: Operational Excellence

CSS: Cybersecurity

LCS: Life Coaching

VAS: Vedic Astrology

Here's a brief introduction about myself:


I have authored two books viz. TERNICODE: LAW OF THREE (genre: Leadership / Business Management) and SWARBHANU RAHASYA: ROLE OF NODES IN DESTINY (genre: Indology / Astrology). For those interested, watch these two book launch videos:



Please do watch my videos, like, comment, share and subscribe to my channel AHAMVEYHAHAM !

Stay tuned!


Thursday, October 6, 2022

KNOW YOUR ENEMY - “MANTHARA”

 (Life Coaching Series)


Who doesn’t have any enemy? We all in the course of our life journey, in our endeavor to achieve something, with all our idiosyncrasies keep encountering enemies from time to time. In fact, it can be safely assumed that one who doesn’t have any enemy has never attempted anything worthwhile in life.

Now, there can be different kinds of enemies that can be classified as below:

Enemies

Open

Hidden

Known

Need to face them at any cost

Need to be alert always

Unknown

Need to understand their moves

Need to allure them to come out of hiding

 Different levels of hurdles can be posed by each type of enemy but, the most unpredictable is the one who remains unknown and hidden. In this context, let me draw your attention to the infamous “Manthara” of the great epic Ramayana. Manthara (formerly Princess Rekha and sister of Queen Kaikeyi) is deemed by many to be the villain who was the cause for Lord Rama’s exile and Sita’s miseries.


Those who have read this epic are aware of the actions of Manthara and the sequence of events that followed. For others, let me list out the same herewith:

  1. An overambitious Princess Rekha utilizes potent potions to look attractive and fit for several years
  2. An adverse reaction of this leads to her turning into a hunchback with sagging skin making her look old and diseased
  3. Kaikeyi, her sister resorts to take up her responsibility whom she accompanies with to Ayodhya after her bethrotal to King Dasharatha
  4. Kaikeyi fights alongside Dasharatha in the battlefield and also saves his life for which Dasharatha grants her 2 boons / wishes, which she banks up for a future date
  5. Manthara has always been caring towards Kaikeyi and does it even more after this event for which she gets rebuked by all as a maidservant
  6. Upon hearing news that the King has selected Prince Rama (Kaushalya’s son) to be coronated instead of Prince Bharata (Kaikeyi’s son), Manthara is filled with rage
  7. It is Manthara who provokes Kaikeyi with the premise that her own son Bharata may be denied a good royal life if he is denied the throne
  8. It is Manthara who reminds Kaikeyi that she should demand the ascension of Bharata to the royal throne and exile of 14 years for Rama, in lieu of the 2 boons that Dasharatha owed to her

Rest of the events are history that make up the rest of Ramayana. I would like you to pause here and think about an alternative sequence of events had this occurred in the current times:

  1. What if Dasharatha had refused to honor his boons?
  2. What if Rama had refused to honor his father’s word?
  3. What if Sita had not chosen to follow Rama?
  4. What if Lakshmana had not chosen to follow and serve his brother Rama in exile?
  5. What if Bharata had chosen to accede to the throne and declare himself as the King of Ayodhya?


It would have been quite a different story, much like the “Game of Thrones” or that of despotic rulers like Aurangzeb, Herod, Peter, etc. In Ramayana, the evil plans of Manthara fell flat at Bharata’s level. Alas, now we might not see such kind of sacrifice for one another anymore. We don’t have people like Dasharatha, Rama, Sita, Lakshamana, Bharata anymore, but we do have people like Manthara amongst us.  

Hence, we need to understand the modus operandi of people like Manthara amongst us. Her villainous character has the following shades:

  1. Overambitious who would go to any extent to remain the center of attraction (using harmful concoctions for beautification)
  2. Resentful and revengeful temperament forged by a shattered and mortified ego (rebuked by all for ugly looks and actions too)
  3. Megalomaniac control freak who could mask real intentions behind a caring attitude (total control of her sister). 
Further, it would be impossible for anyone to think that someone frail and lowly like Manthara could eke out such evil plans. She cunningly utilized everything at her behest to seize power from mighty people. The following point are worth pondering:
  1. An impeccable image built over the years – complete faithfulness and loyalty towards Kaikeyi
  2. Consistent actions complementing her image – ignoring everyone’s rebuke and continuing her chores
  3. Excellent persuasion skills – how else could she turn around a happy & loving Kaikeyi against Rama, and make her ignore the fact that Dasharatha who loved her the most amongst his 4 wives would pose a danger to the royal well-being of her own son Bharata?
  4. Perfect situational awareness – a low profile maidservant (as seen by others in Ayodhya) who jumps into action at the right time (announcement of coronation of Rama) with the right tools (using Kaikeyi as a front)
  5. Racketeer mindset – coaching her sister to exact chantage via emotional blackmail of the King
  6. Skilled at partisanship & insurgency – No one knew that it is Manthara who is behind all the turmoil. The brothers Shatrughna and Bharata realize this at a later stage after the game has been played on them i.e., after Rama’s exile.

So, it is imperative that we know how to identify the Mantharas in our lives and stop the dominoes effect like Bharata who refused to accept the throne at any cost and waited till the return of his brother Shri Rama. It is easier said than done. Everyone doesn’t get to have the luxury of bonding like the Raghuvamsha brothers. Therefore, if you are faced with a situation like that of Lord Rama, you need to act swift in order to avoid an exile-like situation.

Here are the 3 pivots using which you can determine the genuineness and gravity of any situation:


  •        Trust: There can be no transaction without some amount of trust. It is trust that moves the wheels of time.
  •        Tolerance: No transaction can be smooth without some amount of tolerance. It is tolerance that can get things done.
  •        Time:  Time is the measuring scale that helps us to monitor the movement and smoothness of transactions.

Manthara can win as long as even one of these three elements are on her side. Thus, one needs to ensure that one’s unknown hidden enemies are bereft of trust, time or tolerance at all times. 

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.

Books By Dr. Prashant A U

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