Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
/

Understanding Blockchain Technology and Smart Contracts
Picture Understanding Blockchain Technology and Smart Contracts: What They Are and How They Work 2 | TON app

Technology and Smart Contracts

Explore the essentials of blockchain technology and smart contracts. Learn how they function, their advantages, and their transformative potential across industries.
This post serves as an introduction to our work and explores the distinctive aspects of blockchain technology and its applications. We will also clarify fundamental concepts such as smart contracts and gas fees. If you’re new to these topics, this guide is an ideal starting point.

The Traditional Internet (Web2)

The term Web 2.0 refers to the conventional internet that we are familiar with today. This version of the internet is predominantly managed by major corporations like Google. These entities are primarily driven by the goal of maximizing profits for their shareholders, with the welfare of users being a secondary consideration.

Consider a Web2 service like Gmail. As a user of Gmail, you are not on equal footing with Google, the service provider. This phenomenon is known as centralization. In centralized systems, users do not possess genuine ownership. For example, if Google deems that you have violated its terms of service, it has the authority to revoke your access to your email account. Centralized services are also permission-based; you need explicit approval to use the service and send emails. If Google categorizes your email as spam, it is under no obligation to deliver it.

Centralization relies on trust. Users grant power to companies like Google based on their confidence in these entities to handle this power responsibly.

The Next Generation Internet (Web3)

Many of us consider the Internet as a shared resource, a medium that connects the world into a cohesive global community and facilitates communication and collaboration. We envision a future where control shifts from large corporations to individual users. Web3 embodies this vision, representing the anticipated next phase in the evolution of the Internet.

In this vision, users of Web3 services have the same level of authority as the creators of those services. This principle, known as decentralization, ensures that users have genuine ownership—not just of their data but also of digital assets. For instance, your cryptocurrencies like Bitcoin or Toncoin are fully yours and cannot be seized by anyone. Decentralized services also operate on a permissionless basis, meaning you can transfer your Toncoin or perform other transactions without needing approval from anyone else. No one can block or censor your actions.

Decentralization enables systems to be trustless. With no central authority, there is no risk of abuse of power that could harm users.

Blockchain Technology

The concept of Web3 appears promising, but how practical is it? For developers, creating services where the user and provider are on equal footing can be challenging. Typically, developing a service involves setting up a backend that operates on a server owned by the developer. This server can be modified or even shut down by the developer, leading to an unequal relationship. Traditional backend servers are centralized.

Blockchain technology was designed to address this issue, enabling the creation of decentralized backends. In a blockchain system, the backend is maintained by its users. This equal relationship means that any user interested in contributing to the backend can do so, with the blockchain functioning as a cooperative effort among its participants.

Collaboration in blockchain networks is managed through consensus. For an outcome to be validated, it must be agreed upon by a majority of users. This process makes blockchains less efficient compared to traditional centralized servers, as each calculation requires confirmation from multiple participants. Additionally, operating blockchains can be more costly due to their inherent inefficiencies.

The Token

We previously discussed how results are validated through voting. But how does this voting system function? Is it a straightforward “one user, one vote” model like in traditional elections? In practice, this approach is impractical on the Internet due to a challenge known as the Sybil attack. It’s easy to create numerous fake identities online. Given the decentralized nature of Web3, we lack a centralized authority to differentiate between genuine and fraudulent users.

A common decentralized approach to addressing this issue is to tie voting power to a token. For instance, if you possess 10 tokens, you are granted 10 votes. Unlike fake identities, tokens are difficult to counterfeit, making it easy to distinguish legitimate tokens from fraudulent ones. The TON blockchain utilizes Toncoin, while the Ethereum blockchain uses Ether. This implies that every blockchain operates as an economy in its own right. Tokens serve as an incentive to ensure that the decentralized network remains aligned with its goals.

Network Validators

