top of page

The Pedagogical Palette: Exploring Diverse Teaching Methods

CTRL+Hack+ZK: Scaffolding your dApp with ink!athon - Part 1



In January 2024, Dennis Zoma (Co-founder of Scio Labs) and the developers behind AZERO.ID, the official DNS (Domain Name Service) on Aleph Zero that's written in the ink! Smart Contract, spoke expressly about building full-stack dApps using a dev tooling kit called 'ink!athon' at the CTRL+Hack+ZK hackathon that was organized by Aleph Zero.


## Part 1: Building The Foundation 

Why Frontend Matters


During the bustling event, the atmosphere resonates with vigor, mirroring the energetic grace of new wine flavors pirouetting on the palate. As participants immerse themselves in the coding symphony cum workshop, a lingering echo of yearning for another gathering intertwines with a zest reminiscent of an autumn breeze, filled with hopeful anticipation for a promised future rendezvous.


According to Dennis Zoma, a decentralized app, or DApp, operates on a blockchain network, using both decentralized front-end and back-end components. The front end is the user interface (UI), while the back end involves the application's logic and data storage. The decentralization aims to distribute control and eliminate single points of failure, often achieved through smart contracts on the blockchain. How do the front end and back end contribute to decentralization? Here is how:



Front-end:

  • Connecting the browser to the blockchain: Establishing a direct connection between the user's browser and the blockchain decentralizes the interaction, reducing reliance on centralized servers.

  • Interacting with the blockchain using a wallet extension: Using a wallet extension, a user can interact with the blockchain directly from their browser, decentralizing the management of cryptocurrency wallets and transactions.

  • Retrieving data from IPFS (InterPlanetary File System): Retrieving data from IPFS instead of the traditional AWS servers embraces a decentralized approach to storage. IPFS operates seamlessly with the distributed nature of blockchains, allowing efficient data retrieval across multiple nodes, the censorship-resistant nature of IPFS contributes to the security of smart contracts, vital in decentralized applications while the content addressing mechanism ensures immutable data, crucial for the integrity of smart contracts.

  • Using light clients: Light clients allow direct connection to the blockchain without relying on RPCs (Remote Procedure Calls) or centralized servers. This decentralizes the process of interacting with blockchain data.


These front-end methods contribute to decentralization by reducing reliance on central servers and promoting direct interactions with blockchain networks and decentralized storage solutions like IPFS.


Back-end:

  • No Reliance on Traditional Databases: Departing from reliance on popular databases like Postgres or SQL eliminates the centralization inherent in traditional Web 2.0 setups. Traditional databases are typically centralized and at risk of single points of failure.

  • Storage on the Blockchain: Unlike a centralized database, storing data on the blockchain itself, decentralizes the data storage infrastructure. In a blockchain, data is distributed across nodes in a peer-to-peer network, reducing the risk of manipulation or data loss through centralized control.

  • Managed through Smart Contracts or Pallets: Using smart contracts or pallets (in Substrate-based blockchains like Polkadot) for managing data introduces decentralized execution logic. Smart contracts are self-executing and operate on a distributed network of nodes, ensuring that the rules governing the data are not controlled by a single entity.

  • Indexed by an Indexer Network: An indexer network, when decentralized, ensures that data retrieval and querying are not reliant on a centralized service, enhancing the overall decentralization of the system. Therefore, Indexing data on a network of indexers further distributes the responsibility of maintaining and accessing data.


By departing from traditional databases, opting for data storage on the blockchain through smart contracts or pallets, and leveraging decentralized indexing networks, the back-end becomes more resilient, resistant to censorship, and less dependent on centralized infrastructure.


Dennis Zoma (the Co-founder of Scio Labs and AZERO.ID), acknowledging the broader scope of blockchain and crypto applications, emphasized the significance of not solely focusing on smart contracts and backend development but also prioritizing the front end. Recognizing that achieving widespread adoption requires significantly improved user experience (UX), he advocated for creating interfaces that are not only intuitive but aim for a "10x better UX" to onboard the masses, highlighting the inadequacy of hacky command line interfaces and stressing the need for user-friendly applications. Additionally, he recognized the importance of a "10x better DX" to onboard substrate frontend developers by enhancing the developer experience. The commitment to addressing these challenges is evident in the ink!athon project, which aims to contribute to achieving superior UX and a smoother onboarding process for both end-users and front-end developers.


"An unpopular opinion of mine is that crafting a good design and delving into frontend work demands a considerable investment of time compared to contract work. It's not that contracts are a breeze – far from it. Yet, when you factor in the entire process, from conceptualizing initial sketches to shaping the first UI frames, executing the frontend, engaging in feedback loops, and fine-tuning it based on client input, it becomes evident that the complexity extends beyond a mere contract audit" - Dennis Zoma



Introducing the ink! dApp Tooling Kit


