Loading video player...
All of you welcome back to your first
ever Solana mastery project in which
you're going to build your own
decentralized voting dab on the Solana
blockchain using Rust anchor framework
for writing the smart contract web3js
and nextjs as a front end. So let me
give you the complete walkthrough that
what are the feature and functionality
we have included and how every single
thing would work. How the user can
register, how the admin can approve, how
the transaction and they can perform the
voting. So when the user will come back
to our application, this is what exactly
they will see. We have the stunning
interface where user can interact with
all the element all the part of our
application. So the very first section
we have is our header section. We have
the logo. We have a different pages home
voter candidate result profile admin.
Currently I'm connected with the admin
account. That's why this one is visible.
But if the user will connect it will be
hidden. We have our wallet. So user can
click and disconnect and they can
connect the wallet. We have our hero
section where we are displaying that
what type of application it is. So it's
a Solana blockchain decentralized voting
dab. Here we have a quick action button.
So either can go back to the create vote
or they can go back to their profile.
This one is dynamic. If they have not
registered themsel, they have to go to
the registration page. And right now you
will find that the voting is already
started. So I have set the voting type
to for one day but you can set any
voting period. Here you will find the
overall stats. So currently I have
registered one candidate as a voter and
one candidate as a candidate who
contexting in this particular election.
So here you will find that how many user
will give the vote that's all is given
currently the status is active and here
we are providing all the details about
our application. So it's a decentralized
voting system which has a secure
transparency like speed and real-time
data which is coming from the smart
contract. We are providing this how it's
work. Here we have some quick to action
and we have the photo section. So this
is the complete homepage we have. Now
let's come back to the voter page. If I
click here or you can simply click here.
I'll click on the voter page. I'll come
back to the voter section. Find that one
user has already got registered into the
account. That's why you can see and I
use the same account for doing the
registration and my account has got
approved. All the KYC details which I
have provided is got approved. That's
why it's reflecting here. This is the
approved profile for the voter. So we
are providing all the detail the address
the about us the messages and when the
user will give the vote is going to be
reflecting here. If I come back to the
candidate currently we have one
candidate who got the approval from the
admin. So you can easily able to search
and you will find the details about the
candidate and you can able to cast your
vote. I'll tell you how you can do that.
So this is the candidate. If you come
back to the result. So right now you
will find that only one candidate is got
approved and there is no vote is given
but we go to give vote and every single
thing would be update dynamically. If
you come back to the profile so I have
already done the registration from this
particular account which is the admin.
So you can register as a voter or as a
candidate or you can do in the both way.
So I have register as a party voter
which is the new party. If I come back
to the candidate and this is the
candidate which I have uploaded and it's
approved. If I want to do the editing
and update in the profile, I can simply
come back here and I can perform. But
this is only allowed before you got the
approval. If you come back to the admin
then you will find the details about all
the smart contract on all the
transaction is happening. So total
voter, total candidate, approved voter,
approved candidate, the contract
information. If you want to control the
smart contract, you can simply set the
timing which you have to do when you
will deploy the contract, change the
ownership or reset. And here you will
find the voters and the candidate. So
this is the complete and all the pages
we have in our application. Now let's
try to perform couple of action. So what
I will do I'll simply come back here and
let's try to change my wallet address
and let's register couple of user and
couple of candidates. So I'll simply
give a reload after changing the
candidate. So I'm connected with a
different account and you will see that
this is dynamic. So I can register as a
voter or as a candidate. So let's click
on this register as a voter and it will
come back here. So first I'm going to
register. So I'll simply click here and
I'll say
chat
tab and I can give the description. I
can come back here and I'm going to
upload the image. So I'll going to
select this one chat application tab and
it's going to select me the profile and
all of these details looks good. Now I
can click on this registration and here
we are performing the transaction and
it's going to call our phantom wallet
and we have to confirm it. So let's
click here and you can see I'm getting
this stimulation because we are not
doing a stimulation on the devet. So
simply ignore this one. Now click on
this confirm and once the transaction is
confirmed you will find that this user
is registered as a voter and currently
it's in the pending and if I come back
here I can register as a candidate as
well. I can click here let's provide the
same details because it's in the same
user or you can provide any other
details. There is no problem. You can
provide different images. There is no
problem in that but I'll simply select
the same data. I'll click on this
register and this user would be
registered as a candidate for the
election. So just wait. Let's click on
this continue. Click on this confirm and
the transaction in the pending. Once the
transaction will complete this user is
registered successfully. So we have
registered this user and looks good.
Right now it's in the pending. If I want
to do the update in their profile I can
do that. So I can simply come back here.
So I'll say app or you can type
anything. You can change the message or
let's change this double and I can come
back here. Let's upload the same image
or you can put any other image but you
can update the profile.
So here we are calling the function and
just wait once we'll get the
confirmation from the metamas like
phantom wallet. Let's click here click
on this confirm and now it's writing the
data on the blockchain and finally we
did the confirmation and changes. So if
I come back to the voter you will find
that it's got changed. If I come back to
the candidate you will find that it's
got changed chat app and we have put
more detail in the about section. So
that's how user can update their
profile. Now let's do one more
registration from a different account.
So I'll come back here so I can show you
all the transactions. So I'll simply
give a reload because I have changed my
account and you will find that I haven't
registered that's why I automatically
got redirect to the homepage. Let's
register it one more time. I'll click
here. I'll say this one to be play to on
and I'll give this description. Click
here and select this play to earn game
and click on this registration.
Here the transaction is happening. Let's
confirm the transaction.
Click here. Click on confirm. And the
transaction is confirmed. Just wait. And
finally the user is registered. It's in
the pending. I can come back here and I
can do the registration as a candidate.
Let me do that quickly.
I'll give the description upload here.
Select. Click on open and click on this
registration.
And the transaction is happening.
I have to simply give the confirmation.
Click on confirm. And the transaction
will be completed. And here we got it.
Now you see that if you want to update,
you can simply come back here and update
the profile. But this account is in the
pending. If I come back to the voter,
you will find the details that only one
approval we got it. And currently it's
showing you your stats. So you have
created account and it's in the pending.
If you come back to the candidate, you
will find that currently we have this
one is approved, two is pending. So you
can simply give a reload. So it's going
to reload all the approval you have done
latestly. So you can come back here. Go
back here and you can see only this one
got approved and this two is in the
pending.
So now you have to get the approval from
the admin. So what I will do, I'll
simply come back here. I going to go to
the account number three which is the
admin. I'll simply click on the reload
and just a moment. Right now you can see
it's loading the data. It's in the
pending and click on this admin. And
here I will find all the details. So
it's 3 three 22 2 is pending and 1 one
is approved. So I'll simply come back
here. You will find the details about
the pending and the approval. That's all
is there. So first thing I'm going to do
is I'm going to complete the the
spending one. You can reject or you can
approve. It's totally up to you. So I'll
simply approve because I want to show
you the voting. So I'll simply give the
same message but you can type whatever
message you have. So just wait. Let's
click on this confirm. Click on this
confirm. And here the transaction is
happening. And finally we have approved
that. Let's approve this one.
Let's uh click on this confirm. And the
transaction is happening. Click it.
Click on confirm. And once we'll get the
confirmation, the candidate would be so
is approved. All the three voter is got
approved. Perfect. Now I can come back
here and let's approve the candidate. So
I'll simply call this
and click on this confirm
and click on this confirm.
And here we have approved that. Now
let's do the approve to the next one.
I'll simply click here and let's click
on this confirm.
Click here and click on confirm.
So we have approved all the voters and
all the candidates. All the voters and
all the candidates are successfully
approved. And that's what we can see. If
you come back to the voter then you will
find all of them are approved and well
reflecting. If you come back to the
candidates, they are there. So I can
simply come back here and I can able to
give the vote cast your vote. So I can
give vote to any user. If I come back to
the candidates here, I will find all the
candidate and I can see the stat that
how many vote they have got. So I simply
come back here and let's try to give my
vote. So I will go to decentralized
voting. So I'll simply click here. Click
and it's going to perform the
transaction. Click on confirm and I have
given my vote. Just wait. And finally I
have given my vote and this candidate
got one vote. If I come back to the
candidate section you can see this
progress bar went up. If you go to the
results there you will find that
currently we got one vote. Total
candidate we have three and this is the
leading got one vote and these are the
other three candidate. So those who will
get the highest vote they will we have
on top. So I'll simply come back here. I
can simply change my account to account
two and let's try to cast a vote. So
I'll simply come back here and I can go
back to the voters and I can see this is
the one I can give the vote to the same.
I can click on this and let's click on
this. Click on confirm and I will be
given my vote to this one. So this user
got two vote. The notification is there.
I can come back here. I can go back to
the account number one and I can give my
vote to the candidate.
So I'm registered. Come back to the
voter and this is two vote. I can give
this to this one. You can give vote to
any candidate. Let's click on confirm
and the transaction would be completed.
So it's a really powerful. I hope you
can understand that how every single
thing is coming together and how you can
call all of the function. So total two
cast is you can see three every single
thing is dynamic. This got two this is
the leading one. This got one and this
got zero. If you come back to the
profile there you will have all the
details. If you go back to the candidate
there you will have all the details
about the candidate and how many vote
they have got in term percentage all of
these details. If you go back to the
voter list you have given your vote. So
that's why you can see we're not getting
any option to give more vote. If you
come back to the home there you will
find the data about the vote casting. So
total voter three total candidate three
to vote casters and here you will find
all the details. So every single thing
is looking good. I hope you have
understood that how powerful this
application is. If you check the
responsiveness of this application, this
is how it's going to look on a mobile
device. You can make a small, you will
have this dropdown. Looks absolutely
incredible.
It's absolutely incredible. If I go back
to the admin account, you will see that
we are getting all the stats about the
smart contract and all the voting is
happening in the contract. So, if I come
back here in the admin, you will find
all the stats. We have all of these
variables the candidates they have given
their vote. You can easily able to see
that how many vote they have got it. And
if you want to change the owner you can
do that but I would suggest you not to
do it because if you change it you will
lessen down your credibility. And if you
want to reset every single thing so you
can simply do that but the data is going
to be there. So this is the emergency
function which will destroy the entire
smart contract. So let's do it because
we have already done with all the
testing. So let's compound this one. And
here we have it. The transaction is in
the process and we are destroying the
contract. So let's click on this and
every single thing would be destroyed
and we have reset the contract. You can
come back here. You can reload the page.
You will find the data is going to be
there. Now you will get your vote to be
casted because you have already done the
registration. If you come back here, you
will see the the voting is ended and no
one can able to give the vote. So this
one is really powerful. I hope you have
understood that what are the feature and
functionality we have included and how
this entire decent voting tab would
work. You have all the control over the
smart contract, over the profile, over
the results, over the candidate, over
the voters, over the voting rights and
updating the profile. That's all is
there. Now let me provide you all the
assets which you need to develop this
application including the smart contract
and the entire front-end architecture.
So to get that you can come back to the
blockchain coder there you will find all
the project which we have developed on
our channel. We have developed more than
100 plus project. So make sure to log
in. And once you will log in, you will
get this option source code and you will
come back here and here you will find
all the 100 plus project we have
developed. We have close to 40 project
related to Solana. So make sure to check
this one. I will also provide you the
link in the description. So you can
click and you can come back straight
away. So let's click here. Go back to
the recent and this is the one we have.
Click on it. You will come back here and
here you will find the complete
overview. So this final video which I'm
recording that's what I'm going to
attach here. You can click on the
starter file and you will come back to
the GitHub. Here you will find all the
images, all the architecture, all the
folder and all the technology which we
are using. That's all you will have. So
you can simply go through the each one
of the models, each one of the package
and try to understand the architecture
we have used. Now let me show you that
once you will get the final source code
how you have to do the setup. So you can
come back here and you can simply get
the final source code and when you will
take it you will give your valuable
contribution. Now let me show you how
you have to do the complete setup in the
project and run and deploy the contract
and do the testing. Once you will
download the final source code, you will
get the zip file. Make sure to extract
the zip file and you will get this
folder in which you will have the
complete source code of the project
which you have seen in the demo with all
the contract all the logic and this is
the folder you have to open in your VS
code. So let's click on the VS code back
to open go back to desktop and there I
have kept my folder. So I'll simply
select and click on open. Now let me
give a complete walk through of the
entire architecture and all the code
structure we have used in this
particular project. So it would be easy
for you to do all the navigation and
setup part. So the very first folder we
have in our project is this component in
which you will find all the component
for our application. So you don't need
to make any changes. Every single thing
is dynamic. Just test the way I'm doing
it. Uh once you test every single thing
as it is after that you can do all the
experiment. So the very first thing we
have is the candidate card. Keep every
single thing as it is. It's all dynamic.
Now come back to the footer. This is the
footer section. We have we have the
header. We have the layout. We have the
loader, model, status, batch and voter
card. So every single thing is well
optimized. Just keep it as it is. Close
this one. Close the component. The next
one we have is the context in which you
will find all the logic we have
developed which allow us to communicate
with the smart contract and performing
all the transaction. So just keep it as
it is. Every single thing is working
fine. Well optimized. That's the context
we have. Let's close this one. Come back
to the contract. And this one is the
most important thing. So all the logic
which you have seen all the transaction
which you have seen that's all coming
from here we are storing all of the data
performing the transaction tracking down
the user profile counting the vote
handling the error that's all we have so
every single thing is well optimized you
don't need to make any changes just test
but I would suggest you to give some
time and try to study the logic we have
implemented so this is the entire
contact we going to deploy soon just
wait close this one close this one come
back to the lift file there you will
find this idle file and this to the JSON
file of our smart contract. So once you
will deploy your smart contract, you
will get the JSON file and that's what
you have to provide here. AI of your
contract and that's what we can see.
Just keep it as it is. Close this one.
Close this one. Come back to the pages
and it's a multi-page application. So
the very first one we have is app.js.
Then you will find that we have done the
global wallet configuration. That's what
we have done here. Here we have the
wallet configuration and here we have
used the context management and the
toaster to wrap our application to
provide all the details. So just keep it
as it is. Close this one. We have the
admin page. Keep it as it is. Where
admin can control the entire smart
contract like approval, disapproval,
changing the date, updating the date.
That's all we have. We have the
candidate. We have the index file. We
have the profile. We have the result. We
have the vote.js. So every single thing
is dynamic. Just keep it as it is. Close
this one. Close this one. Come back to
the public. Have a image. But you can
keep all the assets which you have
inside this public. And you can simply
display in the front end. So close this
one. Come back to the style file and
this is the complete CSS we have coded
for this particular project. So just
keep it as it is. No need to make any
changes. Every single thing is working
perfectly. So close this one. Close this
one. Come back to the utils. There you
will find that we using the constant in
which we have some state variable like
approval rejection pending status model
contract addresses admin RPC endpoint
status. That's all we have. So just keep
it as it is. You don't need to make any
changes. We have the helper function
where we can simply converting it the
timing, checking the address, sorting
the address, displaying the date that
all we have. Then we have the pinata in
which we have the complete logic which
allow us to upload the document to the
IPFS and we are using pinata for it.
It's absolutely free. So we can upload
JSON data, we can upload file, we can
get the data, we can read it. That's all
we have. Keep it as it is. Close this
one. Close this one. Now come back to
the most important thing and all the
changes all the variables which you have
to put here in this environment
variable. So click here and here you
have to provide your details. We're
going to get it these details together.
Just wait. So you have to get your
program ID for your smart contract. Once
you will deploy you will get it and
that's what you have to provide here.
And here you have to provide your wallet
address which you will use for deploying
the contract. And here you have to
provide your prenata credential like API
key, secret key and JWT token. So this
is all the variable we going to get it
together. Simply close this one. This is
the get ignore. Leave it as it is. We
have the next config file. Keep it as it
is. We have the packages on file. And we
using the most stable version of the
packages. So no matter when you are
developing it will work absolutely fine.
So just keep it as it is. You can simply
do all the check of the packages.
Industry standard we are using it. So
close this one. Come back to the post
CSS. Keep it as it is. We have the Ruby
file. There you will find all the
details about the project and all the
importance links which you can have a
look. So just keep it as it is. As long
as you will follow this video till the
end you will understand every single
thing. Come back to the Telvin and this
is the Telvin configuration we have
done. So I hope you have understood the
complete folder and file structure we
have used in this particular project and
what model architecture we are using. So
now the very first thing we have to do
is to deploy our smart contract and get
the environment variable. So if you come
back here in the contract you will find
that this is the huge contract we have
and this is the contract we going to
deploy and I'm going to use Solana
playground which is absolutely fine to
deploy all the cons. So I'll come back
to the browser and let's open a new tab
and type Sana playground. So make sure
you should always search Solana
playground in your Google and then you
can come back here in this particular
link and click because there are
multiple fake Solana playground. If you
connect with a fake one, they're going
to withdraw all the fund from your
wallet. So that's the thing you have to
keep in mind. So click here and you will
come back to the official Solana
playground. Right now you can see I
don't have any project. So first thing
you have to do is to do the setup of
your project and we're going to use
Solana anchor framework. So I'll simply
click on this create and I'm going to
create a project. So let's call this
voting
dab and I'm going to select this anchor
rust framework and click on this create.
Once you will click on that it's going
to create a repository for you and here
you will find some dummy code which
we're going to simply remove and we're
going to paste our smart contract. So
come back here. This is the entire cos
smart contract we have. Simply select
all and copy and that's what you have to
paste here and you will find that this
is the complete contract we have to
deploy and I'm deploying to the Solana
devet and when I will compile the
contract this particular program ID
which is the unique identifier of my
smart contract and that's what I'm going
to provide in my environment variable.
So that's the first thing once you paste
make sure to save the code and you will
find that I'm going to use my wallet.
This is internal wallet and I have
enough fund. So let's close this one.
What I will do? I'll come back here.
Click on this build and it's going to
generate the AI and the idle file and
the deployment model. So click here
build and here it's compiling. Just
wait. Once the compilation will complete
you are ready to deploy the smart
contract and you can able to get the
idle file means the AB of your smart
contract. So just wait. And finally you
can see that I'm getting this error
because I made a lot of requests to the
compiler. So whenever you get this error
all you have to do is to simply give a
quick reload and
save it and just give a one more try.
Click on this build and it's going to
recompile it. So this is a very natural
behavior you will get when you will try
to interact with a compiler.
Just give some time. Soon it will
compile and we're going to deploy the
contract.
And finally we have compiled our
contract. You can see build successful.
The moment you will get the
confirmation, you will get this deploy
button and you will find that this
address will also change. Now we have to
deploy the contract. So click on this
deploy and it's going to perform the
transaction. So just a moment just hit
enter and you will find that our
contract is deploying. Just moment
simply ignore this warning. The main
thing you have to focus on the CLI it's
deploying because we have the
stimulation on the devet. So sometime
it's response sometime it's not respond.
That's not the important thing. Simply
ignore that one and just wait soon you
will get the confirmation for the
deployment.
And finally our contract is deploy. If
you click here you will come back to the
explorer and there you will find all the
details about the transaction we have
performed all the execution model we
have interacted during the deployment
and that's all the logs which you will
find. So our contract is successfully
deployed on the Solana DevNet. Now the
very first thing you have to do is to
simply select the entire contract and
that's what you have to paste here. So
simply remove and paste here.
So we got this updated contract. This is
the only thing got updated. So I'll
simply close this one. Now we have to
get our environment variable. So you can
simply copy your address the program ID
for your contract from here. I'll simply
come back here and paste the program ID.
Then I have to get the address of my
wallet. So this is the wallet I have.
So, I'm going to simply copy it and
that's what I'm going to paste here.
I got the address of my wallet and the
program ID. Now, I can get the idle
file. So, I already have this one. So,
I'll simply delete this old idle file.
And let's minimize this one. So, I can
simply import like let's close this one.
Come back here. Import the idle file
from here. And I got it. Now, what I
will do, I'll simply come back to my
code editor. I'll go back here. I'll go
back to download. And there I have it.
I'll simply drag and drop right up here.
So uh and I will give the save and this
is the idle file we got it. So we have
done the most important thing. We have
deployed our contract. We got the
addresses. Now we have to get our pinata
credential which allow us to upload the
document to the IPFS. So what I will do
I'll simply come back here. Let's uh
close this one. We don't need this one
anymore. Close here. Type pinata cloud.
It's absolutely powerful platform which
allow you to interact with the
decentralized IPFS and it's free to use.
So make sure to create your account,
verify your account and make sure to
check all of this. They have tons of
feature they are providing. So I'll
simply login because I already have my
account but you as a new creator make
sure to create your account verify your
account then you will have the valid
credentials. So I'll simply log in and
here I'm into my dashboard. I haven't
created any API key but I have uploaded
couple of files. So I'll simply come
back here to the API key and then you
will find that I have a empty API key.
So I'll simply click here new key and
here I'm going to give the name. So I'll
say voting tab. Click on this admin
because I want to have the access of all
the feature. Now click on this create
and it's going to create the project. So
you will have all of this credential
which we need. So first you have to copy
the API key. Simply copy that one and
that's what you have to provide. API
key. We got that. Now we have to get the
secret key. Copy. And that's what we
have to provide. Now we have to get this
JWT. Copy. And that's what we have to
provide. So we got all of this
environment variable. Again I'm telling
you you have to use your own API key
because after this project I'm going to
delete it. So it will not work. It's
absolutely free to use it. So make sure
to use your own API key. So we got this
one. Now if we come back to the packages
JSON file we have to do the installation
of this packages.
These are the well established and
stable package we have. So this is the
one we have to install. So to install we
have to open up our terminal. And if I
show you my node version, I'm using the
latest node version. So it will work
absolutely fine. If I show you my npm
version, I have the latest version. So
there is no problem if you're using the
latest version. So make sure to be on
the same stage. So everything is looking
good. Now what I will do, I'll simply
install the package this time. NPM I hit
enter and it's going to do the
installation of the package. This might
takes a little bit time depending on
your internet speed, your system
configuration. So just wait. Don't touch
it. Just wait. Once the installation
will complete, then we are ready to test
our application. And you can see that
I'm getting couple of depreciated
depreciated messages. Simply ignore
that. It's not that important because we
are focusing on stability. So no matter
when you are developing this project
after 5 years, 10 years, as long as you
follow this video and use the exact
version, every single thing would be
absolutely fine. So we are getting this
warning. Simply ignore that. It's not
that important because every single
thing is getting controlled by the smart
contract. So what I will do, I'll simply
clear up my terminal. Now we are ready
to start the application. So this is the
command we have to execute the dev one.
Simply type npm run dev. Hit enter and
it's going to start our application on
luconus 3000. Simply copy. Now come back
to the browser. I'll simply close this
one. Open a new tab. Paste here and hit
enter. And you will find that our
application is got started and you can
see the application got started and
every single thing is working absolutely
fine. So this is the homepage. If I come
back to the voter page, I'm not
registered at the moment. I have to
register. If I come back to candidate,
there is no user. If I come back to the
result, there is no user. If I go back
to the profile, I have to create my
account either candidate or voter or I
can create both. If I come back to the
admin and you will find that this is the
admin dashboard. Right now the very
first thing we have to do is to
initialize our smart contract. That's
why you are getting this options. Once
you will initialize every single thing
would be activated and you are ready to
start registration and taking vote. So
that's what we have here. So what I will
do if I come back here if I switch my
account to show you with a different
account that this is the dynamic
approach we have added. If I give a
reload you will find the admin is gone
and I'm not the admin but I try to
access the admin panel. So this is how
the user will see. So I can come back
here go back to the admin. So I can
initialize the contract. So the user can
start registration in this. So click on
this admin and this is the first
function I have to call. So let's click
on this initialize contract. Click on
this initialize contract and it's going
to initialize
and I have to simply confirm the
transaction
and fin the contract is successfully
initialized and you will find all the
details contract information your
address and here we have this voting
start or end. You can see we are going
with the default date but you have to
set that how you want to execute the
voting. So I can set the period. So
first is going to be the starting date.
I can come back here. I will take this
today's date and I will take the today's
time. I'll come back here. I'll take the
17 and I will take the ending is going
to be this. Now I have to simply click
on this set period and it's going to
perform the transaction and set the
variable in the smart contract. Now
click on this confirm and once the
contract will be set for that specific
duration for registration and doing the
vote. So you can see we have
successfully set the duration of the
vote. In the same way you can simply
change the ownership or you can simply
reset but don't do this. Okay. And right
now we don't have any candidate and
voter as a register because when the
voter or candidate will register we as
an admin have to verify their account.
So I'll simply come back here and go
back to the voter section and let's try
to register. You can commit from here or
you can do it from here or you can
simply go back here and you can click on
this register and it will take you as a
voter. Now I can simply register. I can
paste here. Let's call the name. I'll
say orders. I can give my description
and I can simply come back here and I'm
going to upload this.
I have provided all the details. Now
click on this register and you will find
the transaction is happening.
And just a moment soon our Phantom
wallet will open. And you can see we are
getting this one because the Phantom
wallet tried to do the stimulation by
default but we don't want that. So let's
click it as it is. Click on this confirm
and the transaction would be completed
and the voter would be registered. And
you can see you have registered
successfully yourself. In the same way
you can come back to the profile. You
can go back to the register as a
candidate because you have the voting
right and you have the right to step
into the election. So I'll simply click
here. Let's provide this one. I'll say
coders. I'll give the description. I can
pick the same profile because it's the
same candidate. But if you're getting up
for any particular party, you have to
put your party logo. So just wait. Soon
the transaction will complete and we'll
have this one. So click on this confirm.
And here we have register. You can see
the image profile is also looking
beautiful. Here if you have the water
profile that's all is there. If you want
to do any update you can click here and
you can perform the update. So if I want
to change the image I can simply do
that. I'll go with this. If I wish I can
do that or I can change the name as
well. So I'll simply come back here.
Let's say
new
T party and let's change the let's put
the same one more time so you can
understand. So I'll simply click on this
upload and it's going to make a call to
our smart contract and perform the
transaction. So let's click on this
confirm and the transaction is happening
and here we have done the update new
party. Now if I come back to the admin
account you will find that I have to
give a quick reload and you will find
the data would be reload successfully. I
can come back to the admin and you will
find the data is reflecting that we have
one candidate and one voter and the data
is going to be reflecting here. So this
is the one it's reflecting. If I go back
to the candidate I can see if I go back
to the voter I can see first thing I
have to do as an admin to check their
document and verify their account their
registration. So if I come back to the
voter candidate right now it's not
reflecting. If I come back to the
candidate candidate I can see but it's
in the pending
but but when I will approve this one it
will be approved. So I can simply come
back here. Let's try to approve the
voter first. So I'll simply click here
approve and I can give the approval
message. So I'll simply give this dummy
text and I can click on this confirm.
And this account would be approved by
admin. So let's click on this confirm.
And here we have the approve. We have
approved that successfully. Now we have
one which is the candidate. It's waiting
for our approval. So I'll simply come
back here. If I come back here, this one
is approved. The status is changed. If I
come back here, we have this one more
approval left. I'll simply click here
and I can give the message. You can type
any message. Click on confirm and click
on this confirm and the approval is
done. Now both the account and candidate
is approved. Now if you come back to the
voter you will find your data is
reflecting fine and here you got the
message that your voter registration is
pending by the admin. Please wait. So
you can simply give
a reload and you will find that your
account is successfully approved and
activated.
Approved and activated. Now you can come
back to the candidate. You will find
that you are also approved. So every
single thing is looking good. I hope you
have understood that how you have to do
the setup and how you have to perform
the transaction. How you can give the
vote. So you can register more candidate
just like that and then they can simply
start giving the vote to one another.
So this is very important. I hope you
have understood every single feature and
functionality we have included that how
you have to do the testing of the
contract, how you can deploy, how you
can create voter registration, how you
can check the result profile, every
single thing is looking wonderful.
That's the only thing I want to explain.
I hope now you know how you have to do
the setup when you will get the final
source code and what are the things you
have to put in your code base to get
deployment testing and uploading all of
this data. So that's the only thing from
my end. If you have any more question,
any doubt, do let me in the comment
section. I'll definitely try to help you
in that. Have a wonderful day.
Source Code: https://www.theblockchaincoders.com/sourceCode/build-and-deploy-a-solana-decentralized-voting-dapp-or-rust-+-anchor-+-web3.js-+-next.js-or-full-stack-blockchain-project Solana Decentralized Voting DApp Blockchain Course: https://bit.ly/Pro-NFT-Marketplace All Project Code: https://www.theblockchaincoders.com/SourceCode Donate Please: https://linktr.ee/daulathussain 1 - 1 Consultancy: https://www.theblockchaincoders.com/consultancy Pro Blockchain Courses: https://www.theblockchaincoders.com/ Public Discord: https://discord.gg/Gah6YGuBFS Build & Deploy a #solana Decentralized Voting DApp | #rust + Anchor + Web3.js + Next.js | Full-Stack Blockchain Project In this solana Project, we’ll build and deploy a Decentralized Voting DApp on the Solana blockchain using Rust, Anchor framework, Web3.js, and Next.js. Learn how to create a secure and transparent voting system where users can cast votes on-chain with full decentralization. We’ll cover everything — from writing the smart contract in Rust, deploying it on Solana Devnet, integrating it with a modern Next.js frontend, and connecting with #phantom Wallet for user interaction. 📌 Timestamps 00:00:00 ➤ Introduction 00:00:35 ➤ Overview 00:03:42 ➤ Features Demo 00:13:32 ➤ Starter File 00:14:25 ➤ Final Source Code 00:19:38 ➤ Deployment 00:23:31 ➤ Environment Variables 00:25:46 ➤ Installation 00:27:18 ➤ Testing Live 🚀 Technologies Used: - Solana Blockchain - Rust & Anchor Framework - Web3.js - Next.js - Phantom Wallet 📚 What You’ll Learn: - How to create on-chain voting logic using Rust & Anchor - How to interact with Solana programs via Web3.js - How to integrate wallet connection in Next.js - How to deploy your own decentralized voting platform 💡 Perfect for developers exploring Solana DApps and Web3 development! Save NFT Marketplace PlayList: https://youtube.com/playlist?list=PLWUCKsxdKl0olgEF4OxXVk2B-jwpGqL5d API PlayList: https://youtube.com/playlist?list=PLWUCKsxdKl0oAFAVuRZxQSYC07UTcl_v_ Solidity PlayList: https://youtube.com/playlist?list=PLWUCKsxdKl0oksYr6IG_wRsaSUySQC0ck Complete JavaScript Course: https://youtube.com/playlist?list=PLWUCKsxdKl0qROhA0XO4_ek9bIwZ4j4Xr HTML Course Code: https://www.daulathussain.com/complete-html-course-daulat-hussain/ =================== HOSTING ++++++++++++++++++++ Best Hosting: https://clients.domainracer.com/aff.php?aff=28826 Follow Me: Instagram: https://www.instagram.com/daulathussain92/ Facebook: https://www.facebook.com/daulat.hussain.18 Twitter: https://x.com/TheBCoders Pinterest: https://in.pinterest.com/daulathussainhealthfitness/ Linkedin: https://www.linkedin.com/in/daulat-hussain/ Quora: https://www.quora.com/q/schahkxkdudpgjvh Facebook Group: https://www.facebook.com/groups/59011 Facebook Page: https://www.facebook.com/yourdhfitness Subscribe to My Channel: https://www.youtube.com/channel/UCz6_...