A beginner's guide to building Web3 Dapps using Next.js and Motoko smart contracts running on the blockchain of Internet computers
Detailed introduction
The purpose of this article is to give newbies a quick look at Web3Dapp. In addition to the simple helloworld exception, a live display installed on the local machine and the full source code are also provided.
Web3 technology stack
Imagine a web application that runs entirely on a blockchain without access to all cloud servers. In general, blockchain refers to a distributed accounting database system with a consensus algorithm. Sometimes they can use blockchain technology, but many of them are not. If there is a way to develop new web applications, Smart contracts will be brokered in HTTPS Internet Services Smart Contracts.
Type your name and click Push to play with the waiting instance. He will send your name to canister, and canister will reply with his name. Then upload the photo and submit it at the same time. It stores the image in back-end storage (so select a few small items) and loads it into your home as an HTML file.
Beginner's manual
Developed from DfinityFoundation, this simple web application hosts an Internet electronic computer (IC) on a blockchain. He works for three canisters, or Smartcontracts. This is also three cans:
The Helloworld category has end-to-end back-end smart contract interactions
Examples of image submission include selecting an image and submitting an image to Canister, loading the image into Canister, and displaying it as HTML
Static data property (HTML/CSS/JavaScript) for Next.js export Https:// Web service utensil
When you upload an image to an image container, it is essentially a smart contract upgrade transaction involving consensus across several nodes. The final decision takes only two seconds. Since every Crist is also an Actor, every public escalation function formula is guaranteed atomicity across nodes (as long as the internal structure of the function formula has no other await enabled, otherwise it will be committed several times). In addition, uploaded images will automatically back up statements in storage. Therefore, you can forget about database system definitions for a while, or for example, CloudServices3 buckets.
While it will certainly work for all categories of test cases, it does encourage you to think outside the box and imagine applications developed and designed in new and upgraded ways that have never been done before.
According to the components of the program preparation application ReactHook
Reacthoks are not uncommon. I found him very useful in numbering before applying the Dfinity proxy. In the Image instance (refer to Imagesection.js), it does three things:
Upload the image to a smart contract
Image loading smart contract
A 3D rendered image in HTML
The Dfinitydfx directive provides a way for front-end engineer applications (such as JavaScript or TypeScript) to form UI interpretations to form Canister public role function formulas and basic data types. With Reacthoks, it can wrap formal images into logic.
Given the image ID, enter the binary target from the Canister image actor and display it as an HTML image source.
Alternatively, Imagesection can interact directly with the image canisteractor using the image UI declaration. By using the useimageobject hook, it wraps the diversity behind the scenario and supports composition logic for future applications. It follows the way of the service layer and the service locator.
It is important to note that Candid(the jack Description language) allows for front to back interoperability. You can leave JSON analysis completely.
Network computer Web3 technology stack Technology stack technology
Dfinity has created a particularly good infographic PDF summarizing the Internet electronic computer. Please have a look.
Here's what I want to say:
As the smart contract behind you
The Web Service Project utensil is used to manage the property before the Web and to provide Web services
Endlessly expanding according to the subnet mask
Consensus Upgrade enables Canister for the last 2 seconds
Opposite direction gas physical model (customers do not need to pay for each smart contract buy and sell)
Orthogonality and continuity (your smart contract algorithm design can be declared relatively stable)
Original Actor and Actor types
Write code in Motoko or Rust to compile Webassembly(WASM)
Dynamic passwords can be stored and pushed to Canister, such as ICP dynamic passwords
While each point is worth a full post, if you're a developer, you probably have a lot of work experience or environment. Like Actor, you've probably already used it in Scala or Swift (most recently when developing iOS apps).
You may have used EthereumSolidity Smart Contracts, but mostly for transactions, currency, NFT, or DeFi in the moneyclip category. Have you ever thought about developing and designing your back in smart contracts? Hopefully, this live demonstration and example coding will give you a basic understanding.
For traditional developers, because the technical characteristics cannot be generalized with IC, it is often difficult to meet the technical characteristics of Internet electronic computers. From a computational point of view, it's like a Serverlesfunction. You can only pay for calculations when you execute functions that the application responds to according to your capabilities. There are also memory and storage costs, but only for real applications.
Depending on the orthogonality and continuity of the stable variables, serializable algorithm designs can also distribute locks in storage and survive the next upgrade when a new program structure is introduced. It contains multiple master (write)/multiple copy (read) file storage in the subnet mask.
Imagine that MongoDB or RDMSDB is arranged in different locales, where there are multiple primary cases of an extensibility group set that can write to protect the group or allow reading and writing. The difference is that with each new Canister arrangement you get such a creative architectural design. It is not an exact synonym because its consensus protocol is much more complex than that provided by the database system reseller.
My journey to Web3
If you notice my website in the Medium, you may have read my other answers, including artificial intelligence, the depth of the neural network, strengthen learning, and "QuantitativeFinancewithCryptosassets" in the near term. They were interesting thematic styles until I got my hands on Internet computers in 2021. After Genesis 1 was announced in May 2021, I began to learn the Internet electronic computer and become a developer's practical experience. In August 2021, the founders and I started a new Web3 project called contentfly. There are still some things to learn. It's been an interesting journey. The Next.js ICStartertemplate code is based on the experience I learned while developing and designing contentflyDapp. I can add many valuable examples in the future.