<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: ADESANYA JOSHUA AYODEJI</title>
    <description>The latest articles on DEV Community by ADESANYA JOSHUA AYODEJI (@josh4324).</description>
    <link>https://dev.to/josh4324</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F317112%2Fe3a05457-6d8e-4561-af2c-318e9d103cce.jpeg</url>
      <title>DEV Community: ADESANYA JOSHUA AYODEJI</title>
      <link>https://dev.to/josh4324</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/josh4324"/>
    <language>en</language>
    <item>
      <title>Web3 and DAOs: Empowering Individuals and Disrupting Traditional Structures</title>
      <dc:creator>ADESANYA JOSHUA AYODEJI</dc:creator>
      <pubDate>Tue, 13 Jun 2023 10:25:48 +0000</pubDate>
      <link>https://dev.to/josh4324/web3-and-daos-empowering-individuals-and-disrupting-traditional-structures-1ho6</link>
      <guid>https://dev.to/josh4324/web3-and-daos-empowering-individuals-and-disrupting-traditional-structures-1ho6</guid>
      <description>&lt;p&gt;Traditional organizational structures have slowed down decision-making and killed innovation over the years. The world needs a system where individuals and communities can collaborate and make decisions in a decentralized way. DAOs and Web3 help us rethink governance, technology, and collaboration.&lt;/p&gt;

&lt;p&gt;Web3 builds upon the internet as we know it but adds the concept of decentralization, and this gives the user ownership and control. The implication of this control can be felt in governance, social networks, finance, and more.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Decentralized autonomous organization&lt;/strong&gt; (DAO)s present an alternative to traditional organizational structure and governance models, and it embodies the principle of decentralization and autonomy. It enables individuals to collaborate, coordinate and make decisions as an organization.&lt;/p&gt;

&lt;p&gt;In this article, we will delve into the concepts of Web3 and DAOs, exploring how they work, their potential applications, the implications they have for various industries, the benefits, the challenges, and how they shape the future of technology and governance. &lt;/p&gt;

&lt;h2&gt;
  
  
  DAOs and Web3
&lt;/h2&gt;

&lt;p&gt;DAOs (Decentralized Autonomous Organizations) are innovative entities that operate on the principles of blockchain technology and play a significant role in the context of Web3.&lt;/p&gt;

&lt;p&gt;DAOs and Web3 have a symbiotic relationship. DAOs use the underlying technology of Web3, which makes use of a smart contract to program how the DAO will run in a decentralized and autonomous way and plays a crucial role in enabling the automation and transparency of DAO operations.&lt;/p&gt;

&lt;p&gt;The combination opens up a lot of opportunities and enables collaboration and coordination among individuals from anywhere in the world, allowing the pooling of resources, talent, and ideas.&lt;/p&gt;

&lt;p&gt;DAOs can be formed for various reasons, including funding, governance, decentralized applications, and investment management. Individuals can contribute their skills and expertise and be rewarded for their contributions. It thrives on community engagement as everyone has a stake in the organization and is involved in shaping its direction and future. The decentralized nature of DAOs promotes transparency, accountability, and collective ownership.&lt;/p&gt;

&lt;p&gt;DAOs and Web3 enables the following:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Decentralized Governance&lt;/strong&gt;: DAOs redistribute power and decision-making authority from centralized authorities to their members, fostering a decentralized governance model. Through collective voting mechanisms, participants actively contribute to the organization's operations, policies, and resource allocation. This inclusive approach promotes fairness, accountability, and empowers individuals to actively shape the organization's trajectory.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Transparency&lt;/strong&gt;: DAOs utilize blockchain technology to establish an immutable and transparent ledger that records all transactions and governance activities. By leveraging the blockchain, DAOs ensure that every interaction and decision is securely documented, enabling audits and traceability. This transparency fosters trust among participants by making the actions of the DAO visible to all, reducing the risks of fraud and manipulation. Furthermore, stakeholders can assess the organization's performance and evaluate its impact through a transparent record of activities.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Autonomous Decision-Making&lt;/strong&gt;: DAOs employ smart contracts, which are self-executing agreements coded on the blockchain. These smart contracts enforce predefined rules and conditions, allowing for the automation of certain decision-making processes. Once the conditions are met, the smart contracts autonomously execute the associated actions. This autonomous decision-making removes the need for intermediaries and ensures that decisions are implemented consistently and without bias.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tokenized Ownership&lt;/strong&gt;: DAOs often utilize tokens to represent ownership and participation rights within the organization. These tokens grant holders voting power and influence over the DAO's decisions. Tokenized ownership aligns incentives among participants, as their stake in the organization is directly tied to their influence and rewards. This ownership model fosters a sense of community and shared responsibility, as participants have a stake in the success and development of the DAO.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Meritocracy and Expertise&lt;/strong&gt;: DAOs provide a platform where contributions and decision-making authority are based on merit and expertise rather than hierarchical positions. Participants can earn influence and reputation within the DAO by contributing valuable ideas, skills, or resources. This meritocratic approach allows DAOs to tap into a global talent pool, fostering innovation and ensuring that decisions are made by those with relevant knowledge and expertise.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Flexibility and Adaptability&lt;/strong&gt;: DAOs can be flexible and adaptable, allowing for rapid decision-making and organizational changes. Through decentralized governance and autonomous decision-making, DAOs can respond quickly to evolving circumstances, emerging opportunities, and community feedback. This flexibility enables DAOs to adjust their strategies, resource allocation, and priorities promptly, ensuring they remain agile and aligned with the needs and aspirations of their community.&lt;/p&gt;

&lt;h2&gt;
  
  
  Benefits of DAOs and Web3
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Security&lt;/strong&gt;: DAOs and Web3 utilize blockchain technology which guarantees the security of the system and makes it more secure than traditional organizations.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Transparency&lt;/strong&gt;: All information is recorded and accessible to every member of the DAO, it is also easy to track the DAO spending, voting, and all information stored in the organization.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;User-Ownership&lt;/strong&gt;: The DAO is owned by every member of the organization, what differs is the stake of the users in the DAO, most DAOs use tokens or NFTs to represent ownership, and the amount of the token or NFT determines the stake of the user in the DAO. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Collaboration and Innovation&lt;/strong&gt;: It is easy for people to collaborate on projects in DAOs, as there are no unnecessary ranks and limitations. This leads to new ideas and innovation. &lt;/p&gt;

&lt;h2&gt;
  
  
  Application of DAOs and Web3
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Investment and Venture Capital&lt;/strong&gt;: DAOs enable decentralized investment and venture capital funds, where members pool their resources and collectively decide on investment opportunities. This democratizes access to funding, promotes diverse investment strategies, and eliminates the need for traditional intermediaries.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Decentralized Finance (DeFi)&lt;/strong&gt;: DAOs play a significant role in the rapidly growing field of decentralized finance. They are utilized to govern protocols, determine interest rates, manage lending and borrowing activities, and provide liquidity through decentralized exchanges and liquidity pools. DAOs in DeFi enhance transparency, trust, and community participation in financial operations.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tokenized Communities&lt;/strong&gt;: DAOs can be used to create tokenized communities where individuals hold tokens representing their membership and participation rights. These communities leverage DAOs to coordinate resources, make collective decisions, and incentivize active engagement. Tokenized communities can span various sectors, such as art, gaming, content creation, and social impact initiatives.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Decentralized Social Networks&lt;/strong&gt;: DAOs can be employed to create decentralized social networks where users have control over their data, privacy, and platform governance. DAOs in social networks empower users to collectively decide on platform policies, content moderation, and revenue sharing, creating a more user-centric and transparent social media experience.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Non-Profit Organizations and Social Impact&lt;/strong&gt;: DAOs have the potential to revolutionize the way non-profit organizations operate by providing transparent governance, traceability of funds, and increased community participation. DAOs enable stakeholders to collectively fund and govern social impact initiatives, improving transparency, accountability, and efficiency in the allocation of resources.&lt;/p&gt;

&lt;h2&gt;
  
  
  Challenges of DAOs and Web3
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Regulatory Uncertainty&lt;/strong&gt;: The regulatory landscape surrounding DAOs and Web3 is still evolving. Different jurisdictions have varying regulations and legal frameworks, which can pose challenges for DAOs operating across borders. Uncertainty in regulatory compliance and the potential for new regulations to impact DAOs' operations and tokenized assets present ongoing challenges.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Scalability and Performance&lt;/strong&gt;: Scalability remains a significant challenge for blockchain networks, including those supporting DAOs. As DAOs grow in membership and activity, blockchain networks must handle increased transaction volumes without sacrificing speed, security, or cost efficiency. Scaling solutions such as layer 2 protocols and sharding are being developed to address these challenges.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Governance and Decision-Making Complexity&lt;/strong&gt;: While DAOs aim to enable decentralized decision-making, effectively managing governance processes can be complex. Ensuring meaningful participation, preventing voter apathy, and reaching a consensus on contentious issues can be challenging in large and diverse communities. Developing effective governance models and decision-making mechanisms that balance inclusivity and efficiency is an ongoing challenge.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;User Experience and Adoption&lt;/strong&gt;: Improving user experience and onboarding processes is crucial for the wider adoption of Web3 applications and DAOs. Overcoming technical barriers, such as the complexity of wallet management and interacting with decentralized applications (dApps), is essential to attract mainstream users who may not be familiar with blockchain technology.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Token Economics and Governance Token Valuation&lt;/strong&gt;: Designing token economics that aligns incentives, distributes rewards fairly, and encourages participation can be challenging. Determining the value of governance tokens and their impact on decision-making within DAOs is an ongoing consideration. Balancing the interests of token holders, participants, and the overall community is crucial for long-term sustainability.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Education and Awareness&lt;/strong&gt;: Educating users, developers, and stakeholders about the benefits and potential risks of DAOs and Web3 is crucial for broader adoption. Raising awareness about the advantages, functionality, and best practices in decentralized governance helps address misconceptions and build trust in these emerging technologies.&lt;/p&gt;

&lt;h2&gt;
  
  
  Examples of DAOs
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;MakerDAO&lt;/strong&gt;: MakerDAO is one of the most well-known DAOs in the cryptocurrency industry. It is responsible for governing the Maker Protocol, which enables the creation of the stablecoin Dai. MakerDAO's community members participate in voting and decision-making processes that determine the parameters and policies of the protocol, including collateral types and stability fees.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;GnosisDAO&lt;/strong&gt;: GnosisDAO is a decentralized autonomous organization that focuses on prediction markets and decentralized applications (dApps). It aims to create a community-driven ecosystem for forecasting and decision-making. GnosisDAO members participate in governance and decision-making processes related to the development and management of the Gnosis Protocol and other related projects.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Curve Finance&lt;/strong&gt;: Curve Finance is a decentralized exchange (DEX) optimized for stablecoin trading. It operates as a DAO, allowing participants to provide liquidity, vote on governance proposals, and collectively manage the platform's parameters and operations. Curve Finance focuses on low-slippage and low-fee stablecoin swaps.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Gitcoin&lt;/strong&gt;: Gitcoin is a platform that connects developers and contributors to open-source projects. It leverages a DAO model to govern funding and resource allocation for projects. Participants can contribute to the development of projects and receive rewards based on their contributions. Gitcoin aims to foster open-source collaboration and incentivize innovation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Aavegotchi&lt;/strong&gt;: Aavegotchi is a decentralized application that combines DeFi and non-fungible tokens (NFTs). It operates as a DAO and allows participants to stake tokens and participate in governance decisions related to the platform's development and features. Aavegotchi focuses on creating unique and tradable NFT-based virtual pets.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In conclusion, DAOs and Web3 are changing how organizations work by using blockchain technology and decentralization. DAOs enable transparent decision-making and inclusive governance. &lt;/p&gt;

&lt;p&gt;DAOs give power to members, allowing them to make collective decisions on operations and resources. This decentralized governance promotes fairness and accountability.&lt;/p&gt;

&lt;p&gt;Despite challenges, DAOs and Web3 can create sustainable and inclusive economies. They empower individuals, promote transparency, and encourage collaboration. As adoption grows, we can expect more advancements.&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.forbes.com/sites/forbesfinancecouncil/2022/10/14/the-state-of-daos-and-what-that-can-mean-for-web3/?sh=542992817f37"&gt;Forbes&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://consensys.net/blog/blockchain-explained/what-is-a-dao-and-how-do-they-work/"&gt;Consensys&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://cointelegraph.com/explained/what-is-the-role-of-a-decentralized-autonomous-organization-in-web3"&gt;Cointelegraph&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.investopedia.com/tech/what-dao/"&gt;Investopedia&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://Ethereum.org"&gt;Ethereum.org&lt;/a&gt;&lt;/p&gt;

</description>
      <category>web3</category>
      <category>dao</category>
      <category>blockchain</category>
    </item>
    <item>
      <title>Hashing in Blockchain Technology: How it Ensures Data Integrity</title>
      <dc:creator>ADESANYA JOSHUA AYODEJI</dc:creator>
      <pubDate>Sat, 11 Feb 2023 10:19:30 +0000</pubDate>
      <link>https://dev.to/josh4324/hashing-in-blockchain-technology-how-it-ensures-data-integrity-3fad</link>
      <guid>https://dev.to/josh4324/hashing-in-blockchain-technology-how-it-ensures-data-integrity-3fad</guid>
      <description>&lt;p&gt;Hashing is a fundamental concept in cryptography widely used in various technologies, including password storage, data integrity, digital signatures, and blockchain. Hashing is used in blockchain to ensure the integrity and security of data stored in the chain. &lt;/p&gt;

&lt;p&gt;This article will look at the concept of hashing and how it is used to ensure data integrity in blockchain technology.&lt;/p&gt;

&lt;h2&gt;
  
  
  Blockchain Technology
&lt;/h2&gt;

&lt;p&gt;Blockchain technology is a distributed digital ledger that is decentralized and used to record transactions across multiple computers. It is a safe and transparent method of storing and sharing data across a network.&lt;/p&gt;

&lt;p&gt;A blockchain is a chain of blocks, each of which has a list of transactions. These transactions can be anything from financial transactions to digital contracts to simple messages. The blocks in the chain are cryptographically linked to one another, resulting in a secure and unchangeable record of all transactions.&lt;/p&gt;

&lt;p&gt;Decentralization is another important aspect of blockchain technology. In contrast to traditional centralized systems, where a single entity controls and manages the data, the data in a blockchain network is stored and maintained by multiple entities known as nodes. Because of this decentralized architecture, blockchain networks are extremely resistant to tampering, fraud, and hacking.&lt;/p&gt;

&lt;p&gt;Blockchain technology is also highly transparent, as all network transactions are public, and every node has a full blockchain copy. This transparency ensures that all network transactions are traceable and auditable.&lt;/p&gt;

&lt;p&gt;Many possible applications for blockchain technology exist, including financial transactions, supply chain management, digital identity, and many others. Blockchain technology is still in its early stages, and many organisations and businesses are looking for ways to use it to better their operations and services.&lt;/p&gt;

&lt;h2&gt;
  
  
  Hashing
&lt;/h2&gt;

&lt;p&gt;Hashing converts a string of characters into a fixed-size output for security purposes. Although the phrases hashing and encryption are frequently used interchangeably, hashing is always used for one-way encryption, and hashed values are extremely difficult to decode. &lt;/p&gt;

&lt;p&gt;It is difficult to reverse the hashing process and retrieve the original input from the hash because it is deterministic in nature.&lt;/p&gt;

&lt;p&gt;Hashing algorithms are mathematical functions that take an input and produce a hash, which is a fixed-length output. &lt;/p&gt;

&lt;p&gt;For instance, in password storage, the password is hashed before being saved in the database, preventing an attacker from discovering the original password even if they have access to the database.&lt;/p&gt;

&lt;h2&gt;
  
  
  Hashing in Blockchain Technology
&lt;/h2&gt;

&lt;p&gt;In blockchain technology, hashing is used to ensure the integrity of data stored in the chain. Each block in the blockchain contains a unique hash that is generated from the contents of the block. The hash of a block is generated by applying a hash function to the contents of the block, which includes the list of transactions, the hash of the previous block, and a random number known as a 'nonce'.&lt;/p&gt;

&lt;p&gt;Since the hash is generated from the contents of the block, any change to the data in the block will result in a different hash being generated. This means that if someone tries to tamper with the data in a block, the hash of the block will no longer match the one stored in the chain, and the network will reject the tampered block.&lt;/p&gt;

&lt;p&gt;Linking each block's hash to the previous block's hash creates a chain of blocks that is extremely difficult to change. Because each block in the chain contains the previous block's hash, any change to a block in the chain will affect all subsequent blocks, and the network will reject the entire chain.&lt;/p&gt;

&lt;p&gt;Furthermore, using a nonce in the hash function gives an extra layer of protection. A nonce is a random number that is used in the hash calculation. If a malicious actor attempts to change the contents of a block to generate a new valid hash, they must also find a new nonce that produces the same hash. This computationally demanding task would necessitate a substantial amount of computational power.&lt;/p&gt;

&lt;h2&gt;
  
  
  Data Integrity
&lt;/h2&gt;

&lt;p&gt;Data integrity refers to the accuracy and completeness of data over its entire lifecycle. It ensures that data is not tampered with, altered, or corrupted and remains consistent and reliable.&lt;/p&gt;

&lt;p&gt;In the context of blockchain technology, data integrity is achieved through the use of cryptographic hashing. Each block in the blockchain contains a unique hash that is generated from the contents of the block. The hash of a block is used to ensure that the data in the block has not been tampered with, and any change to the data will result in a different hash being generated.&lt;/p&gt;

&lt;p&gt;In a blockchain network, every node has a copy of the entire blockchain, and all transactions are publicly visible. This transparency ensures that all transactions on the network are verifiable and auditable, further enhancing the data integrity of the blockchain network.&lt;/p&gt;

&lt;p&gt;Data integrity is a crucial aspect of blockchain technology. Using cryptographic hashing and linking each block to the previous block ensures that data in the blockchain is accurate, consistent, and reliable and cannot be tampered with. &lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Hashing is a crucial component of blockchain technology that ensures the integrity and security of data stored in the chain. The use of hashing in blockchain technology ensures that data in the chain cannot be tampered with and that each modification to the data results in a different hash is created. &lt;/p&gt;

&lt;p&gt;Furthermore, the use of a nonce in the hash function, as well as the linking of the hash of each block to the hash of the previous block, results in a chain of blocks that is extremely difficult to change. The notion of hashing is also applied in other emerging technologies, such as distributed file systems and distributed databases, demonstrating its adaptability in ensuring data integrity in a decentralized setting.&lt;/p&gt;

&lt;p&gt;I hope you found this article useful.&lt;/p&gt;

&lt;p&gt;Thank you for reading.&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.investopedia.com/terms/h/hash.asp" rel="noopener noreferrer"&gt;What Is a Hash? Hash Functions and Cryptocurrency Mining&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.educative.io/answers/what-is-hashing" rel="noopener noreferrer"&gt;What is hashing?&lt;/a&gt;&lt;br&gt;
&lt;a href="https://builtin.com/cybersecurity/what-is-hashing" rel="noopener noreferrer"&gt;What Is Hashing? A Guide With Examples.&lt;/a&gt;&lt;/p&gt;

</description>
      <category>career</category>
      <category>interview</category>
      <category>howto</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Building a FileStorage Application using Xata, Cloudinary, and NextJs.</title>
      <dc:creator>ADESANYA JOSHUA AYODEJI</dc:creator>
      <pubDate>Wed, 23 Nov 2022 07:26:53 +0000</pubDate>
      <link>https://dev.to/hackmamba/building-a-filestorage-application-using-xata-cloudinary-and-nextjs-4214</link>
      <guid>https://dev.to/hackmamba/building-a-filestorage-application-using-xata-cloudinary-and-nextjs-4214</guid>
      <description>&lt;p&gt;Storing files became necessary due to the ease with which pictures, videos, and other files can be generated; the smartphone era played a significant role in this; people want to save their memories so that they can always refer back to them in the future.&lt;/p&gt;

&lt;p&gt;This article explains how to build a file storage application in Next.js, using Xata to provide the database service and Cloudinary to store the files.&lt;/p&gt;

&lt;h2&gt;
  
  
  Check out the Live demo of the application we will create.
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fpaper-attachments.dropboxusercontent.com%2Fs_53D394CA9EC8054C4D57206D6F81F4051344F365ABEA51B6BCB0963F87164624_1667211091635_clouddrop.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fpaper-attachments.dropboxusercontent.com%2Fs_53D394CA9EC8054C4D57206D6F81F4051344F365ABEA51B6BCB0963F87164624_1667211091635_clouddrop.png" alt="Demo Picture"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://clouddrop.netlify.app/" rel="noopener noreferrer"&gt;Demo&lt;/a&gt; | &lt;a href="https://github.com/Josh4324/CloudDrop" rel="noopener noreferrer"&gt;Code&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisite
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;You should have a basic understanding of Javascript&lt;/li&gt;
&lt;li&gt;You should have a basic knowledge of React Js and Next Js.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Tech Stack
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://nextjs.org/" rel="noopener noreferrer"&gt;NextJs&lt;/a&gt; is a React framework that builds on the functionality of React Js, it simplifies the creation of pages and API endpoints.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://cloudinary.com/home-102622?utm_source=hackmamba&amp;amp;utm_campaign=hackmamba-hackathon&amp;amp;utm_medium=hackmamba-blog" rel="noopener noreferrer"&gt;Cloudinary&lt;/a&gt; is a cloud media platform that allows users to upload files easily.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://xata.io/?utm_source=hackmamba&amp;amp;utm_campaign=hackmamba-hackathon&amp;amp;utm_medium=hackmamba-blog" rel="noopener noreferrer"&gt;Xata&lt;/a&gt; is a serverless data platform that allows users to store data, search for data and get insights into the data.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Table of Contents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Project Setup and Installation

&lt;ul&gt;
&lt;li&gt;Next Js pages setup&lt;/li&gt;
&lt;li&gt;Creating database and tables on Xata&lt;/li&gt;
&lt;li&gt;Cloudinary&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Connecting Cloudinary to the application&lt;/li&gt;

&lt;li&gt;Connecting Xata to the application&lt;/li&gt;

&lt;li&gt;Conclusion&lt;/li&gt;

&lt;/ul&gt;

&lt;h2&gt;
  
  
  Project Setup and Installation
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;NEXT JS PAGES SETUP&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To begin, we'll create a new Next.js app, launch our terminal, create a new empty directory and execute the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    npx create-next-app@latest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Make sure you are in the correct directory and install the dependencies using a package manager like &lt;code&gt;npm&lt;/code&gt;, &lt;code&gt;yarn&lt;/code&gt;, or &lt;code&gt;pnpm&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    npm i bcryptjs react-notifications 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;Create skeleton pages for the application&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We will create the necessary pages needed for the application with the code below, we will create the following pages.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Index.js&lt;/li&gt;
&lt;li&gt;all.js&lt;/li&gt;
&lt;li&gt;files.js&lt;/li&gt;
&lt;li&gt;photos.js&lt;/li&gt;
&lt;li&gt;videos.js&lt;/li&gt;
&lt;li&gt;login.js&lt;/li&gt;
&lt;li&gt;signup.js&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;styles/global.css&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;



&lt;p&gt;Global css for all the pages.&lt;/p&gt;

&lt;p&gt;styles/Home.module.css&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;components/Sidebar.module.css&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;CSS for the sidebar components.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;pages/_document.js&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;We used the &lt;strong&gt;_document.js&lt;/strong&gt; file to add font to our application.&lt;/p&gt;

&lt;p&gt;components/Sidebar.js&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;The Sidebar component is used for switching between pages, and it is used on all the pages.&lt;/p&gt;

&lt;p&gt;pages/index.js&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;The index page allows users to upload their files and view recently uploaded files.&lt;/p&gt;

&lt;p&gt;pages/all.js&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;The &lt;strong&gt;all.js&lt;/strong&gt; page is where users can view all their files.&lt;/p&gt;

&lt;p&gt;pages/files.js&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;The &lt;strong&gt;files.js&lt;/strong&gt; page is where users can view their documents such as pdf, word document, excel documents and others.&lt;/p&gt;

&lt;p&gt;pages/photos.js&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;The photos page is where users can view all their pictures.&lt;/p&gt;

&lt;p&gt;pages/videos.js&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;The videos page is where users can view all their videos.&lt;/p&gt;

&lt;p&gt;pages/login.js&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;The login page is the access page to the application, and only authenticated users can access the application.&lt;/p&gt;

&lt;p&gt;pages/signup.js&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;The signup page is where the users register to access the application.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CREATING DATABASE AND TABLES ON XATA&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We need to log into xata.io to be able to create a database and add tables to the database.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fpaper-attachments.dropboxusercontent.com%2Fs_53D394CA9EC8054C4D57206D6F81F4051344F365ABEA51B6BCB0963F87164624_1667224838355_xata.png-mh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fpaper-attachments.dropboxusercontent.com%2Fs_53D394CA9EC8054C4D57206D6F81F4051344F365ABEA51B6BCB0963F87164624_1667224838355_xata.png-mh.png" alt="Paper8"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Sign in with GitHub or Google Mail or  personal email.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fpaper-attachments.dropboxusercontent.com%2Fs_53D394CA9EC8054C4D57206D6F81F4051344F365ABEA51B6BCB0963F87164624_1667225035066_xata2.png-mh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fpaper-attachments.dropboxusercontent.com%2Fs_53D394CA9EC8054C4D57206D6F81F4051344F365ABEA51B6BCB0963F87164624_1667225035066_xata2.png-mh.png" alt="Paper9"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Add a workspace; we can do this by entering the workspace name.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fpaper-attachments.dropboxusercontent.com%2Fs_53D394CA9EC8054C4D57206D6F81F4051344F365ABEA51B6BCB0963F87164624_1667240007483_xata3.png-mh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fpaper-attachments.dropboxusercontent.com%2Fs_53D394CA9EC8054C4D57206D6F81F4051344F365ABEA51B6BCB0963F87164624_1667240007483_xata3.png-mh.png" alt="Paper10"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Add a Database, we can do this by entering the database name and selecting the preferred zone.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fpaper-attachments.dropboxusercontent.com%2Fs_53D394CA9EC8054C4D57206D6F81F4051344F365ABEA51B6BCB0963F87164624_1667240182909_xata3.png-mh%2B1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fpaper-attachments.dropboxusercontent.com%2Fs_53D394CA9EC8054C4D57206D6F81F4051344F365ABEA51B6BCB0963F87164624_1667240182909_xata3.png-mh%2B1.png" alt="Paper1"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, let's add a table. We can do this by selecting the database and clicking &lt;strong&gt;Add a table&lt;/strong&gt;. Select empty table and enter a table name. We can add users table first.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fpaper-attachments.dropboxusercontent.com%2Fs_53D394CA9EC8054C4D57206D6F81F4051344F365ABEA51B6BCB0963F87164624_1667240958369_xata4.png-mh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fpaper-attachments.dropboxusercontent.com%2Fs_53D394CA9EC8054C4D57206D6F81F4051344F365ABEA51B6BCB0963F87164624_1667240958369_xata4.png-mh.png" alt="Paper2"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let's also add fields to the table. The users table needs an &lt;strong&gt;id, email,&lt;/strong&gt; &lt;strong&gt;and&lt;/strong&gt; &lt;strong&gt;password field&lt;/strong&gt;, while the files table needs an &lt;strong&gt;id, name, type, date, url, and userid field&lt;/strong&gt;. The &lt;strong&gt;id&lt;/strong&gt; field is created by default and autogenerated. Click on the highlighted &lt;strong&gt;icon&lt;/strong&gt; and select the appropriate data type.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fpaper-attachments.dropboxusercontent.com%2Fs_53D394CA9EC8054C4D57206D6F81F4051344F365ABEA51B6BCB0963F87164624_1667242643519_xata5.png-mh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fpaper-attachments.dropboxusercontent.com%2Fs_53D394CA9EC8054C4D57206D6F81F4051344F365ABEA51B6BCB0963F87164624_1667242643519_xata5.png-mh.png" alt="Paper3"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The datatypes for the Users fields are &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Email - String&lt;/li&gt;
&lt;li&gt;Password - String &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The datatypes for the Files fields are &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Name - String&lt;/li&gt;
&lt;li&gt;Type - String&lt;/li&gt;
&lt;li&gt;Date - date &lt;/li&gt;
&lt;li&gt;Url - String &lt;/li&gt;
&lt;li&gt;Userid -String.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Users table&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fpaper-attachments.dropboxusercontent.com%2Fs_53D394CA9EC8054C4D57206D6F81F4051344F365ABEA51B6BCB0963F87164624_1667244491462_xata6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fpaper-attachments.dropboxusercontent.com%2Fs_53D394CA9EC8054C4D57206D6F81F4051344F365ABEA51B6BCB0963F87164624_1667244491462_xata6.png" alt="Paper4"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Files table&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fpaper-attachments.dropboxusercontent.com%2Fs_53D394CA9EC8054C4D57206D6F81F4051344F365ABEA51B6BCB0963F87164624_1667244785228_xata7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fpaper-attachments.dropboxusercontent.com%2Fs_53D394CA9EC8054C4D57206D6F81F4051344F365ABEA51B6BCB0963F87164624_1667244785228_xata7.png" alt="Paper5"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Copy workspace base API URL.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fpaper-attachments.dropboxusercontent.com%2Fs_53D394CA9EC8054C4D57206D6F81F4051344F365ABEA51B6BCB0963F87164624_1667245232381_xata8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fpaper-attachments.dropboxusercontent.com%2Fs_53D394CA9EC8054C4D57206D6F81F4051344F365ABEA51B6BCB0963F87164624_1667245232381_xata8.png" alt="Paper6"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To generate the API key, go to account settings, enter the name of the API key and click o save.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fpaper-attachments.dropboxusercontent.com%2Fs_53D394CA9EC8054C4D57206D6F81F4051344F365ABEA51B6BCB0963F87164624_1667245675884_xata9.png-mh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fpaper-attachments.dropboxusercontent.com%2Fs_53D394CA9EC8054C4D57206D6F81F4051344F365ABEA51B6BCB0963F87164624_1667245675884_xata9.png-mh.png" alt="Paper7"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://cloudinary.com/?utm_source=hackmamba&amp;amp;utm_campaign=hackmamba-hackathon&amp;amp;utm_medium=hackmamba-blog" rel="noopener noreferrer"&gt;&lt;strong&gt;CLOUDINARY&lt;/strong&gt;&lt;/a&gt;&lt;br&gt;
Signup on cloudinary.com and login to your account.&lt;/p&gt;

&lt;p&gt;Get the &lt;strong&gt;cloudname&lt;/strong&gt; on the dashboard and the &lt;strong&gt;presetname&lt;/strong&gt; on the settings page.&lt;/p&gt;
&lt;h2&gt;
  
  
  Connecting Cloudinary to the application
&lt;/h2&gt;

&lt;p&gt;We added the Cloudinary script to our index.js page during the page setup. Now, let's add the necessary code to upload files to Cloudinary and get the url link to our file.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h2&gt;
  
  
  Connecting Xata to the application
&lt;/h2&gt;

&lt;p&gt;This application will do 4 significant actions on Xata: signup, login, save and retrieve files. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Setup API Routes on NextJS.&lt;/strong&gt;&lt;br&gt;
Before we set up our API routes, we need to add our .env file.&lt;/p&gt;

&lt;p&gt;.env&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;XATA=Bearer &amp;lt;Insert your API KEY&amp;gt;
salt=&amp;lt;Insert anything&amp;gt;
database=&amp;lt;workspace base API URL&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;api/signup.js&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;The signup API route expects a request body from the client, it is a POST request, and the first thing it does is check if the email already exists; if it does, it returns an error message, but if it does not, it creates a new user in the database.&lt;/p&gt;

&lt;p&gt;api/login.js&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;The login API route expects a request body, a POST request, and it gets the email needed to check if the user exists; if the user exists, the user object is sent to the client.&lt;/p&gt;

&lt;p&gt;api/upload.js&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;The upload route API expects the request object, which contains the file name, file url, type, and other data; the upload API stores the file in the database. It is a POST request.&lt;/p&gt;

&lt;p&gt;api/files&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;The files route API is a GET request. We need to retrieve the files we have stored in the database, which is what the files API route does. It uses the search query, which is the &lt;strong&gt;userid&lt;/strong&gt;, to fetch all files associated with the user.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Integrate API routes with the pages&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;pages/signup.js&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;We have imported &lt;strong&gt;bcryptjs&lt;/strong&gt; and &lt;strong&gt;react notifications&lt;/strong&gt; to help with password hashing and the user experience. We made use of the useRef hook to get our input value.&lt;/p&gt;

&lt;p&gt;The sign function is where the action is taking place; it checks if the email or password is empty and returns an error message if it is empty, then we use bcryptjs to hash the password, we send the credentials to our signup API route, and if the request is successful, we store the userid and email in the client using localStorage API, and redirect the user to the index page, if the user already exists, we display an error message.&lt;/p&gt;

&lt;p&gt;pages/login.js&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;The log function checks if the email or password is empty and returns an error message If it is empty, we send the request to the login API route; then we use bcryptjs to compare the password; if the password is wrong, we display an error message, if the password is correct, we store the userid and email in the client using the localStorage API, and redirect the user to the index page.&lt;/p&gt;

&lt;p&gt;pages/index.js&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;We set up our useState for the different types of files, and we also set up our useEffect to check if the user has been authenticated. We are doing this by checking the userid in the localStorage. We also get all the files when the page is refreshed, and we do this by calling the files API route inside the useEffect. We have also updated our showWidget function to store the url link and associated information we get when we upload our files to Cloudinary. We are using the upload API route for this inside the showWidget function. We are also getting the type of file by checking the extension of the files, which will help us classify the files into different categories. Finally, we use the different array categories for the file type to display the files on the page.&lt;/p&gt;

&lt;p&gt;pages/all.js&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;The all page uses the api/files endpoint to get all the uploaded files and displays them on the page.&lt;/p&gt;

&lt;p&gt;pages/files.js&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;The files page uses the api/files endpoint to get all the uploaded files, filters the result for documents like pdf and Microsoft word, and displays them on the page.&lt;/p&gt;

&lt;p&gt;pages/photos.js&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;The photos page uses the api/files endpoint to get all the uploaded files, filters the result for the images, and displays them on the page.&lt;/p&gt;

&lt;p&gt;pages/videos.js&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;The videos page uses the api/files endpoint to get all the uploaded files, and filters the results for videos, and displays them on the page.&lt;/p&gt;

&lt;p&gt;For all the pages, we are checking if the user is authenticated inside the useEffect, we are also calling the files API route to get the files associated with the user. We use the useState to keep track of our files and display them on the page. &lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;We built a fully functional file storage application using Xata, Cloudinary, and NextJs, where users can upload images, videos, documents, and other files.&lt;/p&gt;

&lt;p&gt;Users can sign up and log in to the application to start using it; users' passwords are hashed for security, and only users can access the files they store in the application.&lt;/p&gt;

&lt;p&gt;I hope you found this tutorial useful.&lt;/p&gt;

&lt;p&gt;Thank you for reading.&lt;/p&gt;

&lt;p&gt;Link to the demo - &lt;a href="https://clouddrop.netlify.app/" rel="noopener noreferrer"&gt;https://clouddrop.netlify.app/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Content created for the &lt;a href="https://hackmamba.io/" rel="noopener noreferrer"&gt;Hackmamba&lt;/a&gt; Jamstack Content Hackathon with &lt;a href="https://xata.io/?utm_source=hackmamba&amp;amp;utm_campaign=hackmamba-hackathon&amp;amp;utm_medium=hackmamba-blog" rel="noopener noreferrer"&gt;Xata&lt;/a&gt; and &lt;a href="https://cloudinary.com/?utm_source=hackmamba&amp;amp;utm_campaign=hackmamba-hackathon&amp;amp;utm_medium=hackmamba-blog" rel="noopener noreferrer"&gt;Cloudinary&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>filestorage</category>
      <category>xata</category>
      <category>nextjs</category>
      <category>cloudinary</category>
    </item>
    <item>
      <title>Web2 vs Web3</title>
      <dc:creator>ADESANYA JOSHUA AYODEJI</dc:creator>
      <pubDate>Wed, 09 Mar 2022 08:57:33 +0000</pubDate>
      <link>https://dev.to/josh4324/web2-vs-web3-51e2</link>
      <guid>https://dev.to/josh4324/web2-vs-web3-51e2</guid>
      <description>&lt;p&gt;The Web is very common nowadays but it was not always like that in the early days, the web was invented by Tim Berners-Lee, a British scientist in 1989, the rest is history now.&lt;/p&gt;

&lt;p&gt;The Web is fully known as the World Wide Web, it is a major part of the internet, which contains pages and information that can be accessed by a web browser.&lt;/p&gt;

&lt;p&gt;It is easier for us to confuse the web for the internet, but the internet is a global network of servers. Servers are where pages and information are hosted, so they make it possible for us to share information.&lt;/p&gt;

&lt;p&gt;Although, the focus of this article is on the comparison between Web2 and Web3. It makes sense for us to look into  Web 1.0 as well.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Web 1.0&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This is the first stage of the Web evolution, it is widely known for displaying static pages. The contents are served from the server's file system. Elements are positioned using tables and frames. The web was mostly used by researchers and people who want to display information.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Web 2.0&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This is the second stage of the Web evolution, although no point signified the end of web 1 and beginning of web 2, so web 2 was built on web1. It is the web for the creators. There is a lot of emphasis on user experience, user content creation. Social media, blogging, vlogging are mainstream. It is the participatory social web.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Web 3.0&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This is the permissionless web. It is the new phase of the web, anyone on the network can use the service without interference. It also has an inbuilt payment system.  Web3 applications run on blockchains, these applications are often referred to as decentralized applications(dapps).&lt;/p&gt;

&lt;p&gt;Some of the characteristics of Web3 are that, it is verifiable, trustless, self-governing, permissionless, distributed, stateful, and others.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Differences between Web2 and Web3&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Applications owners can censor any account on Web2, this would not be possible on a fully decentralized Web3 application.&lt;/p&gt;

&lt;p&gt;Payment services like PayPal have placed restrictions on some countries making it impossible to use their services, this would not be possible on a fully decentralized Web3 payment service.&lt;/p&gt;

&lt;p&gt;Application on Web2 can go down any time, we have seen it happen with Facebook and other big social application, web3 applications run on multiple nodes and they cannot all be down at the same time, which means the web3 application will always be accessible.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In conclusion, Web2 is still a part of Web3, just like web2 is a part of web1, it is a continuum. Most web3 application frontends are still hosted on decentralized platforms, so web2 is not going anywhere.&lt;/p&gt;

&lt;p&gt;I am part of a block games internship aimed at teaching people how to develop a decentralized application, which is sponsored by Block games (&lt;a href="https://blockgames.gg/"&gt;https://blockgames.gg/&lt;/a&gt;), Nestcoin (&lt;a href="https://nestcoin.com/"&gt;https://nestcoin.com/&lt;/a&gt;), and the Zuriteam (&lt;a href="https://zuri.team/"&gt;https://zuri.team/&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;Thank you for reading&lt;/p&gt;

&lt;p&gt;See You Next Time.&lt;/p&gt;

</description>
      <category>web2</category>
      <category>web3</category>
    </item>
    <item>
      <title>A Friendly Beginner's Guide to Solidity (Part Two)</title>
      <dc:creator>ADESANYA JOSHUA AYODEJI</dc:creator>
      <pubDate>Sun, 13 Feb 2022 17:34:28 +0000</pubDate>
      <link>https://dev.to/josh4324/a-friendly-beginners-guide-to-solidity-part-two-59h1</link>
      <guid>https://dev.to/josh4324/a-friendly-beginners-guide-to-solidity-part-two-59h1</guid>
      <description>&lt;p&gt;This is the continuation of &lt;a href="https://dev.to/josh4324/a-friendly-beginners-guide-to-solidity-part-one-4ghi"&gt;A Friendly Beginner's guide to Solidity (Part One)&lt;/a&gt;. We looked at the key topics such as Ethereum, Solidity, Ethereum Virtual Machine and Smart Contract, then we dived deep fully into Solidity.&lt;/p&gt;

&lt;p&gt;We will be looking into more advanced concept in solidity in this article.&lt;/p&gt;

&lt;h3&gt;
  
  
  Functions
&lt;/h3&gt;

&lt;p&gt;We looked at functions in the part one but we will take a deeper look into it.&lt;/p&gt;

&lt;p&gt;There are various kinds of functions in solidity, they are&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Public functions&lt;/li&gt;
&lt;li&gt;Private functions&lt;/li&gt;
&lt;li&gt;Internal functions&lt;/li&gt;
&lt;li&gt;external functions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Public functions&lt;/strong&gt; - These are functions that can be called by any contract, this is not advisable, it exposes your function, especially if values can be changed as a result of calling the function. it exposes your contract to attacks. The &lt;strong&gt;public&lt;/strong&gt; keyword is added after the function parameters.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight solidity"&gt;&lt;code&gt;&lt;span class="c1"&gt;// SPDX-License-Identifier: MIT
&lt;/span&gt;&lt;span class="k"&gt;pragma&lt;/span&gt; &lt;span class="n"&gt;solidity&lt;/span&gt; &lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="mf"&gt;0.8&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;contract&lt;/span&gt; &lt;span class="n"&gt;HelloWorld&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;struct&lt;/span&gt; &lt;span class="n"&gt;Car&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; 
        &lt;span class="kt"&gt;uint&lt;/span&gt; &lt;span class="n"&gt;amout&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
        &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
    &lt;span class="p"&gt;}&lt;/span&gt;

   &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;createCar&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;uint&lt;/span&gt; &lt;span class="n"&gt;_amount&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="k"&gt;memory&lt;/span&gt; &lt;span class="n"&gt;_name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;pure&lt;/span&gt; &lt;span class="k"&gt;returns&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Car&lt;/span&gt; &lt;span class="k"&gt;memory&lt;/span&gt; &lt;span class="n"&gt;_car&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;    
        &lt;span class="n"&gt;Car&lt;/span&gt; &lt;span class="k"&gt;memory&lt;/span&gt; &lt;span class="n"&gt;newCar&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Car&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;_amount&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;_name&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;newCar&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;     
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In solidity, we must specify the return datatype of the data the function will return, as seen in the function above.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Private functions&lt;/strong&gt; - These are functions that can only be called within your contract. It is not accessible to outside functions. A good rule of thumb is to make your contract private by default. &lt;br&gt;
The &lt;strong&gt;private&lt;/strong&gt; keyword is added after the function parameters.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight solidity"&gt;&lt;code&gt;&lt;span class="c1"&gt;// SPDX-License-Identifier: MIT
&lt;/span&gt;&lt;span class="k"&gt;pragma&lt;/span&gt; &lt;span class="n"&gt;solidity&lt;/span&gt; &lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="mf"&gt;0.8&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;contract&lt;/span&gt; &lt;span class="n"&gt;HelloWorld&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;struct&lt;/span&gt; &lt;span class="n"&gt;Car&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; 
        &lt;span class="kt"&gt;uint&lt;/span&gt; &lt;span class="n"&gt;amout&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
        &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
    &lt;span class="p"&gt;}&lt;/span&gt;

   &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;createCar&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;uint&lt;/span&gt; &lt;span class="n"&gt;_amount&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="k"&gt;memory&lt;/span&gt; &lt;span class="n"&gt;_name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;private&lt;/span&gt; &lt;span class="k"&gt;pure&lt;/span&gt; &lt;span class="k"&gt;returns&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Car&lt;/span&gt; &lt;span class="k"&gt;memory&lt;/span&gt; &lt;span class="n"&gt;_car&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;   
        &lt;span class="n"&gt;Car&lt;/span&gt; &lt;span class="k"&gt;memory&lt;/span&gt; &lt;span class="n"&gt;newCar&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Car&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;_amount&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;_name&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;newCar&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;     
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Internal functions&lt;/strong&gt; - These are private functions but they are accessible to contracts that inherit from your contract.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight solidity"&gt;&lt;code&gt;&lt;span class="c1"&gt;// SPDX-License-Identifier: MIT
&lt;/span&gt;&lt;span class="k"&gt;pragma&lt;/span&gt; &lt;span class="n"&gt;solidity&lt;/span&gt; &lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="mf"&gt;0.8&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;contract&lt;/span&gt; &lt;span class="n"&gt;HelloWorld&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;struct&lt;/span&gt; &lt;span class="n"&gt;Car&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; 
        &lt;span class="kt"&gt;uint&lt;/span&gt; &lt;span class="n"&gt;amout&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
        &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
    &lt;span class="p"&gt;}&lt;/span&gt;

   &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;createCar&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;uint&lt;/span&gt; &lt;span class="n"&gt;_amount&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="k"&gt;memory&lt;/span&gt; &lt;span class="n"&gt;_name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;internal&lt;/span&gt; &lt;span class="k"&gt;pure&lt;/span&gt; &lt;span class="k"&gt;returns&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Car&lt;/span&gt; &lt;span class="k"&gt;memory&lt;/span&gt; &lt;span class="n"&gt;_car&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;  
        &lt;span class="n"&gt;Car&lt;/span&gt; &lt;span class="k"&gt;memory&lt;/span&gt; &lt;span class="n"&gt;newCar&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Car&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;_amount&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;_name&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;newCar&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;     
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;External functions&lt;/strong&gt; - These are functions that are only accessible outside your contract, if you need to expose a function to the public, an external function is a good idea.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight solidity"&gt;&lt;code&gt;&lt;span class="c1"&gt;// SPDX-License-Identifier: MIT
&lt;/span&gt;&lt;span class="k"&gt;pragma&lt;/span&gt; &lt;span class="n"&gt;solidity&lt;/span&gt; &lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="mf"&gt;0.8&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;contract&lt;/span&gt; &lt;span class="n"&gt;HelloWorld&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;struct&lt;/span&gt; &lt;span class="n"&gt;Car&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; 
        &lt;span class="kt"&gt;uint&lt;/span&gt; &lt;span class="n"&gt;amout&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
        &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
    &lt;span class="p"&gt;}&lt;/span&gt;

   &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;createCar&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;uint&lt;/span&gt; &lt;span class="n"&gt;_amount&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="k"&gt;memory&lt;/span&gt; &lt;span class="n"&gt;_name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;external&lt;/span&gt; &lt;span class="k"&gt;pure&lt;/span&gt; &lt;span class="k"&gt;returns&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Car&lt;/span&gt; &lt;span class="k"&gt;memory&lt;/span&gt; &lt;span class="n"&gt;_car&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;  
        &lt;span class="n"&gt;Car&lt;/span&gt; &lt;span class="k"&gt;memory&lt;/span&gt; &lt;span class="n"&gt;newCar&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Car&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;_amount&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;_name&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;newCar&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;     
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Returning Multiple Values
&lt;/h3&gt;

&lt;p&gt;In most cases, functions return values and the values returned can be more than one, this depends on what the function is trying to achieve. We have seen in previous examples, how to return a single value, let's also see an example of how to return multiple values. The data type for all the return values must also be specified when we are returning one or more values&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight solidity"&gt;&lt;code&gt;&lt;span class="c1"&gt;// SPDX-License-Identifier: MIT
&lt;/span&gt;&lt;span class="k"&gt;pragma&lt;/span&gt; &lt;span class="n"&gt;solidity&lt;/span&gt; &lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="mf"&gt;0.8&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;contract&lt;/span&gt; &lt;span class="n"&gt;HelloWorld&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;struct&lt;/span&gt; &lt;span class="n"&gt;Car&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; 
        &lt;span class="kt"&gt;uint&lt;/span&gt; &lt;span class="n"&gt;amout&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
        &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
    &lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;createCar&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;uint&lt;/span&gt; &lt;span class="n"&gt;_amount&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="k"&gt;memory&lt;/span&gt; &lt;span class="n"&gt;_name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;external&lt;/span&gt; &lt;span class="k"&gt;pure&lt;/span&gt; &lt;span class="k"&gt;returns&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;uint&lt;/span&gt; &lt;span class="n"&gt;amount&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="k"&gt;memory&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Car&lt;/span&gt; &lt;span class="k"&gt;memory&lt;/span&gt; &lt;span class="n"&gt;_car&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;   
        &lt;span class="n"&gt;Car&lt;/span&gt; &lt;span class="k"&gt;memory&lt;/span&gt; &lt;span class="n"&gt;newCar&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Car&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;_amount&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;_name&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;_amount&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;_name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;newCar&lt;/span&gt; &lt;span class="p"&gt;);&lt;/span&gt;   
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Conditional statements and Loops
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;If Statement&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If statements are conditional statement used to check if a statement is true or false, its usage in solidity is similar to other languages i.e JavaScript&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight solidity"&gt;&lt;code&gt;&lt;span class="c1"&gt;// SPDX-License-Identifier: MIT
&lt;/span&gt;&lt;span class="k"&gt;pragma&lt;/span&gt; &lt;span class="n"&gt;solidity&lt;/span&gt; &lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="mf"&gt;0.8&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;contract&lt;/span&gt; &lt;span class="n"&gt;HelloWorld&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;struct&lt;/span&gt; &lt;span class="n"&gt;Car&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; 
        &lt;span class="kt"&gt;uint&lt;/span&gt; &lt;span class="n"&gt;amout&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
        &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
    &lt;span class="p"&gt;}&lt;/span&gt;

   &lt;span class="kt"&gt;uint&lt;/span&gt; &lt;span class="n"&gt;newAmount&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

   &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;createCar&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;uint&lt;/span&gt; &lt;span class="n"&gt;_amount&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="k"&gt;memory&lt;/span&gt; &lt;span class="n"&gt;_name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;external&lt;/span&gt; &lt;span class="k"&gt;returns&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Car&lt;/span&gt; &lt;span class="k"&gt;memory&lt;/span&gt; &lt;span class="n"&gt;_car&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;  
         &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;_amount&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
             &lt;span class="n"&gt;newAmount&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;_amount&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
         &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="n"&gt;Car&lt;/span&gt; &lt;span class="k"&gt;memory&lt;/span&gt; &lt;span class="n"&gt;newCar&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Car&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;newAmount&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;_name&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;newCar&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;   
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The logic above checks if the _amount is greater than 1000, if it is true it changes the newAmount variable to the amount passed into the function, if it is false it uses the default value assigned to the  newAmount Variable.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;For Loops&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;For loops allows us to execute a statement multiple times based on a condition. For Loops in solidity are similar to other languages i.e javascript&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight solidity"&gt;&lt;code&gt;&lt;span class="c1"&gt;// SPDX-License-Identifier: MIT
&lt;/span&gt;&lt;span class="k"&gt;pragma&lt;/span&gt; &lt;span class="n"&gt;solidity&lt;/span&gt; &lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="mf"&gt;0.8&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;contract&lt;/span&gt; &lt;span class="n"&gt;HelloWorld&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

    &lt;span class="k"&gt;struct&lt;/span&gt; &lt;span class="n"&gt;Car&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; 
        &lt;span class="kt"&gt;uint&lt;/span&gt; &lt;span class="n"&gt;amout&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
        &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
    &lt;span class="p"&gt;}&lt;/span&gt;    

    &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt; &lt;span class="n"&gt;carNamesList&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;"BMW"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s"&gt;"Toyota"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s"&gt;"Honda"&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
    &lt;span class="kt"&gt;uint&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt;  &lt;span class="n"&gt;carAmountList&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;2000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;2000&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
    &lt;span class="n"&gt;Car&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt; &lt;span class="n"&gt;allCars&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;loopCars&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;uint&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;carNamesList&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; 
        &lt;span class="n"&gt;Car&lt;/span&gt; &lt;span class="k"&gt;memory&lt;/span&gt; &lt;span class="n"&gt;newCar&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Car&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;carAmountList&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;carNamesList&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;
        &lt;span class="n"&gt;allCars&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;newCar&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;



&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We created a carNamesList and carAmountList array, which contains list of the car names and car amounts, then we used the for loop to go through the arrays and created new cars and added it to the allCars array. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Require&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Require is similar to if statement, it evaluates if a statement is true or false, if the statement is true, the lines below the require statement is evaluated, if it is false, it throws an error.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight solidity"&gt;&lt;code&gt;&lt;span class="c1"&gt;// SPDX-License-Identifier: MIT
&lt;/span&gt;&lt;span class="k"&gt;pragma&lt;/span&gt; &lt;span class="n"&gt;solidity&lt;/span&gt; &lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="mf"&gt;0.8&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;contract&lt;/span&gt; &lt;span class="n"&gt;HelloWorld&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;struct&lt;/span&gt; &lt;span class="n"&gt;Car&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; 
        &lt;span class="kt"&gt;uint&lt;/span&gt; &lt;span class="n"&gt;amout&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
        &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
    &lt;span class="p"&gt;}&lt;/span&gt;

   &lt;span class="kt"&gt;uint&lt;/span&gt; &lt;span class="n"&gt;newAmount&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

   &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;createCar&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;uint&lt;/span&gt; &lt;span class="n"&gt;_amount&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="k"&gt;memory&lt;/span&gt; &lt;span class="n"&gt;_name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;external&lt;/span&gt; &lt;span class="k"&gt;view&lt;/span&gt; &lt;span class="k"&gt;returns&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Car&lt;/span&gt; &lt;span class="k"&gt;memory&lt;/span&gt; &lt;span class="n"&gt;_car&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;  
        &lt;span class="nb"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;_amount&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;newAmount&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="n"&gt;Car&lt;/span&gt; &lt;span class="k"&gt;memory&lt;/span&gt; &lt;span class="n"&gt;newCar&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Car&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;newAmount&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;_name&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;newCar&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;   
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The logic above checks if the _amount is greater than the amount set in the newAmount variable, if it is true, the lines below executes, if it is false, it throws an error.&lt;/p&gt;

&lt;h3&gt;
  
  
  Generating random numbers
&lt;/h3&gt;

&lt;p&gt;To generate a random number, we will need the ethereum hash function known as keccak256, it is a version of SHA3. This hash function returns a 256-bit hexadecimal number and the hash function is expecting a single parameter of type bytes. &lt;/p&gt;

&lt;p&gt;In order to use it we need to encode the string we will pass to the function using abi.encodePacked, this function will convert the string to the type bytes.&lt;/p&gt;

&lt;p&gt;Lets see it in action.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight solidity"&gt;&lt;code&gt;&lt;span class="c1"&gt;// SPDX-License-Identifier: MIT
&lt;/span&gt;&lt;span class="k"&gt;pragma&lt;/span&gt; &lt;span class="n"&gt;solidity&lt;/span&gt; &lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="mf"&gt;0.8&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;contract&lt;/span&gt; &lt;span class="n"&gt;HelloWorld&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

 &lt;span class="kt"&gt;bytes32&lt;/span&gt; &lt;span class="n"&gt;variable&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;keccak256&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;abi&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;encodePacked&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"aaaab"&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="c1"&gt;//6e91ec6b618bb462a4a6ee5aa2cb0e9cf30f7a052bb467b0ba58b8748c00d2e5
&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Imports
&lt;/h3&gt;

&lt;p&gt;When we have our contracts in different files and we want to use them in another file, we use imports.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight solidity"&gt;&lt;code&gt;&lt;span class="c1"&gt;// SPDX-License-Identifier: MIT
&lt;/span&gt;&lt;span class="k"&gt;pragma&lt;/span&gt; &lt;span class="n"&gt;solidity&lt;/span&gt; &lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="mf"&gt;0.8&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// NFT contract to inherit from.
&lt;/span&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="s"&gt;"@openzeppelin/contracts/token/ERC721/ERC721.sol"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;contract&lt;/span&gt; &lt;span class="n"&gt;MyNFT&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="n"&gt;ERC721&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We imported a contract above that can be used to create an NFT token with less code.&lt;/p&gt;

&lt;p&gt;OpenZeppelin offers open source OpenZeppelin Contracts, written in Solidity, for building secure smart contracts. OpenZeppelin Contracts uses ERC standards for Ethereum-based tokens that can be used in many types of projects. In an effort to minimize cyber risk associated with building secure smart contracts on Ethereum or other blockchains, OpenZeppelin Contracts are continually audited and tested.&lt;/p&gt;

&lt;h3&gt;
  
  
  Inheritance
&lt;/h3&gt;

&lt;p&gt;This is a popular concept in object oriented programing, where a class inherits the properties of another class. In solidity Contract can inherit from other contracts.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight solidity"&gt;&lt;code&gt;&lt;span class="c1"&gt;// SPDX-License-Identifier: MIT
&lt;/span&gt;&lt;span class="k"&gt;pragma&lt;/span&gt; &lt;span class="n"&gt;solidity&lt;/span&gt; &lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="mf"&gt;0.8&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;contract&lt;/span&gt; &lt;span class="n"&gt;Hello&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;HelloWorld&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;pure&lt;/span&gt; &lt;span class="k"&gt;returns&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="k"&gt;memory&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s"&gt;"Hello World"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;contract&lt;/span&gt; &lt;span class="n"&gt;HelloWord&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="n"&gt;Hello&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;AnotherHelloWorld&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;pure&lt;/span&gt; &lt;span class="k"&gt;returns&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="k"&gt;memory&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s"&gt;"Another Hello World"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The first contract has access to only the HelloWorld function, the second contract has access to both the HelloWorld function and the AnotherHelloWord function.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;is&lt;/strong&gt; is the keyword for the inheritance.&lt;/p&gt;

&lt;h3&gt;
  
  
  Events
&lt;/h3&gt;

&lt;p&gt;Events are a medium for us to communicate what is happening on the blockchain to the client-side or front end of our application. What makes it possible for the frontend to know when a change has occurred on the blockchain is called events.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight solidity"&gt;&lt;code&gt;&lt;span class="c1"&gt;// SPDX-License-Identifier: MIT
&lt;/span&gt;&lt;span class="k"&gt;pragma&lt;/span&gt; &lt;span class="n"&gt;solidity&lt;/span&gt; &lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="mf"&gt;0.8&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;contract&lt;/span&gt; &lt;span class="n"&gt;HelloWorld&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;struct&lt;/span&gt; &lt;span class="n"&gt;Car&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; 
        &lt;span class="kt"&gt;uint&lt;/span&gt; &lt;span class="n"&gt;amout&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
        &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;event&lt;/span&gt; &lt;span class="n"&gt;CarCreated&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;uint&lt;/span&gt; &lt;span class="n"&gt;_amount&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;  &lt;span class="n"&gt;_name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Car&lt;/span&gt; &lt;span class="n"&gt;_car&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; 

    &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;createCar&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;uint&lt;/span&gt; &lt;span class="n"&gt;_amount&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="k"&gt;memory&lt;/span&gt; &lt;span class="n"&gt;_name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;internal&lt;/span&gt; &lt;span class="k"&gt;returns&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Car&lt;/span&gt; &lt;span class="k"&gt;memory&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;  
         &lt;span class="n"&gt;Car&lt;/span&gt; &lt;span class="k"&gt;memory&lt;/span&gt; &lt;span class="n"&gt;newCar&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Car&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;_amount&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;_name&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
         &lt;span class="k"&gt;emit&lt;/span&gt; &lt;span class="n"&gt;CarCreated&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;_amount&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;_name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;newCar&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
         &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;newCar&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;     
  &lt;span class="p"&gt;}&lt;/span&gt;


&lt;span class="p"&gt;}&lt;/span&gt;


&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;we used the *&lt;em&gt;event *&lt;/em&gt; keyword to create the CarCreated event.&lt;br&gt;
In the createCar function, we emit the CarCreated event. The client-side gets the event and does something with it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight solidity"&gt;&lt;code&gt;&lt;span class="c1"&gt;// The frontend implementation
&lt;/span&gt;&lt;span class="n"&gt;YourContract&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CarCreated&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;error&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="c1"&gt;// do something when car is created
&lt;/span&gt;&lt;span class="p"&gt;})&lt;/span&gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Addresses
&lt;/h3&gt;

&lt;p&gt;The Ethereum blockchain is made up of accounts, these accounts works similarly to bank accounts. An account has a balance of Ether (the currency used on the Ethereum blockchain), and you can send and receive Ether payments to other accounts.&lt;/p&gt;

&lt;p&gt;Each account has an address, which you can think of like a bank account number. It's a unique identifier that points to that account, and it looks like this:&lt;br&gt;
0x1443498Ef86df975D8A2b0B6a315fB9f49978998 (This is my address, you can send some ether). Thank you in advance.&lt;/p&gt;

&lt;p&gt;The address is the user identity on the blockchain(Ethereum Blockchain).&lt;/p&gt;
&lt;h3&gt;
  
  
  Mappings
&lt;/h3&gt;

&lt;p&gt;Addresses are one of the most important things we map our data to on the Ethereum blockchain, we can map things like account balance(Ether), NFTs, userIds, and other things which belong to us on the blockchain to our address.&lt;/p&gt;

&lt;p&gt;For example, to match our address to our account balance, we can do this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight solidity"&gt;&lt;code&gt;&lt;span class="c1"&gt;// SPDX-License-Identifier: MIT
&lt;/span&gt;&lt;span class="k"&gt;pragma&lt;/span&gt; &lt;span class="n"&gt;solidity&lt;/span&gt; &lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="mf"&gt;0.8&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;contract&lt;/span&gt; &lt;span class="n"&gt;HelloWorld&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

    &lt;span class="k"&gt;mapping&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;address&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;uint&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="n"&gt;accountBalance&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The name of the mapping we created above is accountBalance. we are mapping address to uint using the &lt;strong&gt;mapping&lt;/strong&gt; keyword, address is a datatype, just like uint.&lt;/p&gt;

&lt;h3&gt;
  
  
  Msg.sender
&lt;/h3&gt;

&lt;p&gt;To get access to our address,  we need access msg.sender, it is a global variable available to all functions, msg.sender outputs the user's address.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight solidity"&gt;&lt;code&gt;&lt;span class="c1"&gt;// SPDX-License-Identifier: MIT
&lt;/span&gt;&lt;span class="k"&gt;pragma&lt;/span&gt; &lt;span class="n"&gt;solidity&lt;/span&gt; &lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="mf"&gt;0.8&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;contract&lt;/span&gt; &lt;span class="n"&gt;HelloWorld&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;uint&lt;/span&gt; &lt;span class="n"&gt;amount&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;5000&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;mapping&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;address&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;uint256&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="n"&gt;accountBalance&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;


    &lt;span class="n"&gt;accountBalance&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;msg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;sender&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;amount&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="c1"&gt;// mapping is done, now we can access the account balance 
&lt;/span&gt;    &lt;span class="c1"&gt;// from the accountBalance mapping when we need it
&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We assigned the amount to our address, and we got our address from msg.sender.&lt;/p&gt;

&lt;h3&gt;
  
  
  Constructors
&lt;/h3&gt;

&lt;p&gt;It is an optional special function that has the same name as the contract. it will get executed only one time when the contract is first created.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight solidity"&gt;&lt;code&gt;&lt;span class="c1"&gt;// SPDX-License-Identifier: MIT
&lt;/span&gt;&lt;span class="k"&gt;pragma&lt;/span&gt; &lt;span class="n"&gt;solidity&lt;/span&gt; &lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="mf"&gt;0.8&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;contract&lt;/span&gt; &lt;span class="n"&gt;HelloWorld&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="k"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt; &lt;span class="k"&gt;memory&lt;/span&gt; &lt;span class="n"&gt;carList&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;

  &lt;span class="c1"&gt;//Do other things
&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The carList array will only be created the first time the contract is created.&lt;/p&gt;

&lt;h3&gt;
  
  
  Function modifiers
&lt;/h3&gt;

&lt;p&gt;They are kind of half functions that are used to modify other functions, it is used mostly to check some requirements before executing the function.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight solidity"&gt;&lt;code&gt;&lt;span class="c1"&gt;// SPDX-License-Identifier: MIT
&lt;/span&gt;&lt;span class="k"&gt;pragma&lt;/span&gt; &lt;span class="n"&gt;solidity&lt;/span&gt; &lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="mf"&gt;0.8&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;contract&lt;/span&gt; &lt;span class="n"&gt;HelloWorld&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="kt"&gt;address&lt;/span&gt; &lt;span class="k"&gt;private&lt;/span&gt;  &lt;span class="n"&gt;_owner&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="k"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
         &lt;span class="n"&gt;_owner&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;msg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;sender&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;

   &lt;span class="c1"&gt;// modifier function
&lt;/span&gt;   &lt;span class="k"&gt;modifier&lt;/span&gt; &lt;span class="n"&gt;onlyOwner&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nb"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;msg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;sender&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;_owner&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="n"&gt;_&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;doSomething&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="n"&gt;onlyOwner&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="c1"&gt;// This function only runs when the onlyOwner 
&lt;/span&gt;      &lt;span class="c1"&gt;//  modifier question evaluates as true
&lt;/span&gt;  &lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We created a private variable called _owner which has an address datatype, we assigned our address to the variable in the constructor which only runs one, which means it is storing the address of the owner of the contract. &lt;/p&gt;

&lt;p&gt;We created a modifier function called onlyOwner, using the &lt;strong&gt;modifier&lt;/strong&gt; keyword. In the modifier function, we are checking if the address matches the address we initially stored which is the address of the owner of the contract.&lt;/p&gt;

&lt;p&gt;We assigned the modifier function to the doSomething function, this means that the function will only run if the person trying to access it is the owner of the contract.&lt;/p&gt;

&lt;p&gt;In the Part 3 of this article we will be using all these concept to build an NFT contract and front end application.&lt;/p&gt;

&lt;p&gt;I hope you found this tutorial useful.&lt;/p&gt;

&lt;p&gt;Thank you for reading.&lt;/p&gt;

&lt;p&gt;# References&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://docs.soliditylang.org/en/v0.8.11"&gt;Solidity Docs&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://cryptozombies.io/"&gt;Crypto Zombies&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.tutorialspoint.com/solidity/solidity_function_modifiers.htm/"&gt;Tutorial Point&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>solidity</category>
      <category>ethereum</category>
      <category>blockchain</category>
      <category>web3</category>
    </item>
    <item>
      <title>A Friendly Beginner's Guide to Solidity (Part One)</title>
      <dc:creator>ADESANYA JOSHUA AYODEJI</dc:creator>
      <pubDate>Sun, 13 Feb 2022 17:27:09 +0000</pubDate>
      <link>https://dev.to/josh4324/a-friendly-beginners-guide-to-solidity-part-one-4ghi</link>
      <guid>https://dev.to/josh4324/a-friendly-beginners-guide-to-solidity-part-one-4ghi</guid>
      <description>&lt;p&gt;Blockchain Technology and Web3 has become a buzz word and a lot of developers are switching or planning to switch to web3. One of the most popular blockchain technology is Ethereum and the programming language used to code its smart contract is solidity. Learning solidity is a step in the right direction in your journey to becoming a Web3 developer. To read more on blockchain checkout  &lt;a href="https://dev.to/josh4324/blockchain-for-beginners-5bc0"&gt;Blockchain for Beginners&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;In this tutorial, you will learn basic concepts in the solidity programming language and take a step to start building decentralized applications.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;Before we continue it is recommended to have the following.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A basic knowledge in any programming language&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Introduction
&lt;/h1&gt;

&lt;h3&gt;
  
  
  What is Solidity?
&lt;/h3&gt;

&lt;p&gt;Solidity is an object-oriented programming language for writing smart contracts on Ethereum. It is influenced by JavaScript, Python, and C++, and Solidity targets the Ethereum Virtual Machine (EVM). Solidity is the programming language of Ethereum.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is Ethereum?
&lt;/h3&gt;

&lt;p&gt;Ethereum is a decentralized opensource blockchain technology that lets you send cryptocurrency to anyone for a small fee. Ether is the native cryptocurrency of  Ethereum.  It also powers applications that everyone can use and no one can takedown. &lt;/p&gt;

&lt;h3&gt;
  
  
  What is an Ethereum Virtual Machine (EVM)?
&lt;/h3&gt;

&lt;p&gt;The Ethereum Virtual Machine (EVM) is a powerful, sandboxed virtual stack embedded within each full Ethereum node, responsible for executing contract bytecode. Contracts are typically written in higher-level languages, like Solidity, then compiled to EVM bytecode.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is a Smart Contract?
&lt;/h3&gt;

&lt;p&gt;Smart contracts are simply programs stored on a blockchain that run when predetermined conditions are met. They typically are used to automate the execution of an agreement so that all participants can be immediately certain of the outcome, without any intermediary’s involvement or time loss. They can also automate a workflow, triggering the next action when conditions are met.&lt;/p&gt;

&lt;h3&gt;
  
  
  Let's get started!
&lt;/h3&gt;

&lt;p&gt;After creating a solidity file that ends with .sol, the first requirement is to add a comment indicating the license of the code(open source or not).&lt;br&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight solidity"&gt;&lt;code&gt;&lt;span class="c1"&gt;// SPDX-License-Identifier: MIT
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The next line to be added to the file is the pragma indication of the version of solidity that you are using. This will prevent problems during compilation.&lt;br&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight solidity"&gt;&lt;code&gt;&lt;span class="c1"&gt;// SPDX-License-Identifier: MIT
&lt;/span&gt;&lt;span class="k"&gt;pragma&lt;/span&gt; &lt;span class="n"&gt;solidity&lt;/span&gt; &lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="mf"&gt;0.8&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Contracts
&lt;/h1&gt;

