Cardanoex

Hex.pm Tests Coverage Status

Welcome to the documentation for Cardanoex.

The aim of this library is to offer a set of tools for interacting with Cardano blockchain platform in Elixir. It provides high level modules representing the Cardano environment, like wallets, addresses, transactions, native assets & stake pools.

It currently uses the REST protocol offered by the cardano-wallet binary.

This library is the implementation of the idea submitted to Catalyst project.

prerequisites

Prerequisites

  1. You need to have the cardano-wallet up and running

installation

Installation

Add cardanoex to your list of dependencies in mix.exs:

def deps do
  [
    {:cardanoex, "~> 0.6.0"}
  ]
end

configuration

Configuration

In config/config.exs, add url to the cardano-wallet

config :cardanoex,
  wallet_base_url: "http://localhost:8090/v2"

example-usage

Example usage

create-a-wallet

Create a wallet

name = "Wallet #1"
mnemonic = Util.generate_mnemonic()
pass = "Super_Secret3.14!"
    
{:ok, wallet} = Wallet.create_wallet(name: name, mnemonic_sentence: mnemonic, passphrase: pass)

list-all-transactions

List all transactions

{:ok, transactions} = Transaction.list(wallet.id)

send-a-transaction

Send a transaction

payments = %{
  passphrase: "Super_Secret3.14!",
  payments: [
          %{
            address:
              "addr_test1qqt6c697uderxaccgn...m64dsuzfj8f",
            amount: %{quantity: 1_000_000, unit: "lovelace"}
           }
  ]
}

{:ok, transaction} = Transaction.create(wallet.id, payments)

If you like to support the project with a donation, the address is: addr1qyfe0we0tkdu9qn8ztufplz0lmktgpx9zxnj54cd7y359wsyhwvjrl2zkf5cy72yv6p47f2gs5zglyplfggh6e5n4p0sdvvrng