hivego

package module
v0.0.0-...-9f5a7f1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 10, 2023 License: MIT Imports: 13 Imported by: 0

README

HiveGo - A client for the Hive blockchain

At this time, there are only a few functions from the client. More will be added.

Example usage:

create a client:

hrpc := hivego.NewHiveRpc("https://api.myHiveBlockchainNode.com")

submit a custom json tx:

txid, err := hrpc.BroadcastJson([]string{submittingAccount}, []string{}, id, string(jsonPayload), &activeWif)

vote a post:

txid, err := hrpc.VotePost(voter, author, permlink, weight, &wif)

get n blocks starting from block x as the raw response from the rpc (in bytes):

responseBytes, err := hrpc.GetBlockRangeFast(startBlock int, count int)

WARNING: It is not recommended to stream blocks from public APIs. They are provided as a service to users and saturating them with block requests may (rightfully) result in your IP getting banned

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PublicKeyPrefix = "STM"

Functions

func DecodePublicKey

func DecodePublicKey(pubKey string) (*secp256k1.PublicKey, error)

Decodes a base58 Hive public key to secp256k1 public key

func GetPublicKeyString

func GetPublicKeyString(pubKey *secp256k1.PublicKey) *string

func GphBase58CheckDecode

func GphBase58CheckDecode(input string) ([]byte, [1]byte, error)

func SignDigest

func SignDigest(digest []byte, wif *string) ([]byte, error)

Types

type HiveRpcNode

type HiveRpcNode struct {
	MaxConn     int
	MaxBatch    int
	NoBroadcast bool
	// contains filtered or unexported fields
}

func NewHiveRpc

func NewHiveRpc(addr string) *HiveRpcNode

func NewHiveRpcWithOpts

func NewHiveRpcWithOpts(addr string, maxConn int, maxBatch int) *HiveRpcNode

func (*HiveRpcNode) BroadcastJson

func (h *HiveRpcNode) BroadcastJson(reqAuth []string, reqPostAuth []string, id string, cj string, wif *string) (string, error)

func (*HiveRpcNode) GetBlockRange

func (h *HiveRpcNode) GetBlockRange(startBlock int, count int) ([]json.RawMessage, error)

func (*HiveRpcNode) GetBlockRangeFast

func (h *HiveRpcNode) GetBlockRangeFast(startBlock int, count int) ([][]byte, error)

func (*HiveRpcNode) GetDynamicGlobalProps

func (h *HiveRpcNode) GetDynamicGlobalProps() ([]byte, error)

func (*HiveRpcNode) GetTransaction

func (h *HiveRpcNode) GetTransaction(txId string, includeReversible bool) ([]byte, error)

func (*HiveRpcNode) VotePost

func (h *HiveRpcNode) VotePost(voter string, author string, permlink string, weight int, wif *string) (string, error)

type KeyPair

type KeyPair struct {
	PrivateKey *secp256k1.PrivateKey
	PublicKey  *secp256k1.PublicKey
}

func KeyPairFromWif

func KeyPairFromWif(wif string) (*KeyPair, error)

Gets a KeyPair from a given WIF String

func (*KeyPair) GetPublicKeyString

func (kp *KeyPair) GetPublicKeyString() *string

type TransactionQueryParams

type TransactionQueryParams struct {
	TransactionId     string `json:"id"`
	IncludeReversible bool   `json:"include_reversible"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL