Skip to content
This repository was archived by the owner on Feb 9, 2022. It is now read-only.

willHol/rai_ex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

166 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RaiEx

Build Status Hex.pm Inline docs

RaiEx is an Elixir client for managing a RaiBlocks node, here is an example:

alias RaiEx.{Block, Tools}

account = "xrb_3t6k35gi95xu6tergt6p69ck76ogmitsa8mnijtpxm9fkcm736xtoncuohr3"

# RPC mappings
{:ok, %{"balance" => balance, "frontier" => frontier}} = RaiEx.account_info(account)
{:ok, %{"key" => key}} = RaiEx.account_key(account)

# Derive the first account from the wallet seed
{priv, pub} = Tools.seed_account!("9F1D53E732E48F25F94711D5B22086778278624F715D9B2BEC8FB81134E7C904", 0)

# Derives an "xrb_" address
address = Tools.create_account!(pub)

# Get the previous block hash
{:ok, %{"frontier" => block_hash}} = RaiEx.account_info(address)

block = %Block{
  previous: block_hash,
  destination: "xrb_1aewtdjz8knar65gmu6xo5tmp7ijrur1fgtetua3mxqujh5z9m1r77fsrpqw",
  balance: 0
}

# Signs and broadcasts the block to the network
block |> Block.sign(priv, pub) |> Block.send()

To get started read the online documentation.

Installation

Add the following to your mix.exs:

def deps do
  [
    {:rai_ex, "~> 0.3.0"}
  ]
end

About

💧 An Elixir client for managing a RaiBlocks node.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages