Loading video player...
All of you, welcome back to yet another
project video. In this project, you're
going to build your first ever Solana
staking dab with referral program. So
user can share their referral ID and
when the user will stick the token using
their referral ID, they're going to earn
commission. So let me give you the
complete walkthrough of the entire
application that what are the feature
and functionality we have included for
the user as well as the admin. How the
user can claim the reward, how they can
stake and how admin can control the
entire smart contract. So when the user
will come back to our application, this
is what exactly they will see from top
to bottom. We have a beautiful design
with all the details about the project.
So the very first section we have is the
header section. We have our logo. We
have the three different pages. Landing
page, dashboard and admin panel. And
this one is dynamic. Only admin can able
to have this option. Once he will
connect his wallet, you can simply click
here. You can disconnect and you can
connect your wallet. Now we have the
main section where we are providing all
the details about our project. So we
have called Solana ST in referral
platform but you can call whatever you
want. You can click here and you can go
back to the dashboard where you can able
to perform all the transaction. We have
the overall stats section where we are
providing details about our project. If
you come back to the platform there we
are giving all the details that why
users should pick us what are the
feature we have providing. So you can
able to customize based on your
requirement. If you come back how it
work it's very straightforward. So user
can connect their wallet, stake the
token, earn the reward and claim the
reward anytime they want. The next
section we have the details about the
token and the program. So I'm using
multicurrency the token which I have
deployed on the devet and all the
transaction which I'm performing on the
devet. So you'll find the name symbol
total supply the network you'll find the
program which I have deployed the token
address and currently the users have
staked this many token and the status is
active. Here you will find the overall
details about your wallet which you have
connected and used for staking and
performing the transaction in this
particular tab. So you will find the
wallet address the token I hold in my
wallet. This much token I have staken
this contract and this is the pending
reward which I have earned. And here you
will find the total earned reward which
I have got from the contract by staking
my token. You can simply click here. You
can go back to the dashboard. So you can
simply come here. You can simply
disconnect and you would be
disconnected. You can click here. It
will be open that you are not connected.
Now you can click here, click on the
phantom wallet and you will be connected
and you will come back to the dashboard
and here you will find all the details
about the smart contract and your wallet
and your transaction which you have
performed. So you can simply see here
you will have all the details about the
transaction which you have taken place.
So we have the dashboard we have the
total number of token user have stake.
you will find your stake that how many
token you have staked your pending
reward and here the token which you have
earned and this data would only dis so
when you going to unstake the token this
calculation of the reward will take
place and it's going to display here so
right now I have to wait for 24 hours to
get the buzz done visible then I can
able to call the unstick and the reward
would be displayed you will find the
total token I have earned my balance the
soul balance which I have in my wallet
and here you will have the three option
which you as a user can use it. So if
you want to st more token, you can
simply click here and you can see the
details like you can see your vault
address, you can see the token which you
can enter and deposit and this one is an
additional. So you can take the referral
or you can simply skip that part. Both
will work absolutely fine which I will
show you the transaction. So let's close
this one. Here you will find the button
is not unlocked yet because I have to
wait for 24 hours to get this unlocked.
then I can able to withdraw my token and
unstake and I will get the final
calculation of the reward. You will find
that this is the final calculation which
I have done yesterday and currently it's
available. If I want to withdraw this, I
can easily to make the claim and I can
withdraw this token which I will show
you here. You will find the referral
details, referral stats that how many
referrals you have got. So currently I
got one and someone have used my
referral ID and I got this much token as
a commission. So you can see the status
and you can simply copy and you can
share with the user. If you come back
here here you will find the transaction
history all the transaction details
which you have done. So if I come back
here in the stake section you'll find
that how many token you have stake. If I
come back to unstake see the unstake. If
I see the claim this is the claim which
I have found. So all of these details
will be dynamic going to display based
on the user. So this is what we have.
You can easily to customize. If you want
to hide some of things you can do that.
Now come back to the admin panel and
this option is only visible to the
admin. Currently I'm connected with the
admin account that's why it's visible.
You can see the currently the program is
active this much token available in the
contract and I can say rate of reward.
So how many token you want to provide as
a reward to the user per second. So you
have to decide that. So currently I'm
providing this much reward per second on
the given quantity which user I have
stake in the contract. And currently you
will find that I have already
distributed this 20.373
token as a reward for the referral. Here
you will find the overall stats about
the void address and the balance you
have in the soul. And here you will have
the total contract volume lock. So this
is the total supply of the token we have
in the contract. And this is the reward.
So you have to provide the token,
deposit the token into the staking
contract so it can deliver the reward as
well. So which I'm going to show you.
And as an admin you have this three
options. So if you want to add more
reward token into the contract you can
do it. [snorts] You can see your
balance. You can see the token available
in the contract. So if I want to fund
like 1,000 10,000 1 million I can do
that.
Now we have this update rate. So
currently I'm going with this particular
rate but if you want to update you can
simply update that. But I would suggest
you to decide that on what stages you
want to update your rate. In that way
you will have more authenticity. But
I'll show you how you can update the
rate of interest. If you want to
withdraw the token from the contract,
you can withdraw very easily. And here
you'll find the transaction logs like
this data we are storing in the local
storage. So you can see that what
transaction you have performed. So
that's the data for the admin and the
function is available. Now let me
perform all the transaction and show you
how you can able to control the entire
smart contract. So first I'm going to
perform the transaction as a user. So
and here you will find the overall
details like how many token I have a
stake and here you will have this
option. So let's try to st more token.
So I'll simply open it up and I can try
to stake the token. So for example I
want to do the staking of 500 token. So
if I want to use a referral ID and
provide the address or I can go without
referral ID. So I simply click on this
confirm and here it's going to call the
function. All I have to do is to simply
click and confirm the transaction. You
can see I'm getting this because I'm
doing all the transaction on the dev net
and we don't have the stimulation. So
I'll simply click on this confirm and
the transaction is going to perform and
here you will find that we have
successfully done the stake. So when you
will stake and when you will unstake we
going to calculate the reward and that's
what we're going to display here. So you
will find the reward which is
displaying. So this much reward is
available. If you want to claim the
reward you can simply click on this
claim reward and it's going to make a
call. Click here. Click on confirm. And
the transaction is processed. And we
have claimed the reward which we have
earned staking this much token.
If you want to unstake this token, you
have to wait for 24 hours to unlock and
get out of your token. So if I want to
st more token into the contract. But
this time I will do with the referral
ID. So first I'm going to get 500 token
as a staking. Now I will come back here,
go back to my Phantom wallet and I'm
going to pick my account number one as a
referral user. So I'll simply paste
here. Give this. Click on this confirm
stick and it's going to perform the
transaction. Click here. Click on this
confirm. And the transaction is
happening. And the transaction is
successfully. You can see that this got
went updated. So when you will stake
this will be update because you have to
wait for 24 hours complete 24 hour to
get the unstake button visible. So you
can able to get your token back. And you
can see we got the reward calculation.
If I want to withdraw this, I can
withdraw that very easily. So that's how
user can stake the token and claim the
reward. But we have to wait for 24 hours
to unstake the token. So if I come back
here, you will see all the transaction
which we have performed. If you go back
to sake, you have to go unstake claim.
That's all is there. All the recent
transaction which you have made and
stake the token. That's all is there.
You can also do a reload to get the
fresh data. That's all you will find. So
you can come back here and here you will
find the recent claims we have made. the
recent transaction which we have
performed because we have a process
timing which we are waiting for few
second. So that's what we have. So
that's how user can able to stick with
referral without referral and claim the
reward. Now I'll come back to the admin
account. I'm already connected with
admin account. So I will have the access
of this particular page and I can able
to change and call out this function. So
if I want to add more token as a reward
because that's what you have to do as an
admin. You have to fund the contracts so
the user can stick the token and they
can claim the reward. If you don't fund
the contract with enough token, the
transaction is going to fail. So if I
want to fund let's say 500 more token or
5,000 or 1 million, I can do that.
Whatever the supply you are dedicating
for the reward. So I simply click on
this add reward. Now click on this.
Click on confirm and the transaction is
happening. And finally we have added the
token into the contract. And this went
up. So you can keep adding token if you
want. If I want to change the rate of
interest, I can do that. I can come back
here. Not a rate of interest like rate
of reward. So I will simply copy this
entire one and if I want to go a little
higher I can come back here and I'm
going to bring down 1 Z and click on
this update rate and click on this click
on this confirm and the transaction is
happening. So we have successfully
increase the rate of rate but I want to
bring back to the same one. In that way
you will have more authenticity. So
let's bring it back and I can update it.
So you can update it at any time. So
click here click on confirm and have the
transaction happening. Now if you want
to withdraw the token from the contract
you can withdraw. So I'll simply click
here. I want to withdraw let's say 800
token I can withdraw that not 8,000 I
can say 800. Click on withdraw and the
transaction is happening. Click on this
confirm. Click on confirm and the
transaction is processed and we have
successfully withdraw the token. You can
see this got updated. This also got
updated. So that's how you can able to
make the claim. That's how you can able
to perform all the transaction as a user
as an admin. And so what I will do, I'll
simply come back here and go back to the
different account to show you the
transaction. So come back here to
account number one and I will give a
reload. I'll simply give a reload. And
here you will find that I'm not access
to the admin panel. That's why it's
giving me this one. I'll come back to
the dashboard. And I have the access of
the dashboard. And here you will find
the details that how many token I have
stake from this particular account. How
many reward I have earned so far, the
balance and all. That's what I will
find. Now you can see the unstick button
is visible for this particular one
because it's already been 24 hours for
this particular address. So what I will
do I'll simply click here and I can
simply withdraw all of my token all of
my 500 token I want to withdraw. So
let's click on this confirm unstake and
the transaction is in the process. Click
here click on this confirm and you will
find that transaction is completed and
you can see how much token you have
earned as of reward.
So if I come back here, if I go back to
my wallet, if I see the balance of the
token, so this is the one, but this will
go up 40 45 and we have this 29 token.
So I'll simply click on this and I'm
going to perform the transaction. So
let's click here, click on this confirm,
and the transaction is happening. And we
have successfully withdraw the token,
the claim, the reward. Now if I come
back here, click on my phantom wallet,
you can see this went up. So that's how
you can able to claim the reward. So
this looks fine. If you want to stake
more token from this account, you can
give that and you can simply call this
confirm
and it's going to perform the
transaction. Click here, click on
confirm and the transaction is
happening. So that's how user can able
to perform. And now I have to wait for
24 hours to unlock my token. And you can
see the token is available here. You can
see this went up and this went back to
zero. Got it? Now if I come back here
and you can see there is no referral
from this account. It's absolutely
empty. So if I come back here, go back
to the account number two. Click here
and I will give a reload.
I guess I have performed a couple of
transaction from this account. And you
can see it's going to fetch out all the
balance, all the transaction which I
have done. And here you will find that I
have performed two transaction means two
user have used this particular account
addresses and we have on the commission
on the commission. So I can easily able
to withdraw because right now the button
is visible. So I can simply click here
and I'm going to withdraw the 100 token.
Click on this confirm unstake and the
transaction is performing. Let's click
on this continue. Click on confirm and
the transaction is happening. And we
have successfully unstake our token. And
you can see the reward I have earned. I
can click on this and I will have the
token back into my wallet.
So finally I got the token back into my
wallet. So every single thing is looking
good right. You can see it's not
displaying because we have the process
timing. You can simply do one thing
reload the page and you will find the
data will be load successfully from the
local storage and here you got it stake
unstake all that's all will reflect fine
so I hope you have understood that what
are the feature functionality we have
included it's really powerful visa can
simply stake and g on the referral it's
really powerful now what I will do I'll
simply come back to my admin account and
I'm going to withdraw all the token
because after that I'm going to show you
the entire setup and deployment of the
contract so simply admin panel are here
I am you can see all the stats all the
details about the transaction which you
have performed and if you want to
withdraw the entire token you as an
admin will have the control so I'll
simply click here I can want to withdraw
the entire contract token click on
withdraw and here we are performed the
transaction let's click here click on
the confirm and the transaction is
happening and we have successfully
withdraw the complete token from the
contract
so that's what you can do you can see
all the transaction which you have
performed so it's such a powerful
application where you can allow user to
bring it together and you can add reward
system when they will st their token.
[snorts] So I hope you have understood
all the feature and functionality we
have included in this particular project
and it's super responsive for all the
screen sizes. So if I show you on the
mobile device you can see this is how
it's going to look from top to bottom.
We have a beautiful responsive model
where we displaying all the details. You
can see the navigation. You can open it
up. You can close it up. You can go back
to the desktop. You can see all the
details. Looks fine. You can go back to
that admin panel and here you will have
all the details about the transaction
which you are performing. Now let me
provide you all the assets which you
need to develop this particular project.
If you really want to foster the
development you can take the final
source code as well. So to get that
material you can come back to the
blockchain coder. I will also provide
the link in the description. So you can
click here and you can come back and
download the starter files. So come back
to the blockchain coder. Here you will
find all the project we have developed
on our channel. We have more than 100
plus project and even 30 to 40 project
we have related to Solana. So if you
really want to master solar development,
make sure to check it out. So come back
here, make sure to log in and come back
to the source code section. There you
will find all the project we have built
for different EVM compatible chain.
Whether you talk about EVM, there you
could talk about Solana or TON, we have
a different project. So to get the
assets, you can click here, go back to
the recent and here we have it. Click
here, it will come back to the final
source code section. And this is the
view which I'm recording. That's what
I'm going to attach here. So it's going
to be the final code setup as well. So
click on the starter file. It will take
you to the GitHub repository and here
you can able to understand the complete
architecture we have included in this
particular project. So it's a really
powerful you can able to understand that
what model we have what are the things
we have included. So it's it's there. So
make sure to clone the repository save
in your system. So when the complete
project will come you can simply start
developing straight away from the
starter file. Now let me show you that
how you can do the setup of the final
source code. So you can come back to the
the blockchain coder and make sure to
get the final source code if you want
and when you will take it you will give
your valuable contribution to my team to
bring more tutorial like that. So let me
take the code first. When you will take
the final source code you will get the
zip file. Make sure to extract the zip
file. Then you will get this folder in
which you will have the complete source
code of the project including the smart
contract and the contract workflow. So
every single thing you will find and
whatever you have seen in the demo
that's all you will have in this. So
make sure to install a zip extractor.
Then you can able to extract this file
and get this folder. And this is the one
we have to open in your VS code. So I'll
simply click on my VS code. I'll go back
to open. I'll go back to desktop. That's
where I have this folder. Select. Click
on open. Now let me give you a complete
walkthrough of the folder and file
structure we have included in this
project because this one is very
important. You have to understand the
structure. Then it will help you to
launch this project successfully and you
can able to do the setup. So without
making any changes straight away just
follow the way I'm doing it and do the
exact setup and test exactly the same
way. After that perform all the changes
and modification from your end in the
front end part. So the very first folder
we have in this particular project is
the app in which you will find all the
pages we have. So we have the admin
page. There we have all of this
component. You can see this red warning
I'm getting because I'm using a
different configuration and it's a typ
script project and I have a different
configuration in my printer. So it's not
a problem. It will work absolutely fine.
So this is my admin page. Then we have
the dashboard where user can able to
perform all the transaction. And we have
all the code. We have the global CSS.
I'm using Delvin CSS. And here I have
written my custom colors and the
branding. Just keep it as it is. Close
this one. And here we have the layout
and the pages. So just keep it as it is.
I'll tell you what are the changes you
have to do and where you have to do it.
Come back to the component in which you
will find all the different component.
We have built different pages. So we
have the dashboard. We have the button,
we have the card, we have the header, we
have the input field, we have the model,
we have the referral card, transaction,
user, dashboard. That's all you will
find. Just keep it as it is. Every
single thing, every single thing is
optimized and well dynamic. Close there.
Close this one. Come back to the
context. There you will find our website
provider. So we can easily able to
connect with different wallet. So all
the transaction which I have showed you
and the transaction which I'm going to
do now and the deployment of the
contract I'm going to do on the devet.
So all the setup I have done but it's
very easy to switch on the mainet as
well. So just keep it as it is first
test on the devet. Close this one. Come
back here. Now we have this contract and
in which you will find these two files
the contract and we have the workflow.
So first let me explain you the contract
then it will help you to understand the
entire workflow. So this is the entire
structure the entire code we have coded
for our smart contract which allow the
user to get the referral perform all the
staking calculation that's all we have
and it's a huge contract and it's fully
custom contract but not we are not using
any external libraries we are using the
stable version of token and their model
from the anchor SPL which is a very much
stable and all the token which you will
find on the Solana ecosystem are using
the same SPL model. So once you will
deploy your contract this will be
generated automatically. So here you
will find our state variable. So I want
to give 5% reward as a referral to the
user and here we have the base point and
here we have our decimal because we are
focusing on 9 decimal and that's the
standard token decimals we have on the
Solana chain and here you will have all
the function. So you don't need to make
any changes if you want to customize any
of the function based on your
requirement. First test the way it is
after that do all the modification. It's
very simple and very clearly explained
in this. Got it? Now I'll simply close
this one. Now come back to the contract
flow and here you can able to understand
the complete architecture we have
utilized in this particular project. So
you can able to find that how the
contract workflow would work. Here you
can see the base points all the function
and their execution model. The data we
are passing that's all you will find.
What are the function admin can call?
What are the data we are passing in a
particular function to initialize the
contract that's all you will find. So
make sure to have a look. It will help
you to understand the contract workflow
better. Got it? But I will show you how
you can perform the transaction from
start to end. Just wait. So this is the
contract. Now we have the library. So
once you will deploy the contract, you
will get the idle file and that's what
you have to provide which we're going to
get it together. Close this one. Come
back to the public in which you can keep
all the assets all the files of your
project. So I have kept this particular
images. So if you want to display your
image, you can simply change the image
but keep the name as it is. So it can
reflect in all the places we have used
it. Got it. Close this one. Close this
one. Come back to the style. We have the
style. Just keep it as it is. Come back
to the types. There you will find that
we have defined the types of the data
which we are interacting with. So just
keep it as it is. It's optimized for all
the types. Close this one. Close this
one. Come back to the utils. And we have
built couple of utility functions. So we
have the configuration for the
environment variable. That's all you'll
find. We have for the RPC endpoint.
[snorts] Here we have the connection
doing all the wallet configuration and
the RPC endpoint setup. So that's all
you can check. So I'm waiting for almost
60 second to get the confirmation from
the blockchain because sometime the
confirmation get delayed. So you have to
wait for at least 30 second to 40
second. If you come back to the helper
function, this is what I have. Just keep
it as it is. We have the program where
we have built all the logic and
interacting with the anchor model. So
which you can explore. If you come back
to the storage and all the transaction
history which you can see we're not
storing in the contract because if you
store that data in the contract is going
to consume more gas.
So we are storing in the local device in
the local system. So user can simply
have and have the details about the
transaction which we have done. So
that's what we have in the utility. Now
the most important thing which you have
to change and provide in the environment
variable. So let's come back here and
these are the variables which you have
to provide. You have to provide your
contract program ID. So once you will
deploy the contract you will get the
program ID and that's what you have to
provide. And here you have to provide
the token address and the reward address
which is going to be the same token.
Okay. And here you have to provide your
admin wallet address which you will use
for deploying the contract this
particular staking contract and which
you have used for creating your token
and that's what we have to provide here.
So I'm doing perform all the transaction
on the devet. Here you will find the
details. So you have to get your own API
key and I'm using tartum for getting the
RPC endpoint but you can use any other
provider but this one is really good and
it's very stable and it's free to get.
Here you have to provide the details
about your token. So I have called my
token multicurrency. I can provide your
supply description and you have to
provide your token logo. So you can
deploy your token anywhere and that's
the URL you have to provide or you can
use the pinata IPFS which is free to use
and you can simply get your URL link and
that's what you have to provide here. So
this is all the thing which you have to
do here. You have to provide your
variable and that's the only thing you
have to do. Let's close this one. We
have the get ignore keep it as it is.
Here we have this one. We have the next
config file. Just keep it as it is. So
we have the packages and file looks
fine. We have the post CSS looks good.
We have the readme looks fine. Don't
need to make any changes or you can
simply read about it. I have provided
couple of important information. So if
you want to deploy you can use
hostinger. You can check this
multicurrency tab also and other details
which you will find. We have the
tailwind config keep it as it is. We
have the txt JSON configuration. That's
all we have. So I hope you have
understood the complete folder and file
structure we have utilized in this
particular project and what are the
things which you have to change. So now
the very first thing you have to do is
you have to get your contract deployed.
Got it? This is the contract which you
have to deploy and I'm going to use
Solana playground which is online ID for
deploying my contract. I'll come back to
my browser. Click on the open tab and
here I can simply type Sana playground.
You should always search Solana
playground and don't use any link
because there are a couple of fake
Solana playground. If you connect with
those playground, they're going to drain
your fund. So make sure to search
Google, find the very first link, click
here and you will come back here. You
can see this is my current project which
I'm working. If you have any project,
absolutely fine. Just keep it as it is.
Now what I will do, let's create a new
project. I'll click here and let's call
this
staking
dab or you can call whatever you want.
Click on this anchor framework because
that's what I'm using. Click on this
create and it will create a fresh
project for you and it will give you
this demo contract which you can simply
select and remove. Remove it. Now you
can come back here, copy the entire
contract. Come and paste here and save
it. So we have got our contract and I'm
going to use my internal wallet for
Solana Playground. So this is the wallet
which I have. You can see this one WXD.
This is the wallet I'm going to use for
deploying and I have used the same
wallet for creating the token. So if I
show you my phantom wallet and you will
find that I'm connected with the account
number three. It has the same one. So I
have to get this token address
because this is the account number three
I have used for creating this token. So
I'll get this address first. Simply copy
that one. Come back to my environment
variable and that's what I have to
provide. So this is going token and
reward token. I got the two tokens. Now
I have to get the adins. I have used
account number three for deploying the
token and I'm going to use the same
account for deploying my staking
contract. So let's provide the address
here. Now I have to get my program ID.
So every single thing is good. I'm
connected with that account. Now let's
close this one. Save it. Come here.
Click on this build and it's going to
build your contract and it's going to
generate the idle file and ready for
deployment. So just wait. This might
takes a little bit time and sometime you
will get an error. So you can simply
reload the page and try to run the build
command one more time. You can see I'm
not having any issue. Every single thing
is working fine. We got the compile. Our
contract got compiled successfully and
if you come back here the moment you
will compile your contract this address
will change this address will change and
this is going to be your unique program
ID. So let's click on this deploy and
the transaction is happening. Soon the
transaction is going to be complete.
Here we are deploying it successfully.
Just wait and finally our transaction is
completed. You can click here. You can
come back to the Solana Explorer. There
you can able to see the transaction we
have performed. Every single thing is
looking good. And this is the program
ID. We got it. You can copy it from here
or you can come back here. You can copy
simply from here. Copy that one. Come
here. And that's what you have to
provide the reward and as a stake. This
is the admin address which I have used
for creating the token and deploying the
contract. Now I have to get my idle
file. So I'll simply come back here.
This is the old one. Simply delete this
one. Now I have to redownload my idle
file. So you will get this option. Let's
click here. Click on this export and it
will redownload your idle file. So I'll
simply come back here. Minimize this
one. I'm going to simply drag and drop
the idle file which I have downloaded.
So simply download here in the lip
folder and save it. I got my idle file.
Close this one. So what I have done, I
have deployed the contract. I've got
this variables so far so good. Now I
have to get one more thing which is the
API key of Tatum which we can get it
very easily. So I can come back here
open a new tab type
and it's a very powerful platform and
it's free to use which will help you to
give you the API endpoint. So I'll
simply come back here I'll log in
because I already have my account. So if
you don't have account create your
account, verify your account and then
log into your dashboard. So let me log
in quickly and finally I'm logged into
my dashboard. I can simply click this
one. Come back to the blockchain and
there you will find all the blockchains
which is available. You can use any
blockchain but we have to get it for
Solana. So I'll simply come here and try
to find the Solana. So this is the one I
have. If you click here, you can come
back here and all you have to do is to
simply get this one. This is my
obviously after this project I'm going
to delete this one. So you have to use
it. It's free to get it. Okay. So this
is the APK you have to copy and that's
what you have to provide here. So simply
provide here and [snorts] provide here.
So now we have got all the environment
variables [snorts] and if you don't have
your token you can simply nata. So let
me deploy it one more time for you. So
I'll simply come back here type pin nata
cloud. It's a really powerful platform
and it's free to use to store your data.
So make sure to login and verify your
account. Once you will do that you will
have the access of the dashboard. So let
me log in quickly. And finally I'm into
my dashboard. You can come back to the
files. Right now I don't have any files.
So if I want to add a file I can click
here. I can click on this upload. And
you can simply come back here and let's
I select this one and paste here and you
can call whatever you want. Click on
upload and here is going to upload your
file. So once it will be uploaded you
can able to copy the hash and this is
hash is going to be the unique
identifier for this particular project.
So all you have to do is simply come
back here remove this one and paste your
hash. Got it? Once you paste your ad,
you can come back, copy, come back, open
a new tab, and you can see your local
your token is stored on the
decentralized IPFS structure. There it
is. Got it? But I'm going to bring my my
old hash because that's the token I have
created. So this is how you can provide
your details. Once you're done with
that, that's the most important thing.
Now what we can do, we can come back
here and let's try to install the
packages. So first I'm going to open up
my terminal. Open it up. You can see I'm
on the main directory. The main
directory in which I have the complete
code. First you have to check your node
version. So right now you can see I'm
using this one. You have to use the same
node version because whatever packages
we have used in this project is very
much stable and very much compatible
with this. So no matter when you are
developing this project, it will work
absolutely fine. So use the same node
version. If I show you my npm version,
npm version, it is the same. So make
sure to check your system configuration
and use the exact node version. Got it?
Now I'll clear the terminal and I'm
going to install the packages. Simply
type npm I or install both will work
fine and hit enter. This might takes a
little bit time depending on your
internet speed, your system
configuration. Uh so just wait once the
installation will complete. We are ready
to launch our application and test. So I
waited for a few second and finally the
installation is got completed. You can
see we are getting this depreciated
depreciated. Don't need to worry about
it. We are focusing on stability and
that's the most important thing which
you have to focus. And here you can find
that we are getting couple of this
warning. Simply ignore that. It's not
that important. So now we have to simply
clear our terminal. Type clear. Hit
enter. And now we have to start our
application. So this is the command we
have to execute the dev one. Type npm
rundev. Hit enter. And it's going to
start the application on local 3000. So
just wait. Finally our server is ready.
Our application is loaded. The
environment variable is loaded. You can
simply copy this URL. Come back here.
Let me close all the open tabs. So this
one is this one and now let's open it
hub hit enter and you will find that our
application is started in our local
host. So just wait soon it's going to be
visible and you are ready to interact
and perform all the transaction. So
finally our application is live there
you will find all the details the data
we have provided the program ID address
as is there. First you have to connect
with your admin account and you have to
start the smart contract. So you can
come back to the desktop and once you
will connect your wallet. So I'm already
connected with admin account. If I show
you my account number three, this is the
account which I'm connected with. You
will find that currently every single
thing is zero. You can see your balance.
You can see this. You can see all of
this. Now you have to start the
contract. Right now you can see I'm
getting this data because this data is
coming from the local storage. So I can
first clear the data to show you that
this data is stored in the local
storage. Click here and reload the page
and you will find that every single
thing is empty. We don't have anything
in here. I'll click on this select click
on phantom wallet and I'm connected.
I'll come back to the admin account and
here you all of these details. So here
I'm getting this option called
initialize. So first you have to
initialize the smart contract. So I'll
simply click here initialize and here I
got it. So here you have to decide that
what rate of interest like what rate of
reward you want to provide to the user
based on seconds. So I'll go with
something
industry standard which is this. But you
can go a little down or a little up.
It's totally up to you. Now I can click
on this initialize pool and it's going
to start our smart contract. So all I
have to do is to simply click on this
confirm and the transaction is
happening. So you will get the
confirmation once the transaction will
complete. So it's taking a little bit
time and it's setting up all the
variables. So it's going to perform two
transaction. Let's click on this
confirm. And now your contract is
activated. First it will create the PDA
account and then it's going to activate
the contract and you will find every
single thing is displaying absolutely
fine. So your balance and there is no
token available. So once you initialize
after that you have to deposit the
reward token and you have to constantly
maintain or you can simply provide the
share which you have allotted for the
reward. So I'll simply come back here
and I want to provide let's say 1,000
token as a reward. I can click here and
it's going to perform the transaction.
So make sure to provide your contract
with enough reward token. So here you
will find is will start it. If you want
to update you can simply update or you
can simply do that. Simply call 001.
This rate of interest I want to provide
you can simply update and click on this
confirm and the transaction is
completed. You can see this changed. If
I want to bring back to the old one
because this is the industry standard
which we follow. I'll bring that same
one. Click on this and click on confirm.
success. If you want to simply get the
token and withdraw it, you can withdraw.
So I want to withdraw let's say 500
token. Click on this withdraw and I can
click on this confirm and the
transaction is completed and we have
withdraw the token. So you can able to
control all of the feature. You can come
back here. Right now you can see some we
have the process timing we have
included. So you can simply give a
reload to load the data from the local
environment. So you can see you have
this all of this initialize which is
called by the admin. You can see add
which you have added. That's all is
there. Got it? Now you can come back to
the action board and you can see all the
stats the every single thing is empty
because you haven't st the token. So
what I can do I can simply come back
here and I can stick the token. So what
I will do I going to make this account
number one as a referral. So simply copy
that one and that's what I can provide
here or I can simply give the quantity.
So I'll go with let's say 1,000 token
and click on this confirm and I'm
staking my token into the contract. So
let's click on this confirm and here the
transaction is completed. You will find
that we have to wait for 24 hours to
simply withdraw and call the onstake
token and claim our reward. Got it?
If you want to stake more token, you can
come back here and this time I want to
stake without.
So I want to give let's say 1 th00and
more token. Click on confirm and you can
simply click on this confirm and the
transaction is completed and you have
stake more token. Got it? So the token
we have sto is rare. So every single
thing is looking fine. You can see this
much reward you have earned during that
period. So I'll simply claim this reward
which I have earned. So let's click on
confirm and the transaction is completed
and you have withdraw the token.
initialize your referral program because
that's what you have to do first. You
have to initialize it. So if I click on
this initialize referral account is
going to call the function and it's
going to generate my unique referral
link and here I got it and I can share
with anyone who can use my referral link
and I will get the commission. So I'll
simply copy that one. Now I'll come back
here to account number one and reload
the page and you will find that here
we'll have all the options. I can simply
click on this referral if I want to
activate the referral for this one. So I
have to do that. So I'll simply come
back here click on this referral and it
will be started
and you will have the overall details
overall details. You can see last time
we used this account for as a referral
but it didn't work because we have to
initialize it first. So we have that log
system we have added. So I can come back
here. I can paste the URL and I can hit
enter and you will find that this
account is going to be set as a
referral. So I can simply come back
here, click on the stake and it will
take automatically. So when this user
will stake, let's say I want to st like
1,000 token. Click on this confirm and
the transaction is happening. Click on
this confirm and it will be staked
successfully. So we have st the token
into this. Looks fine. Now I can able to
withdraw but I have to wait for 24
hours. If I come back here, go back to
account number three. I will give a
reload. You will find. So right now you
can see this data is empty because when
the user this particular user going to
withdraw the token and claim the reward
only that time calculate commission and
transfer the referral amount. So now we
have to wait for 24 hours. So we have
successfully st our token and we have to
wait for 24 hours to claim our reward
and unstick the token. So when we
unstake the token at that time the
referral address will receive the
commission that's the logic we have
implemented. So if I come back here if I
go back here account number three and
give a quick reload you will find that
there's nothing in here at the moment.
So the moment user will unstake and
clstake the token after completing the
24 hours period then this commission
would be passed down to the user. So
every single thing is looking fine. So I
hope you have understood the complete
logic that what are the feature and
functionality we have included how our
entire application would work how the
smart contract we have featured. You can
also have a look in this details
workflow we have given help you to
understand in more detail. So that's the
complete project. So I hope you have
understood all the feature we have
included and how every single thing
would be working. So make sure to
rewatch the video to understand every
single logic. You can also check the
workflow to understand better. If you
want to get the final score make sure to
come and get it. It will f your
development. And if you really want to
master the complete blockchain
development then you can check this
particular boot camp in which you're
going to build industry ready project.
You're going to learn about the modern
technology all the tools and software
programming language which you have to
know to master complete blockchain
development. It's a 18 90 hours long
course. So make sure to watch this one.
So with that I'm end this video. I hope
you have understood every single thing.
If you have any more question do let me
know. I'll love to help you on that.
Have a wonderful Bye-bye.
Source Code: https://www.theblockchaincoders.com/sourceCode/create-and-deploy-solana-staking-with-referral-dapp-or-rust-+-anchor-smart-contract-next.js-typescript-or-full-project 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 Create & Deploy Solana Staking with Referral DApp | Rust + Anchor Smart Contract, Next.js, TypeScript | Full Project In this Solana Project, we’ll build and deploy a Staking DApp with a Referral System using Rust, Anchor, Next.js, and TypeScript. 💎 You’ll learn how to develop and integrate a complete on-chain staking mechanism on Solana, connect it to a modern web frontend, and implement a referral reward logic for users to earn extra tokens. 📌 Timestamps 00:00:00 ➤ Introduction 00:00:26 ➤ Overview 00:06:08 ➤ Features Demo 00:14:14 ➤ Mobile Support 00:14:38 ➤ Starter File 00:15:49 ➤ Final Source Code 00:23:05 ➤ Environment Variables 00:28:33 ➤ Installation 00:29:50 ➤ Testing Live 🔧 What You’ll Learn: Building Solana staking smart contracts with Rust + Anchor Integrating on-chain programs into Next.js frontend Creating a Referral reward system on Solana Wallet integration and transaction handling Full DApp deployment workflow 💡 Tech Stack: Rust • Anchor • Solana Web3.js • Next.js • TypeScript • Phantom Wallet 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_...