&lt;p&gt;They are starting point of your solidity project. It is the building block of all Ethereum programs. It is similar to classes in object-oriented languages and will contain the variables, functions, and others.&lt;br&gt;
An empty contract looks like this -&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight solidity"&gt;&lt;code&gt;&lt;span class="c1"&gt;// SPDX-License-Identifier: MIT
&lt;/span&gt;&lt;span class="k"&gt;pragma&lt;/span&gt; &lt;span class="n"&gt;solidity&lt;/span&gt; &lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="mf"&gt;0.8&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;contract&lt;/span&gt; &lt;span class="n"&gt;HelloWorld&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  State Variables
&lt;/h1&gt;

&lt;p&gt;They are a means of holding values in the smart contract. They are permanently stored in the contract storage, the implication of this is that they are written to the Ethereum blockchain, which is similar to writing to a database. Let's create a state variable named amount.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight solidity"&gt;&lt;code&gt;&lt;span class="c1"&gt;// SPDX-License-Identifier: MIT
&lt;/span&gt;&lt;span class="k"&gt;pragma&lt;/span&gt; &lt;span class="n"&gt;solidity&lt;/span&gt; &lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="mf"&gt;0.8&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;contract&lt;/span&gt; &lt;span class="n"&gt;HelloWorld&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;uint&lt;/span&gt; &lt;span class="n"&gt;amount&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I added uint(unsigned integer) in front of the amount, that is the data type of the state variable&lt;/p&gt;

&lt;h1&gt;
  
  
  Data Types
&lt;/h1&gt;

&lt;p&gt;Data types in Solidity represent the type of data the program is to use. The type can be numeric, alphanumeric, decimal, bool, etc. &lt;/p&gt;

&lt;p&gt;These attributes tell the program compiler how the programmer intends to use the data by constraining the values that a variable or a function might use. Solidity is a statically typed language which means the type of each variable needs to be specified throughout your code. &lt;/p&gt;

&lt;p&gt;Data types instruct the compiler to check the usage of the variables in your contract. Declared data types have default values referred to as zero state (0). &lt;/p&gt;

&lt;p&gt;For example, a boolean’s default value is False and a uint’s default value is 0. The concept of undefined or null values does not exist in solidity. So a data type will have some value (for example – hi, 123, true, etc.) or 0 as a default value. &lt;/p&gt;

&lt;p&gt;Examples of data types found in solidity&lt;br&gt;
String, Integer(signed and unsigned), Address, Fixed Point Number(signed and unsigned), Byte, Structs, and others.&lt;/p&gt;
&lt;h1&gt;
  
  
  Structs
&lt;/h1&gt;

&lt;p&gt;In some cases, a special data type is needed. Structs are created for this purpose. It allows us to create complicated data types that have properties. The properties inside the struct will also have their types, Let's add a Car Struct to our HelloWorld Contract.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight solidity"&gt;&lt;code&gt;&lt;span class="c1"&gt;// SPDX-License-Identifier: MIT
&lt;/span&gt;&lt;span class="k"&gt;pragma&lt;/span&gt; &lt;span class="n"&gt;solidity&lt;/span&gt; &lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="mf"&gt;0.8&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;contract&lt;/span&gt; &lt;span class="n"&gt;HelloWorld&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;uint&lt;/span&gt; &lt;span class="n"&gt;amount&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;struct&lt;/span&gt; &lt;span class="n"&gt;Car&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; 
        &lt;span class="kt"&gt;uint&lt;/span&gt; &lt;span class="n"&gt;amout&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
        &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="c1"&gt;// To create a new Car
&lt;/span&gt;    &lt;span class="n"&gt;Car&lt;/span&gt; &lt;span class="n"&gt;bmw&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Car&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;10000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"BMW"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;From the code above we declared our Car struct and created a new Car named bmw. We can also see that we used the Car Struct as a datatype when creating the new car.&lt;/p&gt;

&lt;h1&gt;
  
  
  Arrays
&lt;/h1&gt;

&lt;p&gt;Arrays or lists are popular in various programming languages, anytime we need to store a collection of items, arrays come to mind. We have two types of array in solidity, fixed arrays, and dynamic arrays.&lt;/p&gt;

&lt;p&gt;Fixed arrays have a fixed size.&lt;br&gt;&lt;br&gt;
Dynamic arrays have no fixed &lt;br&gt;
size.&lt;br&gt;&lt;br&gt;
Let's create an array and store a few cars in it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight solidity"&gt;&lt;code&gt;&lt;span class="c1"&gt;// SPDX-License-Identifier: MIT
&lt;/span&gt;&lt;span class="k"&gt;pragma&lt;/span&gt; &lt;span class="n"&gt;solidity&lt;/span&gt; &lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="mf"&gt;0.8&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;contract&lt;/span&gt; &lt;span class="n"&gt;HelloWorld&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

    &lt;span class="kt"&gt;uint&lt;/span&gt; &lt;span class="n"&gt;amount&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;struct&lt;/span&gt; &lt;span class="n"&gt;Car&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; 
        &lt;span class="kt"&gt;uint&lt;/span&gt; &lt;span class="n"&gt;amout&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
        &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="c1"&gt;// To create new Cars
&lt;/span&gt;    &lt;span class="n"&gt;Car&lt;/span&gt; &lt;span class="n"&gt;bmw&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Car&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;10000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"BMW"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="n"&gt;Car&lt;/span&gt; &lt;span class="n"&gt;Toyota&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Car&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"Toyota"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="n"&gt;Car&lt;/span&gt; &lt;span class="n"&gt;Honda&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Car&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"Honda"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="c1"&gt;//Create a fixed array named fixedCars
&lt;/span&gt;    &lt;span class="n"&gt;Car&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="n"&gt;fixedCars&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="c1"&gt;//Create a dynamic array named dynamicCars
&lt;/span&gt;    &lt;span class="n"&gt;Car&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt; &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="n"&gt;dynamicCars&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;addCars&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Car&lt;/span&gt; &lt;span class="k"&gt;memory&lt;/span&gt; &lt;span class="n"&gt;newCar&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;public&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
         &lt;span class="c1"&gt;//The push method is used to add items to the array, 
&lt;/span&gt;        &lt;span class="n"&gt;dynamicCars&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;newCar&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;


&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;we can also declare our arrays as public, this means that other contracts of the blockchain will be able to access it.&lt;br&gt;&lt;br&gt;
i.e lets create a publicCarList&lt;br&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight solidity"&gt;&lt;code&gt;&lt;span class="n"&gt;Car&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt; &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="n"&gt;publicCarList&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Functions
&lt;/h1&gt;

&lt;p&gt;Functions are very handy when writing code, it helps to break down our code into blocks. Solidity functions are not different. Let's add some functions to our HelloWorld Contract.  &lt;/p&gt;

&lt;p&gt;In solidity, arguments passed to functions can be done either by value or reference (memory). Passing by reference is compulsory for all reference types such as arrays, structs, mappings, and strings.&lt;/p&gt;

&lt;p&gt;By value, which means that the Solidity compiler creates a new copy of the parameter's value and passes it to your function. This allows your function to modify the value without worrying that the value of the initial parameter gets changed.&lt;br&gt;
By reference, which means that your function is called with a... reference to the original variable. Thus, if your function changes the value of the variable it receives, the value of the original variable gets changed.&lt;/p&gt;

&lt;p&gt;We will create a createCar function, it will take two parameters, amount and name. Our function will also be public.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight solidity"&gt;&lt;code&gt;&lt;span class="c1"&gt;// SPDX-License-Identifier: MIT
&lt;/span&gt;&lt;span class="k"&gt;pragma&lt;/span&gt; &lt;span class="n"&gt;solidity&lt;/span&gt; &lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="mf"&gt;0.8&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;contract&lt;/span&gt; &lt;span class="n"&gt;HelloWorld&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;uint&lt;/span&gt; &lt;span class="n"&gt;amount&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;struct&lt;/span&gt; &lt;span class="n"&gt;Car&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; 
        &lt;span class="kt"&gt;uint&lt;/span&gt; &lt;span class="n"&gt;amout&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
        &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="c1"&gt;// createCar function
&lt;/span&gt;    &lt;span class="c1"&gt;// adding underscore to the arguments is a covention
&lt;/span&gt;    &lt;span class="c1"&gt;// removing it will have no effect on the code
&lt;/span&gt;    &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;createCar&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;uint&lt;/span&gt; &lt;span class="n"&gt;_amount&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="k"&gt;memory&lt;/span&gt; &lt;span class="n"&gt;_name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;pure&lt;/span&gt; &lt;span class="k"&gt;returns&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Car&lt;/span&gt; &lt;span class="k"&gt;memory&lt;/span&gt; &lt;span class="n"&gt;_car&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;   
       &lt;span class="n"&gt;Car&lt;/span&gt; &lt;span class="k"&gt;memory&lt;/span&gt; &lt;span class="n"&gt;newCar&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Car&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;_amount&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;_name&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
       &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;newCar&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;     
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="c1"&gt;// The above function will return the newCar variable
&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It is not advisable to make our functions public, this will give other contracts access to it, we should make our functions private by default.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight solidity"&gt;&lt;code&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;createCar&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;uint&lt;/span&gt; &lt;span class="n"&gt;_amount&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="k"&gt;memory&lt;/span&gt; &lt;span class="n"&gt;_name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;private&lt;/span&gt; &lt;span class="k"&gt;pure&lt;/span&gt; &lt;span class="k"&gt;returns&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Car&lt;/span&gt; &lt;span class="k"&gt;memory&lt;/span&gt; &lt;span class="n"&gt;_car&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;   
       &lt;span class="n"&gt;Car&lt;/span&gt; &lt;span class="k"&gt;memory&lt;/span&gt; &lt;span class="n"&gt;newCar&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Car&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;_amount&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;_name&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
       &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;newCar&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;     
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  TypeCasting
&lt;/h1&gt;

&lt;p&gt;This is the conversion of one datatype to another.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight solidity"&gt;&lt;code&gt;&lt;span class="kt"&gt;uint&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kt"&gt;uint8&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kt"&gt;uint8&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;The best way to understand the concepts is to practice and build projects. &lt;/p&gt;

&lt;p&gt;Part 2 of this article will explain concepts such as events, mappings, data locations, returning multiple values, constructors, function modifiers, solidity time, and import&lt;/p&gt;

&lt;p&gt;Link to Part Two - &lt;a href="https://dev.to/josh4324/a-friendly-beginners-guide-to-solidity-part-two-59h1"&gt;A friendly beginners guide to solidity (Part Two)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I hope you found this tutorial useful.&lt;/p&gt;

&lt;p&gt;Thank you for reading.&lt;/p&gt;

&lt;p&gt;# References&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://docs.soliditylang.org/en/v0.8.11"&gt;Solidity Docs&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://cryptomarketpool.com/data-types-in-solidity-smart-contracts"&gt;Data Types in Solidity&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://cryptozombies.io/"&gt;Crypto Zombies&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://moralis.io/solidity-explained-what-is-solidity/"&gt;Solidity&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>blockchain</category>
      <category>solidity</category>
      <category>ethereum</category>
    </item>
    <item>
      <title>Nft For Beginners</title>
      <dc:creator>ADESANYA JOSHUA AYODEJI</dc:creator>
      <pubDate>Sat, 29 Jan 2022 23:47:36 +0000</pubDate>
      <link>https://dev.to/josh4324/nft-for-beginners-1gkp</link>
      <guid>https://dev.to/josh4324/nft-for-beginners-1gkp</guid>
      <description>&lt;p&gt;There is a high probability you have heard about NFT, which in full is called non fungible tokens. This simply means that it cannot be replaced or interchanged. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What brought about NFT?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;NFT became popular due to blockchain technology becoming mainstream. NFT can be any digital assets, artworks, pictures, videos or music. What makes them interesting is that they have unique properties which make it easy to prove ownership.&lt;/p&gt;

&lt;p&gt;For example, if you have a picture, let's assume your picture, to make it an NFT, you just have to store it with its attribute on the blockchain. You don't even need to be a programmer or technical person to do this. This can be easily done on  &lt;a href="https://opensea.io/"&gt;Opensea&lt;/a&gt; .&lt;/p&gt;

&lt;p&gt;NFTs are quite popular because people are buying and selling it. you may not be able to sell your NFT picture but if you are an artist or a creative, you can make a lot of money listing your creative asset on an NFT marketplace. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What makes NFT stand out in the blockchain world?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;They can be traded across different ecosystems, this means you can view your NFT on different wallets and marketplaces. This is possible due to open standards adopted across the ecosystem.&lt;br&gt;
It is easy to trade and respond to market forces, demand and supply determine the price in the long run. The ownership is verifiable without the need for any third party.&lt;/p&gt;

&lt;p&gt;NFTs are been utilized in various industries.&lt;br&gt;
Arts - Arts are being sold as NFTs on  &lt;a href="https://opensea.io/"&gt;Opensea&lt;/a&gt;  or other platforms&lt;br&gt;
Music - Music are hosted on  &lt;a href="https://opulous.org/"&gt;Opulous&lt;/a&gt;  as NFTs&lt;br&gt;
Videos - Videos are hosted on  &lt;a href="https://www.airnfts.com/"&gt;AirNFTs&lt;/a&gt;  as NFTs&lt;br&gt;
Gaming - NTs are a big part of the &lt;a href="https://axieinfinity.com/"&gt; Axie infinity&lt;/a&gt;  game.&lt;br&gt;
Sports - NBA top shot is a big example of how the NBA is cashing out with NFTs.&lt;br&gt;
Real Estate - Virtual lands are been sold as NFTs on  &lt;a href="https://decentraland.org/"&gt;Decentraland&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;NFT Marketplaces&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The most popular one is  &lt;a href="https://opensea.io/"&gt;Opensea&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Others are &lt;a href="https://superrare.com/"&gt;SuperRare&lt;/a&gt; and&lt;br&gt;
&lt;a href="https://rarible.com/"&gt;Rarible&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Thank you for taking the time to read, you probably have no idea how blockchain works&lt;/p&gt;

