In the Cardano blockchain ecosystem, one can become an on-chain Cardano blockchain developer, and one can also become an off-chain developer.
In our previous blog in the Cardano blockchain developer roadmap series, we discussed how becoming a Cardano developer is focused on role specialization which differs from blockchain developers in other blockchains. Thus, understanding the different requirements can be helpful for interested Cardano blockchain developers to start their blockchain careers.
As we look at different Cardano developer roles and their specializations, in this blog we will discuss off-chain Cardano blockchain development more closely and the importance of transaction construction to dApp development on Cardano.
It’s a specialization field found mostly for Cardano blockchain dApps.
In most traditional blockchain development, a smart contract is used to define the attributes of a token (supply, name, decimals, etc.). Inside, the code also configures the behavior of transactions. This means a traditional smart contract contains both the characteristics of an asset plus the rules of how it can be transferred. Additionally, the blockchain ledger is not aware of the balance of the tokens and each smart contract has to track this information.
However, Cardano has taken a different approach.
In Cardano, assets are native to the blockchain ledger, which means there is no need to deploy a smart contract to create a new token. The Cardano ledger takes charge of the traditional functions such as transferring a token and tracking balances.
Which begs the next question:
How do Cardano blockchain developers control more complex operations?
In many cases, businesses will want more complex logic applied to a group of assets such as locking, staking, minting on-demand, and much more.
This is the role of the off-chain code developer.
It’s the person in charge of setting a set of steps for a type of complex logic.
In our first article, we discussed the on-chain code or validator which is important for Cardano on-chain developers. It is a piece of logic that lives in the blockchain and governs the behavior of an asset. The validator alone cannot do it, as it needs a set of instructions that connect with it to give the desired outputs.
These instructions are called off-chain code or transaction construction.
Their main job is to connect to the validator, execute the logic contained there, and distribute the outputs to the receiving addresses. Additionally, it is used to:
- Query the blockchain’s state
- Handle user inputs
- Execute validators
- Build and balance transactions
- Submit signed transactions to the network.
This code is called off-chain because it does not get uploaded to the Cardano network. It has to be set separately in a server that can service requests of users interacting with the dApp. By separating the role of the asset logic and transaction construction, Cardano reduces the attack surface of a dApp.
The first step is to understand that there are two main sets of tools for transaction construction. First, the Cardano Command Line Interface (CLI) and second, the Plutus Application Backend (PAB). Both are meant to help with the off-chain code.
The Cardano CLI is installed along the node and it works on a shell terminal. It’s a hierarchy of commands and subcommands that fulfill a wide set of roles. It can be used to generate wallet addresses, mint tokens, append metadata, and for transaction construction.
The shell is the layer of programming that understands and executes the commands related to the Cardano CLI. In this field, shell-wrapping sets of commands can quickly serve to automate certain operations. It’s possible to launch a dApp and have the entire logic of it governed just by the commands found on the CLI.
The Cardano CLI is made by commands preset by the core developers. It’s suited to use cases that are relatively simple and don’t require complex operations. In other cases where the business logic requires a custom solution, the Plutus Application Backend is used.
The PAB is an off-chain framework that allows a developer to set up all the different necessities of the off-chain code. The original PAB was created by IOG, but since then alternatives have been also launched.
The original PAB used Haskell as the language and that makes it very compatible with the architecture of Cardano. Yet, other teams have launched alternatives that don’t require a deep knowledge of Haskell and use more widely used computer languages such as:
It’s also a very friendly platform filled with useful examples and extensive documentation. At the moment, it’s perhaps the best entry point for those developers looking to enter the off-chain field.
Atlas is an open-source PAB alternative that also focuses on Haskell. It’s a versatile set of tools that can simplify Haskell coding while optimizing off-chain code when it comes to the eUTXO transaction used by Cardano.
It is the best option for those looking to keep their entire dApp using Haskell and not splitting the code between on-chain and off-chain. The platform is also modular allowing for it to be compatible with other development tools in the ecosystem.
PyCardano is a Cardano client written in Python. The library can create, balance, and sign transactions. The project aims to onboard Python developers to the ecosystem by bringing all the familiar tools from the Python world.
EMURGO Academy is the education arm of Cardano founding entity EMURGO and has set up a collection of tailored online learning programs to fast-track the career of prospective Cardano blockchain developers.
With its expert knowledge and connections to the Cardano ecosystem, EMURGO Academy offers hands-on learning modules as well as live Q&A sessions to enable practical skill development in building Cardano dApps.
To learn more and enroll in the right course for you, visit EMURGO Academy’s site here.
- Official Homepage: emurgo.io
- Twitter (Global): @EMURGO_io
- YouTube: EMURGO channel
- Facebook: @EMURGO.io
- Instagram: @EMURGO_io
- LinkedIn: @EMURGO_io
You should not construe any such information or other material as legal, tax, investment, financial, or other advice. Nothing contained herein shall constitute a solicitation, recommendation, endorsement, or offer by EMURGO to invest.