Skip to content

shanmukhipriya99/ECDSA-NODE

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ECDSA Node

This project is an example of using a client and server to facilitate transfers between different addresses. Since there is just a single server on the back-end handling transfers, this is clearly very centralized. We won't worry about distributed consensus for this project.

However, something that we would like to incoporate is Public Key Cryptography. By using Elliptic Curve Digital Signatures we can make it so the server only allows transfers that have been signed for by the person who owns the associated account.

Video instructions

For an overview of this project as well as getting started instructions, check out the following video:

https://www.loom.com/share/0d3c74890b8e44a5918c4cacb3f646c4

Client

The client folder contains a react app using vite. To get started, follow these steps:

  1. Open up a terminal in the /client folder
  2. Run npm install to install all the depedencies
  3. Run npm run dev to start the application
  4. Now you should be able to visit the app at http://127.0.0.1:5173/
  5. Note: To access the APIs running on localhost, go to client/src/server.js and replace the baseURL with http://localhost:3042.

Server

The server folder contains a node.js server using express. To run the server, follow these steps:

  1. Open a terminal within the /server folder
  2. Run npm install to install all the depedencies
  3. Run node index to start the server

The application should connect to the default server port (3042) automatically!

Hint - Use nodemon instead of node to automatically restart the server on any changes.

What have I done?

I have made the application request access to connect to you metamask wallet. Once you connect your wallet to the application, your address gets auto-populated in the Wallet Address input field of the Wallet component. Then you can click on the Add Account button and this address's balance will get initiated to 100. You can now transfer this balance to any account after signing the transaction.

Behind the Scenes

Once you click the Transfer button, MetaMask requests your signature. This signature is then sent to the server where the public key of this address is derived using the ethereum-cryptography library and the signature is verified using the verify() function. If the signature is valid, then the balances of the sender and recipient are updated.

The live application is available at: https://au-ecdsa-node-dapp.onrender.com/

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published