Python V 2 years ago

Simple Login And Registration In Blockchain

Create user authentication in blockchain using solidity and remix ide

// SPDX-License-Identifier: GPL-3.0


pragma solidity 0.8.8;


contract AuthSystem{

    struct Users{

        string username;

        uint256 password;

    }


    Users[] public AllUsers;


    function CreateAccount(string memory _username, uint256 _password) public{

        AllUsers.push(Users(_username, _password));

    }


    function Login(string memory _username, uint256 _password) public view returns(string memory){

        for (uint256 i = 0; i < AllUsers.length; i++){

            if(keccak256(abi.encodePacked(AllUsers[i].username)) == keccak256(abi.encodePacked(_username))){

                if(AllUsers[i].password == _password){

                    return 'Logged in';

                }else{

                    return 'User found but Incorrect Password';

                }

            }

        }


        return 'User Not Found';

    }

}


I take lessons on various blockchain courses reach out to me @ nablintech@gmail.com

5
223
Landing page

Landing page

defaultuser.png
David
2 years ago
clipping mask and layer mask

clipping mask and layer mask

defaultuser.png
Ogbonnaya Joseph
2 years ago
Login-signup-form.

Login-signup-form.

defaultuser.png
Olatoye Busuyi
2 years ago
Day 2 assignment

Day 2 assignment

defaultuser.png
juicymols@gmail.com
2 years ago
Carting-website

Carting-website

1663343264.jpg
Salami abiola
2 years ago