Categorygithub.com/zvchain/zvcgo
modulepackage
0.0.0-20200310093552-9a9acc1d6c5b
Repository: https://github.com/zvchain/zvcgo.git
Documentation: pkg.go.dev

# README

ZVChain API library for Go

GoDoc

This library provides simple access to data structures and API calls to an ZVChain RPC server.

Install

go get -u github.com/zvchain/zvcgo

Basic usage

api := zvcgo.NewApi("http://node1.zvchain.io")

height, _ := api.BlockHeight()
fmt.Printf("Current block height: %d", height)

Transfer ZVC Example

package main

import (
	"fmt"
	"github.com/zvchain/zvcgo"
)

func main() {
	mnemonic, _ := zvcgo.NewMnemonic(zvcgo.Mnemonic12WordBitSize)
	fmt.Println("Mnemonic: ", mnemonic)
	wallet := zvcgo.NewWallet(mnemonic)
	if wallet == nil {
		panic("wrong mnemonic")
	}
	acc, _ := wallet.DeriveAccount(0)
	// acc, err := zvcgo.NewAccountFromString("you private key")
	fmt.Println("account address: ", acc.Address().String())
	api := zvcgo.NewApi("endpoint host")
	api.SetSigner(acc)
	asset, _ := zvcgo.NewAssetFromString("123 zvc")
	target, _ := zvcgo.NewAddressFromString("you address")
	tx := zvcgo.NewTransferTransaction(*acc.Address(), target, asset, []byte{})
	nonce, _ := api.GetNonce(*acc.Address())
	tx.SetNonce(nonce)
	hash, err := api.SignAndSendTransaction(tx)
	if err != nil {
		panic(err)
	}
	fmt.Println("transaction hash: ", hash.String())
}


License

GPL

# Functions

Decode decodes a hex string with 0x prefix.
Decode decodes a hex string with zv prefix.
Encode encodes b as a hex string with 0x prefix.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
NewMnemonic Generate Mnemonic, returns of number of words depends on input: bitSize(eg: Mnemonic12WordBitSize, Mnemonic24WordBitSize).
No description provided by the author
No description provided by the author
No description provided by the author
ToZvHex converts the input byte array to a hex string.
No description provided by the author

# Constants

No description provided by the author
No description provided by the author
1.9073486328125.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
length of signature,32 bytes r & 32 bytes s & 1 byte recid.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
372.

# Variables

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Structs

No description provided by the author
ABIVerify stores the contract function name and args types, in order to facilitate the abi verify.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
ErrorResult is rpc requestGzv error returned variable parameter.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Result is rpc requestGzv successfully returns the variable parameter.
No description provided by the author
RPCReqObj is complete rpc requestGzv body.
No description provided by the author
Sign Data struct.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Interfaces

No description provided by the author
No description provided by the author

# Type aliases

No description provided by the author