neo

package
v0.0.0-...-3f353b6 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2018 License: MIT Imports: 17 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Node string
	// contains filtered or unexported fields
}

Client is the entrypoint for the package, it is used to carry out all actions.

func NewClient

func NewClient(nodeURI string) Client

NewClient creates a new Client struct, with a single node URI.

func NewClientUsingMultipleNodes

func NewClientUsingMultipleNodes(nodeURIs []string) (*Client, error)

NewClientUsingMultipleNodes creates a new Client struct, and allows multiple node URIs to be passed in. Before the Client struct is returned, each node is queried to determine its block height. The node with the highest block count is chosen.

func (Client) GetBestBlockHash

func (c Client) GetBestBlockHash() (string, error)

GetBestBlockHash returns the hash of the best block in the chain.

func (Client) GetBlockByHash

func (c Client) GetBlockByHash(hash string) (*models.Block, error)

GetBlockByHash returns the corresponding block information according to the specified hash value.

func (Client) GetBlockByIndex

func (c Client) GetBlockByIndex(index int64) (*models.Block, error)

GetBlockByIndex returns the corresponding block information according to the specified index value.

func (Client) GetBlockCount

func (c Client) GetBlockCount() (int64, error)

GetBlockCount returns the number of blocks in the chain.

func (Client) GetBlockHash

func (c Client) GetBlockHash(index int64) (string, error)

GetBlockHash returns the hash value of the corresponding block based on the specified index.

func (Client) GetConnectionCount

func (c Client) GetConnectionCount() (int64, error)

GetConnectionCount returns the current number of connections for the node.

func (Client) GetStorage

func (c Client) GetStorage(scriptHash string, storageKey string) (string, error)

GetStorage takes a smart contract hash and a storage key, and returns the storage value if available.

func (Client) GetTransaction

func (c Client) GetTransaction(hash string) (*models.Transaction, error)

GetTransaction returns the corresponding transaction information based on the specified hash value.

func (Client) GetTransactionOutput

func (c Client) GetTransactionOutput(hash string, index int64) (*models.Vout, error)

GetTransactionOutput returns the corresponding transaction output (change) information based on the specified hash and index.

func (Client) GetUnconfirmedTransactions

func (c Client) GetUnconfirmedTransactions() ([]string, error)

GetUnconfirmedTransactions returns a slice of transaction hashes that are all unconfirmed transactions that the node has in memory.

func (Client) Ping

func (c Client) Ping() bool

Ping checks if the node is online.

func (*Client) SelectBestNode

func (c *Client) SelectBestNode() error

SelectBestNode selects the best node to use for RPC calls. If there is a single node URI then that will be used. If there are 2 or more then each node is called and the block count is compared. The node with the heighest block count is used.

func (Client) ValidateAddress

func (c Client) ValidateAddress(address string) (bool, error)

ValidateAddress takes a public NEO address and checks if it is valid.

type PrivateKey

type PrivateKey struct {
	// contains filtered or unexported fields
}

PrivateKey is a struct which holds the value of a NEO address private key, and has a number of utility functions attached to the struct.

func NewPrivateKeyFromWIF

func NewPrivateKeyFromWIF(wif string) (*PrivateKey, error)

NewPrivateKeyFromWIF creates a PrivateKey struct using a WIF.

func (PrivateKey) Output

func (p PrivateKey) Output() string

Output converts the 32-byte slice representation of the private key to a string.

func (PrivateKey) OutputBase64

func (p PrivateKey) OutputBase64() string

OutputBase64 converts the 32-byte slice representation of the private key to a base64 encoded string.

func (PrivateKey) PublicAddress

func (p PrivateKey) PublicAddress() (string, error)

PublicAddress derives the public NEO address that is coupled with the private key, and returns it as a string.

func (PrivateKey) PublicKey

func (p PrivateKey) PublicKey() ([]byte, error)

PublicKey derives the public key that is coupled with the private key, and returns it in an array of bytes.

func (PrivateKey) Signature

func (p PrivateKey) Signature() ([]byte, error)

Signature creates the signature using the private key.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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