Blockchains function as networks managed by a group of users. Those who handle the core operations and participate in the consensus process are known as validators. The influence of each validator in the voting process is proportional to the number of tokens they hold. To ensure validator integrity, they typically must stake their tokens. Should the consensus process determine a validator is acting dishonestly, their staked tokens may be forfeited as a penalty. This system of governance is known as proof-of-stake.

Being a validator is demanding, requiring the operation of a blockchain node on a personal server and staking a significant amount of tokens. Users with fewer tokens who wish to participate can delegate their tokens to a more prominent validator. These users are referred to as nominators.

Transaction Fees

As previously mentioned, blockchains function as economies. The infrastructure necessary for validators is not free, so they must be compensated for their services. Payments are made using the blockchain’s native token. For example, on the TON blockchain, users pay fees with Toncoin. Validators earn Toncoin for processing transactions and running applications on the blockchain.

When a user performs an action on the blockchain, they initiate a transaction that includes a fee known as gas. This concept is analogous to a car needing fuel to operate. Users must authorize transactions using their blockchain wallets, which ensures that only the wallet’s owner can approve the payment of gas and finalize the transaction.

Decentralized Applications (Dapps)

As we previously mentioned, blockchains are designed to operate decentralized backends. These blockchain-based services are commonly referred to as apps, or more specifically, decentralized apps, abbreviated as dapps. Developers create dapps, which are executed by network validators. Users engage with dapps by sending transactions to them. In a decentralized system, the developer of a dapp has the same status as its users, with no special privileges.

To illustrate this, consider a traditional Web2 service such as Google Search. The provider of this service, Google, controls search result rankings for user benefit but can also promote its own products. For instance, when searching for “storage,” Google might prioritize “Google Drive” over “Dropbox.” In a Web3 version of Google Search, the developer would not have the ability to favor their own products in the search results.

Smart Contracts

In the Web2 world, services like Google Search come with terms of service. If users feel wronged, they can seek judicial resolution. Web3 operates differently, lacking centralized authority figures like judges. Instead, the code governs the rules. In this context, the code of a dapp serves as the binding agreement between its users. Unlike traditional legal contracts, this code executes consistently and is not open to interpretation.

Blockchain technology substitutes traditional legal agreements with code. This code, known as a smart contract, defines the terms of the dapp. Users are expected to review the smart contract’s source code before participating, just as one would thoroughly read a lease agreement before signing it. Communities often assist each other in this process since not all users have the technical expertise to review code independently.

Once a smart contract is written, deploying it to the blockchain makes it accessible to everyone. This deployment process involves publishing the contract code to the blockchain, where it is identifiable by its contract address.

Blocks and Explorers

Previously, we discussed how network validators are required to vote on the outcome of each transaction. To simplify this process, transactions are grouped into blocks. Each block is assigned a unique block number and undergoes a consensus process, requiring approval from a majority of validators. Arranging these blocks sequentially forms a chain—hence the term “blockchain.”

After initiating a transaction, users must wait for it to be included in a block. On the TON blockchain, a new block is created approximately every 5 seconds. Users can track transactions, verify their success, and identify which block they were included in using a tool known as a block explorer, or simply an explorer.

The Practical Value of Blockchain

In this discussion, we have primarily explored the concept of blockchain and defined key terms. While the technology may seem complex and abstract, it offers practical benefits. Can we provide a concrete example of how blockchain can enhance daily life?

In 2018, I published a two-part series on this topic. Part 1 is titled “How Blockchain Can Assist You on a Deserted Island,” and Part 2 is “How to Operate a Blockchain on a Deserted Island with Pen and Paper.” If you enjoyed the TV series Lost, you might find these articles intriguing.

Happy coding!

Tal is the founder of Orbs Network. He is an enthusiastic blockchain developer, advocate of open-source projects, and contributor to the TON ecosystem. Follow Tal on GitHub and Twitter. If you notice any errors in this post, please reach out to Tal on Telegram.