/elrond-playground

Sample project to interact with the elrond blockchain network using the python SDK

Primary LanguagePython

Elrond Playground

The purpose of this project is to play around with interacting with the elrond blockchain network. There is an elrond-sdk for facilitating this functionality.

Useful Dev Tips and Tricks

Internal Representations

Internally everything in EGLD is represented as 10^18 and a uint. Elrond works with 18 decimals, so in order to get a human readable number diving by 10^18. Programmatically this is represented as:

import math

balance = int(egld_response.('key')) / int(math.pow(10, 18))

Learnt this the hard way but I found a comment here from one of the core devs mentioning it.

Metachain Reference

4294967295 can be used as the shard ID when querying the Metachain using shard APIs. Some APIs require a shard ID as a parameter. See here for reference.

Hyperblock

As taken from the docs here:

A Hyperblock is a block-like abstraction that reunites the data from all shards, and contains only fully-executed transactions (that is, transactions executed both in source and in destination shard).

Erdpy Examples

The docs provide a high level overview oferdpy but lack practical code examples. The elrond-sdk exposes CLI interfaces that demonstrate how you can hook into the library, for example cli_block.py.

Setup

Follow the instructions to setup erdpy here. If you're using the mainnet make sure the proxy appropriately:

erdpy config set proxy https://api.elrond.com

Dependencies

Instructions on how to install erdpy can be found here:

  1. Installation instructions
  2. elrond-sdk