End-to-End Web3 dApps

Amanuel Zewdu
5 min readOct 1, 2022

Certificate generation, distribution, and value transfer with Algorand NFTs and smart contracts

INTRODUCTION

Web3 technology is inherently about the user controlled internet. It is being achieved by a growing stack of decentralized technologies, such as blockchains, smart contracts, oracles, crypto wallets, storage networks, and more.

In this project, the client would like to solve the challenge of ensuring that certificates are available to all trainees in a secure way, and (if possible) that certificate holders can benefit from smart contract actions now and in the future.

What is web3? How is it different from web2?

A simplistic version of today’s Web 2.0 architecture includes a client
software, usually a browser or a self-contained application, and a suite of servers providing content and logic, which are all controlled by the same entity. There are many examples in the pages of technology history of how internet companies have changed the rules on their users or stopped their service, with users having no power to preserve the value they’ve created.
Meanwhile, the Web 3.0 architecture allows two things:
1. Allowing applications to place some or all of their content and logic on to a public blockchain. Contrary to standard Web 2.0, this content and logic can become public and accessible by anyone.
2. Allowing users to exert direct control over this content and logic. Unlike
Web 2.0, users don’t necessarily need accounts or privileged API keys to
interact with what’s on the blockchain.

The WEB3 Tech-stack

The Components of the Tech Stack

Layer 0

P2P internet overlay protocols

e.g. Devp2p, Libp2p

Platform-neutral computation description language

e.g. EVM, WASM, UTXO

Layer 1

Data distribution protocols

e.g. IPFS, Bluzelle, Fluence, Swarm

Low-trust interaction platforms

e.g. Polkadot

Low-trust interaction protocols

e.g. Ethereum, Bitcoin, Zcash, Polkadot parachains

Transient data messaging

e.g. Whisper, Matrix

Layer 2

Second layer protocols

e.g. (various)

Layer 3

Protocol-extensible developer APIs & languages

e.g. Web3.js, ether.js, oo7.js, Solidity, Rust

Layer 4

Protocol-extensible user-interface crade

e.g. Status, Metamask, MyCrypto, Parity

What are NFTs?

NFTs (non-fungible tokens) are unique cryptographic tokens that
exist on a blockchain and cannot be replicated. A good analogy here is a
ball signed by a famous football player. It can not be traded for the same
but unsigned ball, or an ordinary price. Hence it is non-fungible. In
blockchains NFTs add values to assets.

What are smart contracts?

Algorand’s smart contracts are basic lines of code that are stored on a blockchain and automatically execute when certain conditions are met, enabling developers to build dApps that are highly scalable, secure, and low cost to execute.

What are Dapps?

Lets cut to the chase. dApps, which is the abbreviation for decentralized applications, are programs or digital apps that run on either blockchain or a peer-to-peer network of computers. These applications are essentially decentralized to a great extent and cannot be controlled by a single authority.

The big difference between dapps and apps is that a dapp has its back-end code running on a decentralized peer-to-peer blockchain network. In contrast, an app’s back-end code runs on a centralized server or multiple centralized servers. DApps provide many benefits, including privacy.

Blockchain wallets

A blockchain wallet is a digital wallet that allows users to store and manage their Bitcoin, Ether, and other cryptocurrencies. Blockchain Wallet can also refer to the wallet service provided by Blockchain, a software company founded by Peter Smith and Nicolas Cary. A blockchain wallet allows transfers in cryptocurrencies and the ability to convert them back into a user’s local currency.

Creating an e-wallet with Blockchain Wallet is free, and the account setup process is done online. Individuals must provide an email address and password that will be used to manage the account, and the system will send an automated email requesting that the account be verified.

Methodology

After understanding the main concepts behind, this project was divided into 3 main objectives.

  1. The first step towards achieving the goal was using sandbox test-net to explore the Algorand blockchain by creating some transactions and assets. A github repo was first set then a clone to the docker instance provided by algorand to setup a node using the following commands.

git clone https://github.com/algorand/sandbox.git

cd sandbox

./sandbox up testnet

Algorand provides an SDK for Python which is available as a pip package. To install the Python SDK, open a terminal and run the following command. Using this SDK it is possible to interact with assets and transactions programmatically.

pip3 install py-algorand-sdk

2. Then by choosing react app as a front-end tool a nice UI was designed that prompts the following functions.

  • A staff role to issue NFTs and distribute
  • A trainee role to be able to opt-in to the NFT certificate using his/her Public Key
  • A staff role to receive trainee’s opt-in request, and approve/decline the transfer of an NFT certificate to the trainee’s Public Key
  • A trainee to be able to check the approval or denial of their request.

3. Finally after testing and CI of the front end with the static(dummy) data, a backend was designed. The backend logic consisted of API endpoints using Flask and Algorand Python SDK and the python backend code Tests (PyTest). The backend connects to Algorand Node (local host: Sandbox, public TestNet: PureStake), connects to an IFPS node and creates NFT.

CONCLUSION

In this project, the client is 10 Academy; the client would like to solve the challenge of ensuring that certificates are available to all trainees in a secure way, and (if possible) that certificate holders can benefit from smart contract actions now and in the future. At present, certificates are distributed as simple PDF files, without the ability to verify their authenticity nor can 10 Academy undertake smart actions with the trainees/their contracts. To tackle this drawback, this project built an end-to-end Web3 dapps on the Algorand Blockchain that will help 10 Academy generate and distribute Non-Fungible Tokens (NFTs) as certificates that will represent the successful completion of a weekly challenge to trainees, and allow trainees with NFTs to interact with a smart contract to perform per-defined actions.

Future works

In the future we plan to implement an Algorand smart contract that is bound to the NFT assets and which will accept and distribute donations to trainees who owns the corresponding NFTs. We will also include smart contract tests using pyteal and add a public role for anyone to donate allowed assets to a particular NFT owner along with trainee role for whoever is owner of an NFT certificate to request an action (e.g withdraw token if available) allowed by the smart contract in the front end.

--

--

Amanuel Zewdu

Junior data engineer who builds scalable data pipelines using ETL tools; Airflow, Kafka and Dbt with data modeling dexterity; Python and SQL