A high-level overview of Erc20 and other tokens on Hyperledger Fabric looks like the following:
The ERC20 Token creation on Hyperledger Fabric involves several steps and complexities.
Docker & Docker Compose
Node JS
Go
Additionally, you can refer to the official Fabric Documentation .
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.
Another Org structure view:
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
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:
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.