Technology

How Spydra's API simplifies the ERC20 Token interface?

JavaScript frameworks make development easy with extensive features and functionalities. Here are our top 10 to use in 2022.
Written by
spydraadmin
Published on
January 1, 1970

A high-level overview of Erc20 and other tokens on Hyperledger Fabric looks like the following:

app-infra-img.png

The ERC20 Token creation on Hyperledger Fabric involves several steps and complexities.

Prerequisites

Docker & Docker Compose
Node JS
Go
Additionally, you can refer to the official Fabric Documentation .

Network

By default in any scenario, you will have two or more orgs. In this case, let’s assume we have 2 Org’s and an Orderer which is using SOLO as an ordering method, and two peers and certificate authority per Org & a Cli Client to interact with our chain code.

So the Network Configuration looks like this.

orderer-img.png

Another Org structure view:

fungible-token-img.png

Once we have designed this Network/Org structure, the next is to create the ERC20 tokens and interface with them. This can be found at:

Use the Chaincode Samples from this link .

Full instructions on how to create Erc20 and interact with it are provided here

Chaincode SmartContract ERC20 Methods

List of all the SmartContract Methods:

type SmartContract

func (s *SmartContract) Allowance(ctx contractapi.TransactionContextInterface, owner string, spender string) (int, error)

func (s *SmartContract) Approve(ctx contractapi.TransactionContextInterface, spender string, value int) error

func (s *SmartContract) BalanceOf(ctx contractapi.TransactionContextInterface, account string) (int, error)

func (s *SmartContract) ClientAccountBalance(ctx contractapi.TransactionContextInterface) (int, error)

func (s *SmartContract) ClientAccountID(ctx contractapi.TransactionContextInterface) (string, error)

func (s *SmartContract) Mint(ctx contractapi.TransactionContextInterface, amount int) error

func (s *SmartContract) TotalSupply(ctx contractapi.TransactionContextInterface) (int, error)

func (s *SmartContract) Transfer(ctx contractapi.TransactionContextInterface, recipient string, amount int) error

func (s *SmartContract) TransferFrom(ctx contractapi.TransactionContextInterface, from string, to string, value int) error

This is depicted by a simple Block Diagram:

erc-2-function-imge (1).png

Spydra's API

The above steps are quite complicated in terms of managing multiple Orgs and Token creation per asset, Token transfers, etc. With the SPDR API interface, an ERC20 token is auto-created by default, i.e. every time a Chaincode is autogenerated on the platform. All this complexity is eliminated by the SPDR API and so Businesses/Developers can issue a single API call to create, manage and interact with their Erc-20 tokens.

SPDR will also support ERC721 tokens shortly which will enable one-click NFT creation, chaincode generation, and deployment on Hyperledger Fabric.

Latest posts

Subscribe to Our Newsletter

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.