&lt;p&gt;You can check out my article -  &lt;a href="https://dev.to/josh4324/blockchain-for-beginners-5bc0"&gt;Blockchain for Beginners&lt;/a&gt; &lt;/p&gt;

</description>
    </item>
    <item>
      <title>Blockchain for Beginners</title>
      <dc:creator>ADESANYA JOSHUA AYODEJI</dc:creator>
      <pubDate>Thu, 04 Nov 2021 15:33:35 +0000</pubDate>
      <link>https://dev.to/josh4324/blockchain-for-beginners-5bc0</link>
      <guid>https://dev.to/josh4324/blockchain-for-beginners-5bc0</guid>
      <description>&lt;h3&gt;
  
  
  What is Blockchain?
&lt;/h3&gt;

&lt;p&gt;Blockchain is a digital chain of blocks where every block records information about a recent transaction. The chain simply refers to the fact that every new block is added to the current chain of blocks. &lt;br&gt;
The data on the blocks is permanent and not reversible. It is a register or ledger of digital records. The most popular use case currently is for storing transaction data.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is Cryptocurrency?
&lt;/h3&gt;

&lt;p&gt;Cryptocurrencies are digital or virtual currency that is protected by cryptography, making counterfeiting and double-spending impossible.&lt;/p&gt;

&lt;p&gt;The first and most popular cryptocurrency which uses blockchain technology is Bitcoin. Bitcoin's main use case is for transactions outside the traditional financial system. Things like borderless money transfers come to mind.&lt;/p&gt;

&lt;p&gt;Another popular cryptocurrency is Ethereum which also uses blockchain technology. Unlike bitcoin, Ethereum was not created with a specific purpose in mind, and it allows developers to create decentralized applications known as Dapps.&lt;/p&gt;

&lt;p&gt;Blockchains can be centralized or decentralized, decentralized blockchains are immutable, which means data entered can not be changed, no single person or group also has control. All these records on a decentralized blockchain are publicly available.&lt;/p&gt;

&lt;p&gt;The blocks are a kind of database that stores the records. The chain simply refers to the fact that every new block is added to the current chain of blocks. The data on the blocks is permanent and not reversible.&lt;/p&gt;

&lt;h3&gt;
  
  
  How does Blockchain work?
&lt;/h3&gt;

&lt;p&gt;We're used to banks keeping track of our money, which is why we can receive our bank statements at any time, but the blockchain is controlled and managed by a network of computers that anybody can join. &lt;/p&gt;

&lt;p&gt;These computer networks are referred to as nodes. Their main job is to ensure that the transaction is genuine. As a result, all of these nodes or computer networks compete to authenticate the transaction's authenticity.&lt;/p&gt;

&lt;p&gt;There is a reward for the node or machine that confirms the authenticity of the transaction. This is referred to as mining.&lt;/p&gt;

&lt;h3&gt;
  
  
  How does the nodes or network of computer confirm the validity of the transaction?
&lt;/h3&gt;

&lt;p&gt;This is done through what is known as a consensus mechanism.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is a consensus mechanism?
&lt;/h3&gt;

&lt;p&gt;This is the way the blockchain system achieves the necessary agreement on a single value, in this case, the confirmation of a transaction. There are currently several consensus mechanisms but we would look at the most popular two.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Proof of Work&lt;/li&gt;
&lt;li&gt;Proof of Stake&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  Proof of Work
&lt;/h4&gt;

&lt;p&gt;This requires the network of computers to solve very difficult equations to confirm the validity of the transaction. It requires participants to prove that work is done and gives them the right to add a new transaction to the blockchain. &lt;br&gt;
The first participant that can solve the equation correctly will be the one to get the reward for the mining. An example of a cryptocurrency using this is Bitcoin.&lt;/p&gt;

&lt;h4&gt;
  
  
  Proof of Stake
&lt;/h4&gt;

&lt;p&gt;This requires participants to hold or stake coins for them to get the right to validate transactions, the more coins, the user holds or stakes, the more chances the participants have to be chosen to validate the transaction and get the reward for mining.&lt;br&gt;
An example of a cryptocurrency using this is Ethereum.&lt;/p&gt;

&lt;h3&gt;
  
  
  What does the bitcoin transaction process look like?
&lt;/h3&gt;

&lt;p&gt;1 - A new transaction is entered i.e sending bitcoin or buying bitcoin.&lt;br&gt;
2 - The transaction is entered into a node or network of computers&lt;br&gt;
3 - The participants compete on solving a difficult equation, and the first to solve the equation confirms the validity of the transaction and gets the mining reward.&lt;br&gt;
4 - Once the transaction is confirmed, it is added to the block.&lt;br&gt;
5 - The block is added to the chain.&lt;br&gt;
6 - The transaction is complete.&lt;/p&gt;

&lt;p&gt;This article is eye-opening and does not contain everything about blockchain, I hope to write more about it in the future. Thank you for taking the time to read.&lt;/p&gt;

</description>
      <category>blockchain</category>
      <category>bitcoin</category>
      <category>web3</category>
    </item>
    <item>
      <title>Building a PhotoShare App Using Auth0, Cloudinary, React.JS and Supabase.</title>
      <dc:creator>ADESANYA JOSHUA AYODEJI</dc:creator>
      <pubDate>Sat, 16 Oct 2021 10:34:29 +0000</pubDate>
      <link>https://dev.to/hackmamba/building-a-photoshare-app-using-auth0-cloudinary-reactjs-and-supabase-12ne</link>
      <guid>https://dev.to/hackmamba/building-a-photoshare-app-using-auth0-cloudinary-reactjs-and-supabase-12ne</guid>
      <description>&lt;p&gt;Photoshare is an application where users can login using Auth0 and share picture that can be viewed by other users using Cloudinary.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://auth0.com/"&gt;Auth0&lt;/a&gt; is an easy to use authentication and authorization platform, it takes away the stress of authentication and authorization during the building process.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://cloudinary.com/"&gt;Cloudinary&lt;/a&gt; is a service that makes life easy when it comes to working with images, you can upload images, resize images, crop  images and other cool stuffs without installing any complex software or going through heavy documentation.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://supabase.io/"&gt;Supabase&lt;/a&gt; is a firebase alternative, it is very useful in setting up a backend service in few minutes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Perequisites Knowledge&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;React Js&lt;/li&gt;
&lt;li&gt;CSS&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Lets Start Building&lt;/p&gt;

&lt;h2&gt;
  
  
  Setup React
&lt;/h2&gt;

&lt;p&gt;I am assuming we can setup react on our own. In the case when you are unable to set up react.js on your own, check out this tutorial by freecodecamp - &lt;a href="https://www.freecodecamp.org/news/install-react-with-create-react-app/"&gt;How to setup react js&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We need to flesh up our application to make it usable for the demo, i will drop some snippet, all you have to do is replace then in the appropriate files, i will explain where i need to.&lt;/p&gt;

&lt;p&gt;index.html&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;The index.html file is inside the public folder.&lt;/p&gt;

&lt;p&gt;Create a component folder inside your src folder, we will be creating few components.&lt;/p&gt;

&lt;p&gt;main-nav.js&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;nav-bar.js&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;footer.js&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;loading.js&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;br&gt;
index.js&lt;br&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;We are done with our components, now we need to create pages that will make use of the components.&lt;/p&gt;

&lt;p&gt;Create a views folder inside the src folder.&lt;/p&gt;

&lt;p&gt;The following pages will be inside the views folder&lt;/p&gt;

&lt;p&gt;home.js&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;profile.js&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;index.js&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;We are done with the views folder for now. The only files remaining for us to fill up are index.js, app.js and app.css.&lt;/p&gt;

&lt;p&gt;index.js&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;app.js&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;app.css&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;Install Dependencies in react.&lt;/strong&gt;&lt;br&gt;
@auth0/auth0-react,&lt;br&gt;
@material-ui/core,&lt;br&gt;
@material-ui/icons,&lt;br&gt;
@supabase/supabase-js,&lt;br&gt;
react-router-dom,&lt;br&gt;
date-fns&lt;/p&gt;
&lt;h2&gt;
  
  
  Add Auth0 to your React Application.
&lt;/h2&gt;

&lt;p&gt;Sign up for a new account if you dont have one, once your signup is done Auth0 takes you to the dashboard, in the left side menu, click on applications.&lt;/p&gt;

&lt;p&gt;On the applications page, click on the create application button.&lt;/p&gt;

&lt;p&gt;You need to enter the name of the app and choose the application type.&lt;br&gt;
You can use any name you want, we will select the single page web application, this is because we are using react.js.&lt;/p&gt;

&lt;p&gt;When you are done, click on the Create button.&lt;/p&gt;

&lt;p&gt;The next step is to add some urls on the application settings page.&lt;/p&gt;

&lt;p&gt;Make sure you are on the settings page for the application, you just created.&lt;br&gt;
The following fields needs to filled&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Allowed Callback URLs&lt;/li&gt;
&lt;li&gt;Allowed Logout URLs&lt;/li&gt;
&lt;li&gt;Allowed Web Origins&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The base url of the application shoud be entered into the fields above i.e localhost:300 or appzone.com. Make sure you save the changes at the bottom of the page.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Add the Auth0 configuration variables to React&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Create a .env inside the the src folder, populate the following fields&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;REACT_APP_AUTH0_DOMAIN=
REACT_APP_AUTH0_CLIENT_ID=
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;The values can be found on your Auth0 application settings page. &lt;/p&gt;

&lt;p&gt;The first one is the domain value from the settings.&lt;br&gt;
The second one is the client value from the settings.&lt;/p&gt;

&lt;p&gt;The react application can now be able to interact with the Auth0 authorization server.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Set up the Auth0 React SDK&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The Auth0 react dependency has been installed - @auth0/auth0-react&lt;/p&gt;

&lt;p&gt;We need to create a auth folder, where we would have all our authentication files.&lt;/p&gt;

&lt;p&gt;We need to create a Auth0Provider file inside the auth folder to setup Auth0 for react.&lt;/p&gt;

&lt;p&gt;src/auth/auth0-provider.js&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;We need to integrate the Auth0 provider in the index.js, for that to happen, we need to edit out index.js inside the src folder.&lt;/p&gt;

&lt;p&gt;src/index.js&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;At this point, we can run npm start to start up the application to be sure everything is running fine.&lt;/p&gt;

&lt;p&gt;Up next, we will start adding our Login, Signup and Logout button from Auth0.&lt;/p&gt;

&lt;p&gt;We will create our login-button.js, signup-button.js and logout-button.js in the components folder.&lt;/p&gt;

&lt;p&gt;login-button.js&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;We made use of the useAuth0 hook, we got the loginWithRedirect from it, which is useful for our login button.&lt;/p&gt;

&lt;p&gt;signup-button.js&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;logout-button.js&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;We made use of the useAuth0 hook, we got the logout from it, which is useful for our logout button.&lt;/p&gt;

&lt;p&gt;Up next, lets integrate our login and logout button, so that when we are logged in we see the logout button and when we are logged out, we see the login button.&lt;/p&gt;

&lt;p&gt;authentication-button.js&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;Here we got the isAuthenticated from our useAuth0 hook, this is needed to track when we are logged in or logged out.&lt;/p&gt;

&lt;p&gt;Now, we need to create auth-nav.js which will contain our AuthenticationButton.&lt;/p&gt;

&lt;p&gt;auth-nav.js&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;To bring everything together, lets update the nav-bar.js&lt;/p&gt;

&lt;p&gt;nav-bar.js&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;At this point, we can test our application, you should be able to signup, login and logout using Auth0.&lt;/p&gt;

&lt;p&gt;Upnext, we need to secure our routes and access some information from Auth0&lt;/p&gt;

&lt;p&gt;We will create protected-route.js in the auth folder.&lt;/p&gt;

&lt;p&gt;protected-route.js&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;We can now protect all our routes in the app.js file.&lt;/p&gt;

&lt;p&gt;app.js&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;At this point, we can test our application, you should not be able to access the home page and login page. it will redirect you to the an Auth0 login modal when you are not logged in.&lt;/p&gt;

&lt;h2&gt;
  
  
  Setup Cloudinary
&lt;/h2&gt;

&lt;p&gt;If you dont have a cloudinary account, signup on &lt;a href="https://cloudinary.com/"&gt;cloudinary.com&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;First step, we need to add this script to the index.html in the public folder&lt;/p&gt;

&lt;p&gt;We need to create two function in the home.js file, we would make use of it inside the file.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;The cloudname can be gotten on cloudinary dashboard while the presetname can be gotten settings page, upload tab.&lt;/p&gt;




&lt;h2&gt;
  
  
  SetUp Supabase
&lt;/h2&gt;

&lt;p&gt;To create a supabase account, go to &lt;a href="https://app.supabase.io/"&gt;supabase&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;After signup is complete, click on new project&lt;/p&gt;

&lt;p&gt;Chose the existing organisation.&lt;/p&gt;

&lt;p&gt;Fill the create new project form.&lt;/p&gt;

&lt;p&gt;Click on the create new project button to complete the form.&lt;/p&gt;

&lt;p&gt;The setup process runs for a few minutes.&lt;/p&gt;

&lt;p&gt;Once it is done, It will show you the project dashboard, you will see a card which is titled Database, click on the table editor in the card.&lt;/p&gt;

&lt;p&gt;Click on create a new table.&lt;/p&gt;

&lt;p&gt;Enter the table name and description.&lt;/p&gt;

&lt;p&gt;You will also need to add columns to the table, two default columns are already added.&lt;/p&gt;

&lt;p&gt;For the columns, you need to enter the name, type(i.e int) and the default value, you can also specify if you want the column to be the Primary Key.&lt;/p&gt;

&lt;p&gt;What i choose for the Demo&lt;/p&gt;

&lt;p&gt;Table name - Image&lt;br&gt;
Columns (type)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;userId (varchar)&lt;/li&gt;
&lt;li&gt;image (text)&lt;/li&gt;
&lt;li&gt;likes (int)&lt;/li&gt;
&lt;li&gt;dislikes(int)&lt;/li&gt;
&lt;li&gt;desc(text)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Supabase is good to go and ready to be used.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Intergrate Supabase with React&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We will create a client.js file in our src folder.&lt;/p&gt;

&lt;p&gt;client.js&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;To get these detail go the settings page of your supabase dashboard.&lt;/p&gt;

&lt;p&gt;For the config_url, you will get it on the config card, the name of the card is config and the name of the detail you need is URL.&lt;/p&gt;

&lt;p&gt;For the token, the name of the card is Project API keys and the name of the anon public.&lt;/p&gt;

&lt;h2&gt;
  
  
  Finish Up App
&lt;/h2&gt;

&lt;p&gt;Home.js&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;A couple of things is going on in this file but it basically brings together everything we have been working on.&lt;/p&gt;

&lt;p&gt;Three important things to note.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;we imported supabase from the client.js, this is what we would use to create post and get all the posts.&lt;/li&gt;
&lt;li&gt;We are making use of formatDistanceToNow from fns date package to get relative date.&lt;/li&gt;
&lt;li&gt;We are import useAuth0 form Auth0 package. This is where we get the user information such as name, unique id and picture.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;We also added our two cloudinary powered functions, this is what is triggered when the image button is clicked and it pops up the cloudinary widget which we willl use to upload our image.&lt;/p&gt;

&lt;p&gt;We also have two other functions powered by supabase, the first one is the create post, which is called when we submit our post, we also have the getAllImages function which triggers when the page reloads or when a post is created.&lt;/p&gt;

&lt;p&gt;We also make use of useState to keep track of our states, useEffect to run functions when a page is reloaded and useRef to get data from elements.&lt;/p&gt;

&lt;p&gt;We also obviously added some html and css to make it look a little bit nice.&lt;/p&gt;

&lt;p&gt;I hope you have been able to learn a few things from the tutorial and the code snippets, in order to solidify your knowledge, you can complete the profile page, by displaying the user data and only the user’s posts on the page.&lt;/p&gt;

&lt;p&gt;Thank You.&lt;/p&gt;

&lt;p&gt;Link to the demo - &lt;a href="https://jbwym.csb.app/"&gt;https://jbwym.csb.app/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Content created for the &lt;a href="https://content.hackmamba.io/"&gt;Hackmamba&lt;/a&gt; Jamstack Content Hackathon with &lt;a href="https://auth0.com/"&gt;Auth0&lt;/a&gt; and &lt;a href="https://cloudinary.com/"&gt;Cloudinary&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>auth0</category>
      <category>cloudinary</category>
      <category>react</category>
      <category>supabase</category>
    </item>
    <item>
      <title>How to create a Todo CLI App with Node JS.</title>
      <dc:creator>ADESANYA JOSHUA AYODEJI</dc:creator>
      <pubDate>Tue, 24 Nov 2020 13:34:53 +0000</pubDate>
      <link>https://dev.to/josh4324/create-a-todo-cli-app-with-node-js-3hbc</link>
      <guid>https://dev.to/josh4324/create-a-todo-cli-app-with-node-js-3hbc</guid>
      <description>&lt;p&gt;Node JS is very versatile and can be used to develop application on the web, mobile and even on the command line interface.&lt;/p&gt;

&lt;p&gt;This tutorial will be focusing on building a Todo App on the command line interface.&lt;/p&gt;

&lt;p&gt;In order for us to us develop CLI Application, we need to be able to collect input from the CLI, we can collect inputs in nodejs by using the process.argv.&lt;/p&gt;

&lt;p&gt;Step 1.&lt;br&gt;
Open your preferred code terminal and navigate to the folder that will contain your application.&lt;/p&gt;

&lt;p&gt;Run npm init -y to initiate your node app and get your started.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9mjH-Ytr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/i2vxls6xe07fr713vij8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9mjH-Ytr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/i2vxls6xe07fr713vij8.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Your folder should now contain a package.json.&lt;/p&gt;

&lt;p&gt;Lets test how process.argv works&lt;/p&gt;

&lt;p&gt;Create a file, name the file app.js, inside the file, write console.log(process.argv).&lt;/p&gt;

&lt;p&gt;Run the node app by typing node app.js Your Name on the terminal.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9GyTbukt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/0g4n8wn7nfx3stco1zhv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9GyTbukt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/0g4n8wn7nfx3stco1zhv.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The result we got is an array that contains 3 things&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Path to the node executable file&lt;/li&gt;
&lt;li&gt;Path to the file, we are trying to run&lt;/li&gt;
&lt;li&gt;The argument we added (Your Name)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This means that our first argument from the command line can be gotten by typing process.arg[2], subsequent argument will be 3, 4 and so on.&lt;/p&gt;

&lt;p&gt;We would not be using process.argv to build our CLI App, i just showed you so you can know what happens behind the scene in the package we are about to use.&lt;/p&gt;

&lt;p&gt;We would make use of the yargs package - &lt;a href="https://www.npmjs.com/package/yargs"&gt;https://www.npmjs.com/package/yargs&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Step 2:&lt;/p&gt;

&lt;p&gt;Install Yargs -run npm install yargs&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--hGJ8tWrG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/2xnz5u75878wdbfuaiei.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hGJ8tWrG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/2xnz5u75878wdbfuaiei.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Yargs is now up, lets set it up.&lt;/p&gt;

&lt;p&gt;We can delete the console.log(process.argv).&lt;/p&gt;

&lt;p&gt;Add yargs to app.js&lt;/p&gt;

&lt;p&gt;const yargs = require("yargs");&lt;/p&gt;

&lt;p&gt;The yargs object has a method command which takes in an object, the object has properties such as command, describe, builder, and handler.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--MVY9qpq2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/lweezv9q0xsot2lig8ad.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--MVY9qpq2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/lweezv9q0xsot2lig8ad.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The command property is the argument that triggers the handler function.&lt;br&gt;
The describe property explains what our command is trying to do. The builder property helps us to describe our other argument, from the image above, we have two additional argument, title and todo, and lastly the handler contains the function we want to run, in this case it is the add a new todo.&lt;/p&gt;

&lt;p&gt;The next question is how do we run it.&lt;/p&gt;

&lt;p&gt;To run a command in our CLI APP, we type node app.js add --title="coding" --todo="code a new app".&lt;/p&gt;

&lt;p&gt;For this to run successfully, we need to add a yargs.parse(); at the end of the our file app.js.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--GlXWdYT4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/bt7sfhzz124i2noe83k1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--GlXWdYT4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/bt7sfhzz124i2noe83k1.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We were able to trigger the handler function using the command in the image below and inside the handler function, we have a console.log(argv), which logs out the title and body, now that we have access to them we can start implementing our logic.&lt;/p&gt;

&lt;p&gt;We need to create another file which will contain all the business logic needed for this application to work. lets name it utils.js&lt;/p&gt;

&lt;p&gt;What do we need &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create todo &lt;/li&gt;
&lt;li&gt;List todos&lt;/li&gt;
&lt;li&gt;Display one todo &lt;/li&gt;
&lt;li&gt;Delete todo&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;We also need to store the todos somewhere, we would store them in a json file, this will make it possible for us to save and retrieve all the todos. We would also need the node fs module in order to write and read from the json file.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;br&gt;
we can actually abstract the code above to make it more clean but i am trying to limit the number of functions i will write for the purpose of this tutorial.

&lt;p&gt;Up next, we need to create another function to List all the available todos.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;Up next, we need to create a function to display a specific todo.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;Up, next, we need to create a function to delete a todo.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;We have all of our four function ready, it is time to integrate them into our CLI Application.&lt;/p&gt;

&lt;p&gt;Step 3&lt;/p&gt;

&lt;p&gt;In order for us to have access to our functions in app.js, we need to export our functions.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--iFX2PO15--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/l48ipfq3dq1i3i3s51yn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--iFX2PO15--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/l48ipfq3dq1i3i3s51yn.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Setup Yargs for create todo&lt;/li&gt;
&lt;/ul&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;The createTodo function has been added to the handler.&lt;/p&gt;

&lt;p&gt;To test this - run node app.js add --title="code" --todo="code by night"&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NMI4ezO2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/k4wxwegjiwilpmrqya5a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NMI4ezO2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/k4wxwegjiwilpmrqya5a.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Setup Yargs to get all todos&lt;/li&gt;
&lt;/ul&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;The listTodo function has been added to the handler.&lt;/p&gt;

&lt;p&gt;To test this - run node app.js list &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--KguTTv2P--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ip1ahj88z1x9v63hnkxl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KguTTv2P--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ip1ahj88z1x9v63hnkxl.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Setup Yargs to get one todo&lt;/li&gt;
&lt;/ul&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;The getOneTodo function has been added to the handler.&lt;/p&gt;

&lt;p&gt;To test this - run node app.js read --title="code" &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--SNDR0qtX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/dsh6pb4199jka3it5vy1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SNDR0qtX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/dsh6pb4199jka3it5vy1.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Setup Yargs to delete todo&lt;/li&gt;
&lt;/ul&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;br&gt;
The deleteTodo function has been added to the handler.

&lt;p&gt;To test this - run node app.js delete --title="code" &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Qgci8Ery--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/gq37igvj9et1gmn8herq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Qgci8Ery--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/gq37igvj9et1gmn8herq.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;How to improve the app.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Abstract the code, their is a lot of code repetition, extrat them and make it a function.&lt;/li&gt;
&lt;li&gt;Make the console better by decorating it, instead of consoling objects, you can just console the todos.&lt;/li&gt;
&lt;li&gt;Be creative.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Link to full code on github&lt;br&gt;
&lt;a href="https://github.com/Josh4324/Todo-CLI-APP-NodeJs"&gt;https://github.com/Josh4324/Todo-CLI-APP-NodeJs&lt;/a&gt; &lt;/p&gt;

</description>
      <category>node</category>
      <category>todo</category>
      <category>yargs</category>
      <category>cli</category>
    </item>
    <item>
      <title>Understanding Javascript array methods Time complexity (BIG O Notation).</title>
      <dc:creator>ADESANYA JOSHUA AYODEJI</dc:creator>
      <pubDate>Sat, 15 Aug 2020 14:56:53 +0000</pubDate>
      <link>https://dev.to/josh4324/understanding-javascript-array-methods-time-complexity-big-o-notation-4dlc</link>
      <guid>https://dev.to/josh4324/understanding-javascript-array-methods-time-complexity-big-o-notation-4dlc</guid>
      <description>&lt;p&gt;This is my first post, i hope you learn something.&lt;/p&gt;

&lt;p&gt;To explain big o notation, let me use an example, lets say we have to solve a problem or build something, we need an algorithm, algorithm is just a step by step instruction telling the computer what to do. &lt;/p&gt;

&lt;p&gt;Most of the time if not all the time, there are more than one way for getting the desired result, wont it be nice if there is a way of comparing two or more algorithm to know which one is better. &lt;/p&gt;

&lt;p&gt;This is exactly what  BIG O Notation does. it basically compares using the time complexity or space complexity.&lt;/p&gt;

&lt;p&gt;It is not perfect but it gives us a simplified view of the worst case scenario when comparing two algorithm or knowing how good your current solution or algorithm is doing.&lt;/p&gt;

&lt;p&gt;I will list and discuss some of them briefly&lt;/p&gt;

&lt;p&gt;Constant Time O(1) - When you code an algorithm and it runs in the same time or space regardless of the inputs you used. We can say that the algorithm runs at constant time.&lt;/p&gt;

&lt;p&gt;What javascript array methods runs at constant time?&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;PUSH&lt;/li&gt;
&lt;li&gt;POP&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Push adds an item to the end of an array&lt;br&gt;
Pop removes an item at the end of an array&lt;/p&gt;

&lt;p&gt;Since both actions do not affect the index of the array in anyway they are done at constant time which means that, it does not matter how large an array, the time it takes to remove and add an item will always be the same.&lt;/p&gt;

&lt;p&gt;Linear time O(N) - When you code an algorithm and the time or space it takes to run is directly proportional to the inputs used. This means that increasing the inputs of the algorithm will increase the time or space it takes to run. For illustration purposes, if using an array with 10 items will take 1 minute to run, using an array wit 20 items will take 2 minutes to run.&lt;/p&gt;

&lt;p&gt;What javascript array methods runs at Linear time?&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Shift&lt;/li&gt;
&lt;li&gt;Unshift&lt;/li&gt;
&lt;li&gt;Concat&lt;/li&gt;
&lt;li&gt;Slice&lt;/li&gt;
&lt;li&gt;Splice&lt;/li&gt;
&lt;li&gt;Foreach&lt;/li&gt;
&lt;li&gt;Map&lt;/li&gt;
&lt;li&gt;Filter&lt;/li&gt;
&lt;li&gt;Reduce&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;But shift and unshift does almost the same thing as push and pop, why are they not using constant time. Well shift and unshift affects the index of the array. shift removes the first element of an array while unshift add an element to the beginning of an array. This leads to extra work to change the index for all the items in the array. i just heard someone say loops. Yes you are right, that sounds like the work for a loop and anytime a single loop is involved, you are probably using a linear time because the length of the input matters. The higher the inputs, the more time it takes. Foreach, reduce, filter, splice, slice all makes use of loops under the hood.&lt;/p&gt;

&lt;p&gt;Quadratic Time O(N^2) -  When you code an algorithm and the time or space it takes to run is directly proportional to the square the size of the inputs used. i dont think it is clear enough so lets say you have a loop then you have another loop inside the first loop, this will lead to you having an algorithm with a quadratic time complexity.I always try to avoid using nested loops.&lt;/p&gt;

&lt;p&gt;What javascript array methods runs at Quadratic time?&lt;/p&gt;

&lt;p&gt;None ? well if you know one let me know in the comments&lt;/p&gt;

&lt;p&gt;There are other types like O(Log N). I dont really know how to explain that well enough, maybe next time.&lt;/p&gt;

&lt;p&gt;THANK YOU FOR READING&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>time</category>
    </item>
  </channel>
</rss>
