Categorygithub.com/gincoinc/zillean
modulepackage
0.0.0-20190306093118-d0d008ae1706
Repository: https://github.com/gincoinc/zillean.git
Documentation: pkg.go.dev

# README

Zilliqa Golang SDK

GoDoc Go Report Card Build Status

A Golang implementation of Zilliqa API.

The project is still under development. Please note that specifications may change greatly.

Installation

go get -u github.com/GincoInc/zillean
go get -u github.com/GincoInc/go-crypto

Getting started

cd $GOPATH/src/github.com/GincoInc/zillean/example
go run main.go

Example

package main

import (
	"fmt"

	"github.com/GincoInc/zillean"
)

func main() {
	// initialize the Zillean
	zil := zillean.NewZillean("https://api.zilliqa.com")

	// generate a private key
	privKey := zil.GeneratePrivateKey()
	fmt.Printf("private key: %s\n", privKey) // private key: b6c00064b10d33c4a9fadb5b473d834b1995f132acdbe4b831ab5343702c174e

	// get a public key
	pubKey, _ := zil.GetPublicKeyFromPrivateKey(privKey)
	fmt.Printf("public key: %s\n", pubKey) // public key: 03dcb21aaaa918f91a708858dc271343b4bee059e53202ce0358b68effa7e64378

	// get a address
	address, _ := zil.GetAddressFromPrivateKey(privKey)
	fmt.Printf("address: %s\n", address) // address: 5f0e26adf701bb6a4535f0485fe3400e6e90c9ae

	// sign the transaction
	rawTx := zillean.RawTransaction{
		Version:  0,
		Nonce:    2,
		To:       "to address",
		Amount:   "1000000000000",
		PubKey:   pubKey,
		GasPrice: big.NewInt(1000000000),
		GasLimit: 1,
	}
	signature, _ := zil.SignTransaction(rawTx, privKey)
	txID, _ := zil.RPC.CreateTransaction(rawTx, signature)
	fmt.Printf("txID: %s\n", txID)
}

Supports

Wallet API

  • GeneratePrivateKey
  • VerifyPrivateKey
  • GetPublicKeyFromPrivateKey
  • IsPublicjKey
  • GetAddressFromPrivateKey
  • GetAddressFromPublicKey
  • IsAddress
  • SignTransaction
  • VerifySignature

JSON-RPC API

Blockchain-related methods

  • GetNetworkId
  • GetBlockchainInfo
  • GetShardingStructure
  • GetDsBlock
  • GetLatestDsBlock
  • GetNumDSBlocks
  • GetDSBlockRate
  • DSBlockListing
  • GetTxBlock
  • GetLatestTxBlock
  • GetNumTxBlocks
  • GetTxBlockRate
  • TxBlockListing
  • GetNumTransactions
  • GetTransactionRate
  • GetCurrentMiniEpoch
  • GetCurrentDSEpoch
  • GetPrevDifficulty
  • GetPrevDSDifficulty

Transaction-related methods

  • CreateTransaction
  • GetTransaction
  • GetRecentTransactions
  • GetTransactionsForTxBlock
  • GetNumTxnsTxEpoch
  • GetNumTxnsDSEpoch
  • GetMinimumGasPrice

Contract-related methods

  • GetSmartContractCode
  • GetSmartContractInit
  • GetSmartContractState
  • GetSmartContracts
  • GetContractAddressFromTransactionID

Account-related methods

  • GetBalance

# Packages

No description provided by the author

# Functions

NewECSchnorr returns a new ECSchnorr.
NewRPC returns a new RPC object.
NewZillean returns a new Zillean.

# Structs

Balance describes the balance for an account.
BlockchainInfo describes the information about Zilliqa blockchain.
DsBlock describes a DS-Block.
ECSchnorr represents a EC-Schnorr object.
ListedBlocks contains the paginated list of Blocks.
RawTransaction describes a raw transaction object, which can be used in creating a new transaction.
RecentTransactions contains the most recent transactions (up to 100).
RPC represents a JSON-RPC API client object.
ShardingStructure contains the number of peers in each shard.
SmartContract describes the smart contracts created by an address.
SmartContractState describes the state of a smart contract.
Transaction describes a transaction object.
TxBlock describes a TX-Block.
Zillean represents the zillean object.