Loading video player...
This video I'll show you that how you
can design your entire data structure in
your salty smart contract. No matter
what project you have in your idea, what
kind of project you want to build for
your client. The most important thing
which you have to do at your initial
stage to build the proper architecture
for your smart contract for the variable
for the data flow which you want to
execute. So we have multiple layer in
the smart contract. One is for the
authentication. The second one is for
data validation. The third one is for
the proper execution of the font and the
last one we have is for the data
storage. So we have the proper hierarchy
which we have to follow in the smart
contract and based on those structure
based on those pattern we have to build
the entire system which we going to
implement in our smart contract. So
that's the very first thing you have to
focus as a smart contract developer
whatever project you are developing. So
right now you can see that I have this
particular smart contract for supply
chain management and we already built
this complete project on our channel. So
you can start falling straight away
after watching this video because this
will help you a lot to give you a idea
that how you can simply design the
entire structure because once you will
have your entire structure clearly it
will be very easy to include all those
validation all those data flow all those
fund transfer how you going to log the
fund in the contract and what kind of
validation you can do how you can do the
validation of the shipment closing
that's all you can able to monitor that
one so that's what we're going to
discuss in this so right now you can see
that this is the entire smart contract
which I have built as a workflow so we
can easily to understand that how the
data will flow what are the check we are
doing and what are the feature we are
providing to our user because there are
some feature which we have to keep it as
a admin and there are some feature we
have to provide to the user so they can
execute the transaction. So let's go
through that. So right now you can see
that here we have the start shipment
because what this smart contract will do
it will allow the user to create the
shipment and we're going to store all of
the shipment data from party one to
party two and when the user will create
the shipment we're going to take the
fund which we going to simply transfer
to the receiver after the shipment will
get complete. So whatever model we
follow in a centralized system we want
to go through the decentralized model.
So right now you will find that we have
this create shipment. So we have to
provide the date then we have to provide
the receiver that who going to receive
this particular project we have to
provide the details about the product
that what kind of product it is what
kind of good it's carrying what is the
weight what is the dimension we have to
provide all of this data so that's the
very first entry point we have for our
product when the user will create the
shipment that's the first thing this is
very basic user can come and they can
create that now we have to go back to
the payment validation because this
particular shipment will require the
payment because as soon as the user will
create the shipment and based on the
money based on the goods which you try
to ship and that's what we are charging
to the creator of the shipment. So we
have to validate the payment and we have
to store this payment into our smart
contract. So when this particular
shipment will complete we're going to
simply give the money back to the
receiver. So that's what we have. So you
will find the next flow we have is the
payment correct. So the payment record
we going to store in the smart contract
and if anything goes wrong like maybe
the user cannot have enough fund in the
wallet to provide the payment based on
the good value. So we're going to throw
an error. So this is the logic we have
to build. First what we have done we
have taken all the data then we have
moved to the payment detail section
whether this good going to carry any
payment. If yes then we have to do two
different check. We have to allow the
user to create the payment and that
payment is going to be associated with
this particular service the good and if
anything goes wrong we have to throw the
error message and we have to give back
to the user that there is some problem
related to the fund or you don't have
insufficient fund if every single thing
is good after that we have to go back to
the next stage is event and event is
really powerful concept in solid smart
contract development because when you
want to get the data so sometime what
happen that it's very cost effective so
if you want to store the data on the
chain and you want to minimize the cost
for the interaction with the smart
contract or deployment. You can use the
event and you can able to have the data.
So you don't need to make a lot of calls
to a smart contract. Whenever the
trigger will happen, you will have the
data in your event. So you can access
the data based on that. After that you
can simply create the shipment and you
will display the initial status of the
shipment because by default when the
shipment is going to create is going to
be in pending. So this pending shipment
can be verified with multiple players.
You can include all those check but we
are going with a simple check that once
the payment is getting created once the
pay on the payment is done we are
creating the shipment and we are storing
the information the smart contract as a
pending. So this is the first workflow
first workflow. Now come back to the
second workflow in which we have to
provide we have to allow the user to
perform action on those shipment. So
that's what we have here to start the
shipment. What we have to do is to
validate the data. Whatever the data was
provided during the creation, the same
data we have to do the validation then
we can take to the next stage. So that's
what we are doing validating the
address. If anything's wrong with the
validation we throw the error but if
it's good the address provided by the
user is good then we going to the next
stage which is the pending stage. And
there we are allowing user to perform
the transaction and change the stage.
And here I have taken two different
possibilities. One the transaction can
be executed and the state of the product
would be changed whether it's a pending
transmit or deliver these are the three
option you have but you can have
multiple layer depending on the kind of
organization and the product you are
providing. What we are doing here we are
simply transmitting the product means
the product is out of the warehouse. So
that's what we are updating the status
so it will be display on the chain and
in the application so user can know that
it's delivered and then we are simply
starting the event. So like the data
will flow in the smart contract. After
that we are changing the status. So this
is how we are managing the shipment
based on the status and we are
triggering the event and we are throwing
the message. So what we are doing we are
doing the validation we then we are
checking for the error. If every single
thing is good then we are going to the
next state allowing user to change the
status and then we are storing the
information in the contract on the
chain. After that come back to the
complete shipment again we have to do
the validation. Then we have to check
for the delivery that what is the time
expected time was allotted for the
product to deliver. If anything goes
wrong, we are doing the validation once
again that whether it's a transmit or
whether it's in the it's in the pending.
Based on that, we have to check that
whether this product is ready for
deliver or not. If is every single thing
is good then we have to make it deliver
and then it will go to the next stage
and there we are looking for the
payment. So if this particular product
the shipment is in the payment because
the payment can be initial or it can be
delay. You cannot hardcode the payment
amount at the initial but you can do
that because right now most of the
product which you will find at the
moment which deal with the supply chain
management they have this payment model
as well. So you can check whether it's
for payment or not who is receiving the
fund because the receiver can receive
the fund or it can someone else who can
receive the fund which address you want
to transfer the fund. So there we have
to do the transaction of the payment
from the contract to that particular
void address and it will give us the
detail as soon as we done with the
payment automatically is going to change
the status to deliver and it will be
display and this status would be changed
and it will display in the front end
that this particular address has
received the fund received the product
and it's to deliver and that's how the
entire life cycle of the shipment will
happen. So this one is a really powerful
project. Again I would suggest you that
if you haven't built, make sure to
follow it. This will help you to
understand that how the workflow of the
data is happening in decentralized
ecosystem. When it's come to supply
chain management, how you can able to
trigger the event, how you can able to
keep all those information, how you can
deal with the payment, how you can deal
with the non non-payment good items. So
that's all you will understand. So it's
a very important project for you to
include and this is what you have to do
before you write your first piece of
code. try to build the architecture
because this will give you the proper
idea. This will give you the
understanding that what are the
possibility you can take into your smart
contract. Here I have given you the few
examples but you can do a lot of
validation. You can do a lot of check
you can add multiple breakpoint within
the contract that's all possible. It's
very important for you to have a very
good understanding of the smart contract
development especially when you are
building for EVM compatible chain. So
solidity is must solidity is must and if
you really want to master complete
blockchain development then must check
this particular boot camp in which you
will learn programming language but you
will build one of the industry ready
project where you're going to learn
about the security in the smart contract
in the front end on the protocol side in
the component that's all you will learn
to build a secure model and provide all
the feature to your client to your user.
So this one is really very important I
must tell you to have a look and try to
understand that what exactly the flow is
happening. So that's the only thing I
want to cover in this video. If you have
any question, any doubt, let me know in
the comment section. I'll definitely try
to help in that. Have a wonderful day.
Complete Project: https://youtu.be/gYL5-Axm_RU?si=M0v2T5YO4CM8PZjC Blockchain Course: https://www.theblockchaincoders.com/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 Solidity Smart Contract System Design & Data Structures | Solidity Mastery In this Solidity Mastery session, you’ll learn how to design scalable, secure, and gas-optimized smart contract systems using the right data structures and architecture patterns in Solidity. This video goes beyond basic syntax and focuses on real-world system design used in production-grade Web3 applications. You’ll understand how to choose the correct data structures (mappings, arrays, structs, enums) and how they impact performance, storage, security, and upgradeability. This is essential knowledge for Blockchain Developers, Smart Contract Engineers, and Web3 Architects aiming to build complex decentralized applications. What you’ll learn: Smart contract system design principles Choosing the right Solidity data structures Storage vs memory vs calldata (gas implications) Designing scalable & maintainable contracts Common design mistakes and how to avoid them Real-world use cases & best practices This video is perfect for developers who want to move from writing contracts to designing robust blockchain systems. 🚀 Level up your Solidity skills and master smart contract architecture. #Solidity #SmartContractDesign #BlockchainDevelopment #Web3 #Ethereum #SolidityMastery 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_...