Cardano Part 1: Interacting and Developing with Cardano

Amjad Saleem
3 min readSep 2, 2021

--

There are few guidelines to start with cardano development and using the blockchain for learning purposes. The following notes are based on personal learning journey.

## Where to start?

I usually prefer official documentation and tutorials for learning any tech. or development tool. In case of cardano I started with official docs, see https://developers.cardano.org/docs. The cardano community keeps the docs up-to-date and keeping latest content, therefore, the official site is the best way to start.

## Release info
https://roadmap.cardano.org/en

## Pre-requsits

In order to be able to interact with cardano mainnet or testnet you have done following

  1. Make sure you have Haskell, cabal and other dependencies install to run a cardano node. You can install and configure Haskell and cabal from https://www.haskell.org/. NOTE: Use a correct release that is recommended at https://developers.cardano.org/docs/get-started
  2. Run cardano node on your machine or use docker, see https://developers.cardano.org/docs/get-started/installing-cardano-node
  3. Configure node to run against an era e.g. Shelly or Alonzo
  4. Make sure you have read basic concepts about blockchain technology.
  5. Read cardano’s and code technical concepts using “NerdOut” episodes, see https://developers.cardano.org/docs/get-started/technical-concepts
  6. Start cardano node locally e.g. run on mainnet

cardano-node run \
— topology path/to/mainnet-topology.json \
— database-path path/to/db \
— socket-path path/to/db/node.socket \
— host-addr 127.0.0.1\
— port 3001 \
— config path/to/mainnet-config.json

7. Usually it takes 10–20 minutes to download the blockchain data

You can verify if the node is up and running with following

  1. Run ´cardano-node — version ´
  2. Run ´cardano-cli — version´

Tips:

  1. It is common to get Haskell lib related errors when building or running nodes. It is important to check the release versions you are installing and the Haskell version that is needed for the node version
  2. Use testnet to experiment
  3. Configure using your own machine and

How to Interact with Cardano Blockchain?

There are few ways to explore and interact with the blockchain but I would focus on two approaches

  1. Cardano APIs
  2. Cardano cardano-cli

Cardano APIs

There are mainly two APIs provided by cardano foundation, cardano-graphql and cardano-rosetta . Cardano-graphql is the most up-to-date release while rosetta-api is implementation of same API using rosetta specifications.

Depending on your needs you can choice any of above APIs. If you are looking only to use cardano-blockchain then use cardano-graphql and if you have intentions to build a project where you want to interact with multiple blockchains then you can use rosetta-api.

There are some hosted instances by third parties which you can use for a quick start. For example, you can use the APIs hosted by https://gimbalabs.com/dandelionapis.

Cardano Cli

When you run a cardano node locally then you will have access to ´cardano-cli´ that basically interacts with the node. The cli is for more power users those are looking for faster, complete and latest features on blockchain. For example, managing wallets, building your own sdks to integrate with a web site and singing and submitting transactions etc.

Explore Alonzo

  1. Read intro at https://docs.cardano.org/explore-cardano/cardano-architecture/overview
  2. Setup Alonzo node using https://github.com/input-output-hk/Alonzo-testnet/blob/main/Alonzo-exercises/alonzo-purple/1_Alonzo-purple-exercise-1.md
  3. You can either build haskell or nix based node, docker images or pre-build from https://hydra.iohk.io/search
  4. For example, a pre-build for *nix can be obtained from https://hydra.iohk.io/build/7189190/download/1/index.html. Currently it is purple you can keep track of latest release on github
  5. Alonzo configuration https://github.com/input-output-hk/Alonzo-testnet

6. Get testnet from the following link

https://hydra.iohk.io/build/7370192/download/1/index.html. NOTE: use wget not copy paste. For example,

wget https://hydra.iohk.io/build/7370192/download/1/rest-config.json

Querying Testnet

You can use an existing address e.g. https://explorer.alonzo-purple.dev.cardano.org/en/address?address=addr_test1vzy07sptq530yajf436zywxxjlzhn0htx38twgcfn503dnsx2a56e

Important:

Make sure you have correct CARDANO_NODE_SOCKET_PATH exported or in .bashrc. Otherwise, you will get errors like “cardano-cli: Network.Socket.connect: <socket: 11>: does not exist (Connection refused)”

cardano-cli query utxo --testnet-magic ${TESTNET_MAGIC} --address <ANY_ACCOUNT_ADDRESS

--

--

No responses yet