Technical Guide To Creating Transactions On Cardano For Developers

Adaverse Accelerator
4 min readDec 29, 2022

--

To fully understand how Cardano works, users need to know some of its basic concepts. Transaction on the Cardano blockchain is very similar to that of Bitcoin, with some additional extensions.

In this article, we will discuss at length;

  • UTXOs
  • Native assets (tokens and NFTs)
  • Smart contracts

In short, Cardano takes the Bitcoin UTXO model and adds two important features: native assets and smart contracts.

✅UTXOs

Probably the most important concept for understanding Cardano is the UTXO model. The UTXO model was originally used for Bitcoin, but there were many limitations to developing smart contracts under this model. As a result, Ethereum abandoned this model in favour of the account model to implement smart contracts (as is the case with most public chains that support smart contracts).

Cardano takes Bitcoin’s strengths in the consensus layer and draws reference from Ethereum in its choice of state to ensure better implementation of smart contracts. Therefore Cardano uses a modified version of UTXO (EUTXO) to support smart contracts.

The Cardano documentation has a series of video tutorials that explain many concepts in detail, such as how each transaction is implemented and how UTXO works.

These two videos about UTXO and transactions are very important concepts to understand Cardano. They show us how assets are stored in Cardano and what information is stored in each transaction.

After you understand the advanced concepts of UTXO and transactions, it is advisable to initiate and submit a transaction by following the 3 steps below.

  • Initiate a transaction
  • Sign this transaction with the private key
  • Submit the transaction to a Cardano node

Cardano-cli

The first way to create, sign, and submit a transaction is to use “Cardano-cli” This method is very user-friendly and almost guarantees the success of the transaction, but it does require the user to set up a Cardano node themselves.

For many ordinary users, this is certainly a challenge, as it requires fairly powerful hardware and a lot of free memory.

However, the Cardano documentation also provides instructions on how to run the node and CLI.

If you already have a Node set up, you can find the very simple instructions here.

Cardano-serialization-lib + a lightweight wallet

A second way to initiate and submit transactions is to use a combination of the Cardano-serialization-lib and a light wallet.

You can use any light wallet you like, but in this article, a sample project will be used to show how you can use the Cardano-serialization-lib and the Yoroi wallet to create, sign, and submit transactions to a test network.

Demonstration 1: How to mint an NFT and send it to the script address.

  • First, install Yoroi Nightly (a development version of Yoroi Wallet that supports the test net).
  • Then get the testnet ADA from the faucet.
  • Then you can copy this Github repository and run npm as a developer (the default service location is http://localhost:8080/)

✅Token and NFT

Once you understand how basic transactions work, you need to learn more about how tokens and NFTs work on Cardano.

The Cardano documentation contains a long introductory article on this topic. Tokens and NFTs are referred to as “native assets” in Cardano because Cardano supports custom tokens and NFTs at the blockchain level, whereas Ethereum uses smart contracts to represent these assets.

Tokens and NFTs are handled in the same way on Cardano as ADA. Essentially, each asset has a unique ID, while ADA takes the empty string as the unique ID.

There are two important concepts you need to understand about tokens and NFTs.

  • Minting Policy, and
  • Metadata

A token’s ID is nothing more than a hash of the mint policy, which is a set of instructions that indicate whether or not the minting can proceed.

The token’s Metadata contains other important information about the token. CIP25 currently provides a standard to standardize the form of the token’s Metadata.

To Mint tokens

Use the CLI and serialization-lib + light wallets.

✅Plutus script (smart contract)

The final challenge to fully understand Cardano is to grasp its smart contract system.

But there is no easy way to learn this part. It takes time and there is no better way to learn it than to follow the “Plutus Pioneer Program” video series published by IOG.

The video series shows us how to create Plutus scripts, test and deploy them, and gives us many great examples of scripts we can build on top of Cardano.

About Adaverse

Adaverse is a Cardano ecosystem accelerator building a strong network of resources for startup founders and Cardano developers across Africa, Asia and the United Arab Emirates. Adaverse was established as a joint venture between EMURGO Africa and Everest Ventures to fund socially-impactful projects building with Web3 tools.

To apply for the Adaverse accelerator program and funding, click here.

Helpful Links:

Email — official@adaverse.co
FAQ|Website|Medium|LinkedIn|Twitter|Facebook|Instagram|YouTube

--

--

Adaverse Accelerator
Adaverse Accelerator

Written by Adaverse Accelerator

Adaverse is a Venture fund and Cardano accelerator fostering blockchain innovation in Asia, Middle East, and Africa.

No responses yet