During the CTRL+Hack+ZK hackathon, Dennis Zoma and the developers at AZERO.ID unveiled their full-stack dApp boilerplate, ink!athon, which gives the audience a peek under the hood to assist them on their development journey on Substrate systems, Aleph Zero, and ink!, a Rust-based smart contract programming language. There are 4 elements to ink!athon:


Contract Level

  • ink!: Described as a Rust EDSL (Embedded Domain-Specific Language), ink! is a framework specifically crafted for writing efficient smart contracts on a blockchain. It provides abstractions and functionalities tailored to the requirements of blockchain development.

  • Cargo Contract: Cargo is the package manager for Rust, and "Cargo Contract" is a command-line tool or module associated with managing and building smart contracts written in ink!. It suggests a specific workflow for compiling and handling contracts within the Rust ecosystem.

  • CLI (Command-Line Interface): The Command-Line Interface is a tool that allows developers to interact with and control the deployment of smart contracts. Using the CLI, developers can execute various commands to deploy, manage, and test their smart contracts on the blockchain.

  • PSP22 & PSP34 by Cardinal Cryptography: PSP22 and PSP32 serve as standards for fungible and non-fungible tokens on Aleph Zero (not A0), offering equivalents to ERC20 and ERC721 in the Ethereum ecosystem. These standards provide a structured framework for developers to deploy their tokens on the Aleph Zero blockchain. For easy deployment, the recently announced Cardinal Cryptography repositories, especially the readme files, offer comprehensive documentation with examples and guidelines, simplifying the process of creating and utilizing fungible or non-fungible tokens within the Aleph Zero blockchain ecosystem.


Together, with the combination of ink!, Cargo Contract, PSP22 & PSP34, and the CLI, ink!athon provides a robust toolset for developing, compiling, and deploying smart contracts in Rust for application in substrate-based Blockchains.



Node and development


On the node and deployment side, local development is facilitated by the option to deploy on the Aleph Zero testnet, where a faucet allows claiming Testnet Aleph Zero (TZERO) tokens for use. However, for efficient development cycles and quick iterations, the preference is to spawn a local substrate contract.node. This node is a streamlined, lightweight version of Substrate, focusing solely on smart contract functionality. This approach enhances the development process, enabling rapid iterations and testing in a local environment before deploying on the broader Aleph Zero network.


In addition to the local substrate contract.node, developers can also use Swanky, a more feature-complete tool, for deployment and contract interaction during the development process.



Deployment & interaction


For seamless contract testing and interaction in the terminal, Aleph Zero provides Drink!, a framework for building dApps on Polkadot using Rust and ink!, a domain-specific language for writing smart contracts. Drink! provides tools and libraries to help developers create, test, and deploy their dApps—a perfect tool recommended for experimentation.


Cargo contract is another valuable tool for deployment, while Contract UI caters to those preferring a GUI. By uploading frontend metadata into the browser, Contract UI generates an auto-generated UI, providing an intuitive interface for interacting with each function or performing queries on the contract. This diverse set of tools caters to various preferences and workflows throughout the development lifecycle.



Front-end level


On the frontend level, the foundation is the Polkadot.js API, a powerful library for interacting with the Polkadot network. However, its setup can be intricate and time-consuming, especially in the context of a hackathon. To address this challenge, an abstraction layer called ink!athon has been developed specifically for React frontends. This layer, built on top of the Polkadot.js API, streamlines the development process by providing a simplified interface. ink!athon acts as a bridge, enabling React developers to seamlessly integrate Polkadot functionality into their applications without the complexities associated with direct usage of the Polkadot.js API. This approach not only enhances accessibility but also facilitates efficient development in time-sensitive environments like hackathons.


This concludes Part 1 of our exploration into decentralized app development with Ink!Athon. Stay tuned for Part 2, where we delve deeper into boilerplate, the Ink!Athon stack itself


Conclusion



CTRL+Hack+ZK, the inaugural hackathon organized by Aleph Zero and supported by major partners, is set to be a transformative event for developers and Web3 enthusiasts. Focused on Aleph Zero, a high-performance blockchain platform with cutting-edge privacy features, participants will embark on a three-week journey featuring workshops, educational programming, and hands-on mentorship from the core development team and ecosystem partners. This hackathon provides a unique opportunity to connect with fellow developers, founders, and Web3 enthusiasts, fostering collaboration and sparking high-impact ideas.


Participants will benefit from real-life mentorship, engaging workshops, and valuable resources, delving deep into use cases and promising integrations. The event also includes intense hacking sessions guided by Aleph Zero's experts, allowing developers to discover and build on the platform. As a highlight, participants will have the chance to present their ideas to prominent enterprises and venture capital firms keen on identifying the most promising projects in the blockchain space. In collaboration with key partners such as Cardinal, Deutsche Telekom, buidl.so, WWVentures, arca, heartcore, Blockchain founders capital, stc, and generative vendors, CTRL+Hack+ZK promises to be a dynamic and impactful event at the forefront of blockchain innovation.

Comments


Recommended

Subscribe Us

Get the latest creative news from CodeTavren magazine

bottom of page