Ask about this video. Answers come from its transcript only — with the timestamp, so you can check them.
Generated from the transcript and can be wrong — check the timestamp.
Full Transcript — Download SRT & Markdown
Speaker A
All of you, welcome back to yet another video.
Speaker A
In this video, we'll talk about the decentralized voting app project.
Speaker A
Which we have built on the channel, that why this project is so important.
Speaker A
And I'll also talk about some of the minor changes you have to do in the code base to execute.
Speaker A
Because recently Infura have made the changes in their terms and policy.
Speaker A
So you no longer will use the Infura for deploying the images to the IPFS.
Speaker A
So I have an alternative which I'm going to do the setup in this video.
Speaker A
I believe that you guys have followed this entire project, it's a four hours long.
Speaker A
This will teach you every single thing about the smart contract.
Speaker A
And how we have built the complex logic for having the voting system.
Speaker A
So let me talk about the changes I have done.
Speaker A
So right now you can see I have these two folders.
Speaker A
This one is the code base which we have coded together in this entire project.
Speaker A
So this is what we have coded together.
Speaker A
And in this I have done the minor changes in the upload function.
Speaker A
So let's talk about the complete code which we have coded together.
Speaker A
So if you see here, this is the entire smart contract we have written together in the project.
Speaker A
It's pretty huge.
Speaker A
It has close to 244 lines of code.
Speaker A
That's what we have here.
Speaker A
And the changes I have done in only two functions.
Speaker A
I haven't done any changes in the contract, but I did changes in the upload function.
Speaker A
So if I come back here in the context inside this voter, here you will find that.
Speaker A
That earlier we were using this global endpoint of Infura for deploying our images to the IPFS.
Speaker A
But when the Infura made the changes in the terms and policy for the very first time.
Speaker A
So we no longer able to use this one.
Speaker A
But in the second policy change they have introduced that if you want to use it, we have to do the configuration like this.
Speaker A
And we have to provide our valid gate card details, then you can easily able to generate the private key.
Speaker A
And the secret key and with this configuration you can simply follow.
Speaker A
And I also made a video on this where I have explained that how you can do that.
Speaker A
But this is also not working anymore.
Speaker A
Because Infura for the time being is not working in IPFS.
Speaker A
So the changes we have to do in our function in only two places.
Speaker A
So here you can see that this is what we have coded together.
Speaker A
You don't need to do anything in here.
Speaker A
So let me close it one by one.
Speaker A
So this is the check if wallet connect function, don't need to do anything in here.
Speaker A
Here we have connect wallet function.
Speaker A
Close that one.
Speaker A
And here we have to do the changes.
Speaker A
So we have to do the changes here in the upload to IPFS.
Speaker A
Because here we are using Infura.
Speaker A
So this is the change we got to do it.
Speaker A
And we have to do the changes here as well for the candidate registration.
Speaker A
And this is fine.
Speaker A
Let's close this one.
Speaker A
And this one is they get all.
Speaker A
Close this one.
Speaker A
And here we have the voter details, don't need to do anything in here.
Speaker A
And here we have this again.
Speaker A
So we have to do the changes here in this as well.
Speaker A
Set candidate.
Speaker A
And we have this.
Speaker A
The new candidate.
Speaker A
So we have to do four changes in our function.
Speaker A
Which I have already done in this updated one which I will show you.
Speaker A
So now let's come back to the updated one.
Speaker A
And let me tell you the few things which you have to know.
Speaker A
So if I come back to the package JSON file, I'm using these packages.
Speaker A
Make sure you have to use the exact version, no matter when you are building this project.
Speaker A
You have to use the exact version.
Speaker A
And it will work fine.
Speaker A
If you go with any other version, it will not work because every single version has its specific setups.
Speaker A
Which we have to do.
Speaker A
Here I'm using Hardhat.
Speaker A
I'll show you the both way that how you can use this particular application with Hardhat and without Hardhat.
Speaker A
Because recently there is a few changes have taken place in the Hardhat package.
Speaker A
And in Node as well.
Speaker A
So if I open my terminal and if I show you the Node version.
Speaker A
Like this is the version I'm using currently.
Speaker A
And this particular version is absolutely compatible with Hardhat.
Speaker A
So whether you are using the upgraded one of Hardhat or you are going with this one.
Speaker A
Because Hardhat also got couple of updates and this package has also got updated.
Speaker A
So it will work fine as long as you're working with this particular Node version or below this.
Speaker A
But if you are working with the latest one like 20, if I come back to the Node.
Speaker A
And if you're using this 20, then Hardhat will not work.
Speaker A
Okay, don't need to be panic.
Speaker A
I will show you both the way that how you can execute this smart contract and how you can run this application.
Speaker A
Without Hardhat and with Hardhat.
Speaker A
So just wait.
Speaker A
I'll show you that.
Speaker A
The very first thing I want to show you that how you can execute this code with Hardhat.
Speaker A
So make sure you have to install the exact version if you are making any changes.
Speaker A
First execute and then you do all the modification.
Speaker A
So I have this particular.
Speaker A
Now the very first thing I have to do is I have to get into this particular folder.
Speaker A
And this is the exact step you have to follow when you will download the source code or if you want to do the modification.
Speaker A
Okay, this is the exact thing you have to do.
Speaker A
So first you have to get into this folder.
Speaker A
So I'll say updated code and I'm into this particular directory.
Speaker A
And now I have to install these packages.
Speaker A
So I'll type NPM and I or install.
Speaker A
Both will work fine.
Speaker A
And hit enter.
Speaker A
This will take few seconds to install all the packages.
Speaker A
So just wait.
Speaker A
And finally I have installed all the packages successfully.
Speaker A
If you have encountered any error, try to install the packages one by one.
Speaker A
So this is looks pretty fine.
Speaker A
Now I'm going to simply clear the terminal.
Speaker A
And now let me show you the changes I have done before I execute this particular code.
Speaker A
So if I come back to the context, if I go to the voter.
Speaker A
And I'm using Pinata for deploying the images.
Speaker A
So this is the variables we have, this is the check if wallet connected.
Speaker A
I haven't done any changes, don't need to do anything.
Speaker A
This is the same function we have.
Speaker A
And here I have made the changes.
Speaker A
So instead of Infura, I'm using Pinata.
Speaker A
So this is the exact function all I have done, made the changes in this particular function.
Speaker A
So in this particular function we are using to deploy the image.
Speaker A
Again, I have covered this extensively in the project.
Speaker A
So make sure to follow that.
Speaker A
So I'm taking the image, then I'm converting into a form data.
Speaker A
And this is the endpoint for deploying any image to Pinata IPFS.
Speaker A
So this one is only for image.
Speaker A
If you want to deploy folder, if you want to deploy JSON data, it has a different endpoint which I will talk about.
Speaker A
So this is the exact configuration you have to do.
Speaker A
Method this, URL endpoint.
Speaker A
This is the data.
Speaker A
And here we have this header.
Speaker A
And you have to get your like API key and the API secret key, which is absolutely free to get from Pinata.
Speaker A
And I have made tons of video.
Speaker A
So make sure to check that how you can get this particular key and how you can get this particular secret key.
Speaker A
I'll link in the I button on the description.
Speaker A
So you can follow that video.
Speaker A
So simply paste here.
Speaker A
Or if you download the source final source code in that I will provide you this, so you can simply go with this my keyword.
Speaker A
So what we are doing, we are simply uploading the image.
Speaker A
Then we are getting the hash.
Speaker A
And that's what we are returning here.
Speaker A
So this is the changes I have done here in the upload to IPFS.
Speaker A
This is the exact function name we have given in the old code base.
Speaker A
And this is what I have done here.
Speaker A
So this is the one change you have to do.
Speaker A
Now here we have to do the same thing in the candidate upload.
Speaker A
And this is exactly the same thing I have done, I have provided my Pinata configuration and the credential.
Speaker A
And we are uploading the image to Pinata.
Speaker A
So this is for the image.
Speaker A
Pinata file to IPFS.
Speaker A
So this endpoint is for image.
Speaker A
Now we'll talk about the JSON data.
Speaker A
Because in the project we have used like Infura IPFS for uploading the JSON as well.
Speaker A
That will also I will cover.
Speaker A
So these are the two changes, make sure to do that in both the function.
Speaker A
And here we have this create voter.
Speaker A
So those who will vote, they can create their profile.
Speaker A
And we have to upload their information as well.
Speaker A
Now here you can see that here we are uploading the JSON data.
Speaker A
So this is absolutely fine.
Speaker A
We are getting checking the condition that whether the data is available or not.
Speaker A
Again, I'm telling you that I have extensively covered this in the project.
Speaker A
So make sure to follow the complete project.
Speaker A
You will understand everything.
Speaker A
This is the Web3 model configuration for making the connection with our contract.
Speaker A
And the our wallet.
Speaker A
We are converting the entire data into the JSON file.
Speaker A
And that's what we are passing into our IPFS.
Speaker A
So this is the endpoint for the JSON data.
Speaker A
You can see pin JSON to Pinata IPFS.
Speaker A
So this is the endpoint we are using to uploading the JSON data.
Speaker A
And same thing we have provided the header configuration like the API key and the secret key.
Speaker A
And then we are returning the URL and that's what we are passing into our smart contract.
Speaker A
Into the contract.
Speaker A
So this is the exact thing you have to do if you want to upload the JSON file.
Speaker A
And that's what we have done here.
Speaker A
Again, make sure to pause it.
Speaker A
I'm just simply scrolling slowly, slowly.
Speaker A
So you can simply type it down.
Speaker A
So this is the one change you have to do.
Speaker A
And the same change we have to do here in the candidate as well.
Speaker A
Because this one is for the voter.
Speaker A
And this one is get all voter.
Speaker A
So we don't need to do any changes here.
Speaker A
Close that one.
Speaker A
And now come back here, give voter.
Speaker A
Don't need to do any changes here.
Speaker A
And here we have to do the changes.
Speaker A
So candidate set candidate.
Speaker A
In that we are taking the data.
Speaker A
Then we are making the connection with the wallet.
Speaker A
Converting the data into a JSON format.
Speaker A
And then we are simply uploading the data to the IPFS.
Speaker A
And this is the endpoint we are calling.
Speaker A
At the end, it's going to return the entire URL which contain all of this information.
Speaker A
And that's what we are passing into our contract.
Speaker A
Got it?
Speaker A
I believe that you guys have understood that what logic we have implemented.
Speaker A
It's a pretty simple change.
Speaker A
All you have to do to simply provide the API key and the secret key.
Speaker A
And if you get the final source code in that I will provide you this my key.
Speaker A
It's pretty easy to get your own one, simply go to the Pinata.
Speaker A
Or you can watch this video in that I have explained extensively.
Speaker A
So these are the four changes you have to do in four of these functions.
Speaker A
Hope things are fine to all of you guys.
Speaker A
And now let me show you how you can execute that.
Speaker A
So first you have to get into this folder.
Speaker A
And let's come back here.
Speaker A
We are already into this particular folder.
Speaker A
And now we have to simply start the application.
Speaker A
So this is the command we have to run, again you have to install the exact version, no matter when you are watching this project.
Speaker A
So simply type.
Speaker A
So we have already installed that, now we have to simply type this one.
Speaker A
Type NPM run dev.
Speaker A
And this will start the application on localhost 3000.
Speaker A
You can simply copy.
Speaker A
And you can simply paste in your browser.
Speaker A
So come back to the browser.
Speaker A
Make sure to check your Node version.
Speaker A
Come here, paste.
Speaker A
And you can simply see.
Speaker A
Our application is working fine.
Speaker A
Right now we don't have any data because we have not connected with the application.
Speaker A
Now all we have to do is simply click on this connect wallet.
Speaker A
It's going to open this Metamask.
Speaker A
Provide your, provide your credential.
Speaker A
So I'll say.
Speaker A
And here I'm connected.
Speaker A
But the one thing you will notice that we haven't deployed the contract.
Speaker A
So there is nothing in here.
Speaker A
So I'll come back to my code base because I have to show you the both method.
Speaker A
First Hardhat, then second the test network.
Speaker A
The Mumbai test network.
Speaker A
So what I will do, I'll simply going to stop the application.
Speaker A
Now you have to split your terminal in two parts.
Speaker A
And make sure you are into the same directory.
Speaker A
Now we have to start our local blockchain.
Speaker A
So come back to the Hardhat config file.
Speaker A
And here you can see that we are interacting with our local host.
Speaker A
So let's run the local node into our system.
Speaker A
So this is the command you have to write, very simple.
Speaker A
NPX Hardhat node.
Speaker A
And hit enter.
Speaker A
It will start the application, you can see it will start your local blockchain.
Speaker A
And it will give you 20 plus account.
Speaker A
And you can utilize this account to test your contract, to make the transaction.
Speaker A
Because each one of this account has close to 10,000 fake ether.
Speaker A
Which you can use to test your.
Speaker A
And if you want to import any one of these account, all you have to do is to simply get this private key.
Speaker A
Copy this private key.
Speaker A
Come back here.
Speaker A
Click here in your Metamask.
Speaker A
Switch back to the local host.
Speaker A
So this is the local host.
Speaker A
Click here.
Speaker A
And I have already done the configuration for the local host.
Speaker A
And I have already imported a lot of accounts.
Speaker A
You can see all of these accounts.
Speaker A
I have imported because I was working on the social media platform.
Speaker A
And I have imported that.
Speaker A
So you can see all of these accounts.
Speaker A
So all you have to do is to simply click here and click on this add account.
Speaker A
And paste here.
Speaker A
Click on this import.
Speaker A
And here I have imported.
Speaker A
And it has zero, nothing in here.
Speaker A
This is how you can import.
Speaker A
Now let me show you one thing that what are the configuration you have to do.
Speaker A
If you want to import local host.
Speaker A
So come back here.
Speaker A
I'll say click on this add network.
Speaker A
And you will redirect to the different page.
Speaker A
So click here in the network.
Speaker A
And this is my configuration for the local host.
Speaker A
So this is the name.
Speaker A
This is the RPC endpoint.
Speaker A
This is the chain ID.
Speaker A
This is the currency.
Speaker A
And I have saved it.
Speaker A
So make sure you have to provide the exact value if you want to connect with the local host.
Speaker A
So that's the exact setup you have to do.
Speaker A
Right now you can see this is throwing an error because we have not deployed our contract.
Speaker A
And it's trying to fetch out the information from the contract, that's why it's throwing the error.
Speaker A
So our application is also shut.
Speaker A
Now I'm going to simply come back here.
Speaker A
And our local blockchain is running.
Speaker A
And by default Hardhat will take this very first account for deploying all your contract.
Speaker A
All your contract.
Speaker A
This is the account Hardhat will take by default.
Speaker A
Now we have to simply execute and run our deploy script.
Speaker A
So here we have this deploy script.
Speaker A
And this is what we have to run.
Speaker A
It's going to simply deploy our contract.
Speaker A
So if I show you what is the name I have given to my contract.
Speaker A
I call it create.
Speaker A
You can call it whatever you want.
Speaker A
So that's what we are deploying.
Speaker A
And at the end it's going to return the address of our, of our contract.
Speaker A
So I'll say here it says that.
Speaker A
Let's change this text to address.
Speaker A
Like voting.
Speaker A
That's what I'm going to do is.
Speaker A
And now let's deploy that one.
Speaker A
And this is the exact command you have to type, make sure you have to keep running this one.
Speaker A
Otherwise the application will not work.
Speaker A
And the, the contract will not deploy.
Speaker A
So this is the exact command you have to type, NPX Hardhat run network localhost, then script deploy.
Speaker A
Because our deploy script inside this particular folder.
Speaker A
And that's what we are targeting.
Speaker A
And all you have to do is to simply click and hit enter.
Speaker A
This one is going to compile your contract.
Speaker A
And here it's you can see it's taking a little bit time.
Speaker A
But soon it will give us the contract.
Speaker A
And here we got this particular contract address.
Speaker A
This is the address.
Speaker A
And by default, when you will deploy your very first contract, Hardhat will give you the exact address in your case as well.
Speaker A
So simply copy that one.
Speaker A
And you can see I have this particular artifact.
Speaker A
In that I have the ABI of the contract.
Speaker A
So if you want to remove it, you can remove because when you will deploy the contract, it will automatically Hardhat will automatically will create this particular artifact.
Speaker A
Which you can simply take it.
Speaker A
The ABI.
Speaker A
And you can simply drag and drop here.
Speaker A
Because we already have it here because I haven't done any changes in the contract.
Speaker A
But make sure whenever you do any changes in the contract.
Speaker A
It will generate a different ABI and that's the ABI you have to provide.
Speaker A
And that's what you will find here in the artifact.
Speaker A
So click on the artifact.
Speaker A
Come back to the contract and here you will have the ABI.
Speaker A
Simply drag and drop.
Speaker A
Okay, simply drag and drop.
Speaker A
I'll call it replace.
Speaker A
You can see it's replaced.
Speaker A
So you have the ABI.
Speaker A
Now everything is set.
Speaker A
Now we can start our application.
Speaker A
So I'll simply type NPM run dev.
Speaker A
And this one is going to start the application on localhost 3000.
Speaker A
The same port.
Speaker A
Now we can come back here and reload the page.
Speaker A
And here we have this application up and running.
Speaker A
Right now we don't have any issue.
Speaker A
If I show you the terminal.
Speaker A
Let me close this one.
Speaker A
If I go to the console, I don't have any issue.
Speaker A
Because everything is working fine.
Speaker A
Now what I'm going to do is, first and the foremost thing I have to do.
Speaker A
Before I create account or register any voter, I have to clear my Metamask history.
Speaker A
So first I have to switch back to my account.
Speaker A
So I'm going to use this particular account.
Speaker A
The let's click on this switch to my account.
Speaker A
And you can see by default Hardhat will take the very first account and that's the account I have imported as a account two.
Speaker A
So I got some fund deducted from this account for deployment.
Speaker A
Now what I have to do is, very first thing before I do anything.
Speaker A
I have to clear my history.
Speaker A
If I don't do that, the transaction will fail.
Speaker A
And this is the weird problem we have in the local host and in Metamask.
Speaker A
So whenever you do any changes in the account, you have to clear your Metamask history.
Speaker A
Otherwise the transaction will fail.
Speaker A
So click on this.
Speaker A
And clear.
Speaker A
Once you're done with that, now you are ready to work on this.
Speaker A
Here you can see here we have the dropdown menu.
Speaker A
So let's register a candidate.
Speaker A
So click on that.
Speaker A
And here we have this option.
Speaker A
So here we have that.
Speaker A
Now what I'm going to do is, I'm going to upload a user.
Speaker A
So I'm going to simply click here.
Speaker A
It's going to open my pop-up model.
Speaker A
I'm going to select an image.
Speaker A
So I'm going to nominate myself.
Speaker A
And here it's going to deploy the image.
Speaker A
So just wait, the image will soon reflect here.
Speaker A
And finally the image is successfully deployed.
Speaker A
And you can also check in your terminal.
Speaker A
Here we got this.
Speaker A
You can simply copy that one.
Speaker A
You can paste into a new tab.
Speaker A
And you can have a look.
Speaker A
So it's successfully deployed.
Speaker A
This is the image we have deployed.
Speaker A
It's working fine.
Speaker A
No issue we have so far.
Speaker A
Here you have to provide the name of the candidate.
Speaker A
Again, I have explained every single thing in the project.
Speaker A
So make sure to watch this.
Speaker A
Follow this entire four hour long project, you will learn tons of things.
Speaker A
All the terminology.
Speaker A
I have explained deeply.
Speaker A
Now I'll give my name.
Speaker A
I'll say Daulat.
Speaker A
Okay, let me pick here.
Speaker A
I'll say Daulat Hussain.
Speaker A
Now I have to give the address.
Speaker A
So I can take my own address.
Speaker A
I can click here.
Speaker A
Copy.
Speaker A
I can paste here.
Speaker A
And I can simply call the age.
Speaker A
Let's call it one years old.
Speaker A
Quite funny.
Speaker A
Now I'm going to click on this authorize candidate.
Speaker A
So click on this.
Speaker A
It's going to open my Metamask.
Speaker A
And I will make the transaction.
Speaker A
So just wait, here it's come.
Speaker A
Finally the Metamask popped up, click on this confirm.
Speaker A
And the transaction is confirmed.
Speaker A
And here you can see we got one candidate registered.
Speaker A
If you reload the page, the candidate will reflect here.
Speaker A
There is one candidate.
Speaker A
It's working fine.
Speaker A
We have one candidate.
Speaker A
In the same way you can register as many candidate as you want.
Speaker A
So it will also display that how many candidates are listed.
Speaker A
The previous candidate.
Speaker A
So this will happen only in development, not in production.
Speaker A
So you can same, you can click here.
Speaker A
You can come back here.
Speaker A
You can register one more user.
Speaker A
And it's going to simply update.
Speaker A
So just wait.
Speaker A
Here it got it.
Speaker A
Now I can simply give the name.
Speaker A
I can call it Md Shahir.
Speaker A
I have to give the address.
Speaker A
So I can simply come back here.
Speaker A
And I'm going to pick an account.
Speaker A
So this time I'm going to take this particular first account.
Speaker A
This gentleman.
Speaker A
Now I'll to get back to my.
Speaker A
No, get back to my second account.
Speaker A
And I have to clear my history.
Speaker A
Otherwise the transaction will fail.
Speaker A
Okay.
Speaker A
Now.
Speaker A
Got it.
Speaker A
Okay.
Speaker A
I have to redeploy the image.
Speaker A
Not a not a big deal.
Speaker A
So just a moment.
Speaker A
Here we got it.
Speaker A
Now I can give the name.
Speaker A
I'll say Md Shahir.
Speaker A
I'll give the address.
Speaker A
I'll give the age is going to be five.
Speaker A
And click on authorize candidate.
Speaker A
It's going to open the Metamask.
Speaker A
And we'll have this user.
Speaker A
We'll get this two user.
Speaker A
Everything is working fine.
Speaker A
Now we have registered two candidates, now let's register the voter.
Speaker A
So I'll click here.
Speaker A
And I'm going to register as a voter.
Speaker A
So what I will do is, I can simply come here.
Speaker A
I have to take a account.
Speaker A
So this this particular account I'm going to use, account three.
Speaker A
So copy this one and I'm going to register this user as a voter.
Speaker A
So go back here.
Speaker A
And I'm simply come back here.
Speaker A
I'll clear my history.
Speaker A
Again because I have done the change of account.
Speaker A
So that's the thing I have done.
Speaker A
I got the address.
Speaker A
Now I can simply click here.
Speaker A
You can see.
Speaker A
Okay, there is there.
Speaker A
I have the detail.
Speaker A
Now click here.
Speaker A
Now I have to get the user.
Speaker A
So this time I'm going to get this gentleman.
Speaker A
So let's select my image as well.
Speaker A
There is no problem in that.
Speaker A
So we got that.
Speaker A
Just wait, here we got that.
Speaker A
So this is the voter registration.
Speaker A
And I can call it voter.
Speaker A
Let's give the address.
Speaker A
And I'll say one voter.
Speaker A
You can call it position whatever you want.
Speaker A
Let's call this authorize voter.
Speaker A
And it's going to open the Metamask.
Speaker A
And it will make the transaction.
Speaker A
So finally we have registered.
Speaker A
If you reload the page, if you reload the page, it will work fine.
Speaker A
So we have one voter, two candidate for voting.
Speaker A
Now let me give vote to one of these candidates.
Speaker A
So this account three has the right.
Speaker A
Because this is the address we have assigned.
Speaker A
So only he can give the vote.
Speaker A
So let me switch my account.
Speaker A
And clear all the history.
Speaker A
Right there.
Speaker A
Now I can give the vote.
Speaker A
There it is.
Speaker A
Now I can simply click on Daulat Hussain.
Speaker A
I click on this give vote.
Speaker A
It's going to open the Metamask.
Speaker A
And again click on this confirm.
Speaker A
And it's going to make the transaction.
Speaker A
Just wait, here the transaction is happening.
Speaker A
It's taking a little bit time, but soon the transaction will complete.
Speaker A
And you will see it will work absolutely fine.
Speaker A
And finally the transaction is completed.
Speaker A
And you can see I have given one vote to this particular user.
Speaker A
So it's working absolutely fine.
Speaker A
That whom you have given your vote.
Speaker A
And if you come back to the voter.
Speaker A
And here you can see you have given the vote.
Speaker A
So every single thing is working fine.
Speaker A
You can see that.
Speaker A
It's looks absolutely incredible.
Speaker A
We don't have any issue in our application.
Speaker A
So this is what you have to do in the project.
Speaker A
Only changes you have to do in the project in this four functions.
Speaker A
The this one, set candidate.
Speaker A
And we have this create voter.
Speaker A
Upload to IPFS candidate.
Speaker A
And upload to IPFS.
Speaker A
Make sure to do all of this update which I explained you.
Speaker A
And it will work fine.
Speaker A
So this is the first method if you want to use Hardhat for building this project.
Speaker A
But for those of you who don't want to use Hardhat and you want to use on the project only on the smart contract.
Speaker A
Then I will show you the other way.
Speaker A
So let's talk about the other way that how you can simply overcome this Hardhat.
Speaker A
So the first thing I would suggest you to make sure to follow this project.
Speaker A
In that I have used Hardhat, but if you don't want to use Hardhat, you can do simply one thing.
Speaker A
In the project, create this particular folder.
Speaker A
In that create this particular file.
Speaker A
And write the entire smart contract as I have explained in the project.
Speaker A
But don't install this particular libraries, these two libraries.
Speaker A
Simply remove these two libraries because if you don't want to use it Hardhat, then why should you install that?
Speaker A
So that's the unnecessary installation you have to do.
Speaker A
And remove this script folder.
Speaker A
Remove this test file.
Speaker A
Because these are the unnecessary.
Speaker A
Remove this Hardhat like config file as well.
Speaker A
And that will work fine.
Speaker A
So make sure to do all of this.
Speaker A
And now let's deploy the contract to the test network.
Speaker A
So simply copy this entire piece of code.
Speaker A
Now come back to the Remix ID.
Speaker A
Because that's what we're going to use it.
Speaker A
So simply come back here.
Speaker A
Open a new tab.
Speaker A
And let's click on this Remix ID.
Speaker A
I hope you guys know what is Remix ID.
Speaker A
And this is where you can land.
Speaker A
And you can simply create a directory.
Speaker A
I can see I have in my default workspace.
Speaker A
I'm going to create a folder.
Speaker A
So file, sorry.
Speaker A
I click on this contract.
Speaker A
Let's create a file.
Speaker A
I can call it, let's say voting.sol.
Speaker A
And I'm going to simply paste the entire contract.
Speaker A
Simply okay.
Speaker A
And here we have the entire contract, I'm using this particular version.
Speaker A
Here we have done the import.
Speaker A
There is no issue because this particular ID is compatible with this all import of the packages.
Speaker A
Now we have to deploy to the Polygon Mumbai.
Speaker A
So what I'm going to do.
Speaker A
I'm going to simply change my account.
Speaker A
So I'm going to simply close this one.
Speaker A
I will click here.
Speaker A
And I can come back to the Mumbai.
Speaker A
I hope you already know what is Mumbai.
Speaker A
I'll come back to my account number six.
Speaker A
Because in that I have fund.
Speaker A
You can see I'm having this much fund in my Mumbai.
Speaker A
So same thing I have to do.
Speaker A
I have to simply clear my Metamask history.
Speaker A
Again because I have done the change of account.
Speaker A
So that's the first step I have to do.
Speaker A
Now I have to get from free Meti.
Speaker A
In your case, I already have this much Meti.
Speaker A
I can use it for deployment.
Speaker A
But in your case if you don't have.
Speaker A
You have to get it, then you can deploy.
Speaker A
So come back here, type Alchemy faucet.
Speaker A
And you will land on this particular website.
Speaker A
Click on the very first link.
Speaker A
And here you will have, you can pick any network.
Speaker A
Right now we have 40 plus blockchain.
Speaker A
You can pick any network for deploying.
Speaker A
So I'll go with this Mumbai.
Speaker A
Click here.
Speaker A
It's going to open up this.
Speaker A
And all you have to do is simply, simply get the address of your wallet.
Speaker A
Copy this one.
Speaker A
And simply paste here.
Speaker A
And make a request.
Speaker A
And it says that you can't allow to take before 24 hours.
Speaker A
Because in the morning I have already imported.
Speaker A
And that's why you can see I have this much fund.
Speaker A
So you have to wait for the next 24 hours to make a request.
Speaker A
So this is how you can get it.
Speaker A
So once you make a request, it will show you a confirmation page.
Speaker A
And you have to wait for 30 seconds to one minute.
Speaker A
And the balance will reflect here.
Speaker A
So make sure you need to have fund in your wallet.
Speaker A
And that's the wallet I'm going to use for deploying of the contract.
Speaker A
So once you have everything here.
Speaker A
Now click on this particular button.
Speaker A
And here you have to select injected provider.
Speaker A
So select here, it's going to simply connect with the wallet.
Speaker A
You can see it will fetch the wallet connected, it will reflect the balance.
Speaker A
And it will show you the chain ID which you are connected.
Speaker A
Which is a Polygon Mumbai.
Speaker A
And now here I have this many contract.
Speaker A
But make sure to click on this.
Speaker A
So if I show you this is the Hardhat.
Speaker A
This is the counter from the Open Zeppelin.
Speaker A
And here we have this create.
Speaker A
And that's what I'm using.
Speaker A
So this is the contract which I'm going to deploy.
Speaker A
So select this one.
Speaker A
And now all you have to do is to click on this deploy.
Speaker A
And it's going to open the Metamask.
Speaker A
Just wait, here we have the Metamask.
Speaker A
And now click on this confirm.
Speaker A
And it's going to make the transaction.
Speaker A
So let me show you the transaction is happening.
Speaker A
So this process will take a little bit time.
Speaker A
Because right now we are dealing on the test network.
Speaker A
And finally the transaction is completed.
Speaker A
And here it will give you your contract instance.
Speaker A
So if you come back here, you can able to see the fund.
Speaker A
And all the function we have deployed in the contract.
Speaker A
So you will learn a lot of things when you will follow this entire project.
Speaker A
Because we have covered so many things.
Speaker A
So this is the entire function we have.
Speaker A
You can simply interact and do the transaction right from here.
Speaker A
But we have built our front end.
Speaker A
So simply get this particular address, copy this one.
Speaker A
And that's the only thing you need.
Speaker A
That's the only thing you need.
Speaker A
And come back here.
Speaker A
Now close this one.
Speaker A
Come back to the context.
Speaker A
And here you have to simply replace the address.
Speaker A
Here you have to simply replace the address.
Speaker A
So this is the previous contract I have deployed to the different network.
Speaker A
I'm going to simply remove that one.
Speaker A
This is the address for the Hardhat local.
Speaker A
I'm going to simply replace with the Mumbai.
Speaker A
Paste here.
Speaker A
And the one thing we have to keep in mind that we need the ABI.
Speaker A
So we still need the ABI so we can interact with our contract.
Speaker A
So there is multiple way you can simply compress, you can use Hardhat, you can use Ganache.
Speaker A
There is tons of library which you can use to get the ABI of any contract.
Speaker A
Once we done with that.
Speaker A
This constant.
Speaker A
This setups.
Speaker A
And the ABI.
Speaker A
Now we can start interacting with our Mumbai test network.
Speaker A
So if I open this up.
Speaker A
I'm going to stop this.
Speaker A
Because right now we are not using Hardhat.
Speaker A
Simply stop that one.
Speaker A
And we have to stop our application as well.
Speaker A
Let's close all of that.
Speaker A
Let's close one of the terminal.
Speaker A
And that's what we have.
Speaker A
So we are still in the same directory.
Speaker A
Now we have to simply type NPM run dev.
Speaker A
And it will work fine.
Speaker A
So here our application got started.
Speaker A
Come back in the browser.
Speaker A
Go back to the application.
Speaker A
And reload the page.
Speaker A
The moment you do that.
Speaker A
This time we are interacting with the Polygon test network.
Speaker A
So click here and we are connected.
Speaker A
You can simply come back here.
Speaker A
And you can log it to log out from your account.
Speaker A
So click on this.
Speaker A
And here it will simply log out.
Speaker A
And it will open up this Metamask to log in.
Speaker A
So everything is working fine.
Speaker A
Okay, what is the password?
Speaker A
Okay.
Speaker A
Not at all.
Speaker A
Finally I got the right password.
Speaker A
You can see things are looking pretty fine.
Speaker A
Now I come back to the candidate registration.
Speaker A
I can click on that.
Speaker A
It will take me here.
Speaker A
And I can simply pick an image.
Speaker A
I'll pick my image.
Speaker A
I have to select the address.
Speaker A
Because this is the address I will use as a nominee.
Speaker A
I can give the name.
Speaker A
I'll say Daulat Hussain.
Speaker A
I'll give the address.
Speaker A
And I'll give the position is going to be.
Speaker A
You can type it whatever.
Speaker A
I'll say blockchain developer.
Speaker A
And you can click on this authorize candidate.
Speaker A
And it's going to make the transaction.
Speaker A
It's going to open up the Metamask.
Speaker A
And click on this confirm.
Speaker A
And here the transaction is happening.
Speaker A
So you can see the transaction is still happening.
Speaker A
So just wait.
Speaker A
So make sure to follow this.
Speaker A
You will understand everything.
Speaker A
That's everything is explained in the project.
Speaker A
So just wait, still the transaction is happening.
Speaker A
Because this time we are dealing in the actual test network.
Speaker A
And finally the transaction is completed.
Speaker A
And you can simply reload the page.
Speaker A
And here you can see we got one user.
Speaker A
And that's what it's reflecting here.
Speaker A
Blockchain developer.
Speaker A
Now anybody can give vote.
Speaker A
So this is how you can execute this project.
Speaker A
Many of you have question that is this project still relevant?
Speaker A
Yes, it is.
Speaker A
This one is one of the most important project you can add in your portfolio.
Speaker A
So I hope you guys have understood that how you can execute and what are the changes you have to do in the code base to execute.
Speaker A
And this is the updated code and this is the old code which we have written together.
Speaker A
And if you want to get the final code, you can simply come back to the blockchain coder.
Speaker A
Here you will find tons of project we have built.
Speaker A
More than 35 project we have.
Speaker A
All of this extensive big project that will teach you a lot of things.
Speaker A
So come back here.
Speaker A
And simply come back here and you can simply, I'm going to attach this particular video right up here.
Speaker A
So you can simply follow that.
Speaker A
And if you want to deploy this, so in this particular video I have explained that how you can deploy this particular application to internet.
Speaker A
So you can follow that as well.
Speaker A
So all you have to do is to click here and get the startup file.
Speaker A
And start working on the project and follow this.
Speaker A
So hope you guys have understood every single thing which I have covered.
Speaker A
And if you want to take your skill, the learning to the next level and building one of the most complex project.
Speaker A
And learning about the Solidity smart contract framework like crash courses.
Speaker A
That's all I have in this particular course which I have launched for the blockchain developer.
Speaker A
Which you have to check.
Speaker A
It's pretty huge.
Speaker A
We have got an amazing response.
Speaker A
From a lot of developer.
Speaker A
So you can see.
Speaker A
It is a complete ready to build and join organization and project.
Speaker A
I want to drag your attention to the modules I have.
Speaker A
So here you will learn every single thing about the Solidity course.
Speaker A
We have more than 60, 60 videos.
Speaker A
Like close to 60 videos we have in which we're going to learn about every single syntax.
Speaker A
We're going to do the practice of the smart contract.
Speaker A
Then we're going to learn about the NFT marketplace.
Speaker A
It is one of the biggest project.
Speaker A
In that you will see we will write more than six to seven contract for different business model.
Speaker A
And we're going to combine it all the contract in one central place to build a ready to working business in the blockchain.
Speaker A
So that's all the things we have explained.
Speaker A
Here we have the crash course that what you will learn like HTML, CSS, React and Next.js.
Speaker A
Tailwind, Hardhat, Metamask, Web3 providers.
Speaker A
So we have tons of things in this particular course.
Speaker A
So I would encourage you to take this one.
Speaker A
That will teach you a lot of things.
Speaker A
And currently it's going 35% off for the newer.
Speaker A
So you can simply join that one.
Speaker A
So that's the only thing for my end, I hope you guys have got an idea that how you can execute this file.
Speaker A
If you still have any confusion, any doubt, do let me know in the comment section, definitely I'll try to help you with that.







![[Full Episode]Nothing Else Compares(English-dubbed)#cdr… — Transcript](https://i.ytimg.com/vi/YYJruShKWz8/maxresdefault.jpg)


