bcclientgo

package module
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2021 License: Apache-2.0 Imports: 12 Imported by: 8

README

bcclientgo

This is a Go implementation of a BC client using the BC data structures.

About

bcclientgo provides utilities and a command line interface to explore and interact with BC.

Build

go build -tags release

Install

Install the binary (or download from https://github.com/AletheiaWareLLC/bcclientgo/releases/latest)

go install -tags release aletheiaware.com/bcclientgo/cmd/bc

Usage

$ bc
BC Usage:
    bc - display usage
    bc init - initializes environment, generates key pair, and registers alias

    bc node - display registered alias and public key
    bc alias [alias] - display public key for given alias

    bc keys - display all stored keys
    bc import-keys [alias] [access-code] - imports the alias and keypair from BC server
    bc export-keys [alias] - generates a new access code and exports the alias and keypair to BC server

    bc push [channel] - pushes the channel to peers
    bc pull [channel] - pulls the channel from peers
    bc head [channel] - display head of given channel
    bc chain [channel] - display chain of given channel
    bc block [channel] [block-hash] - display block with given hash
    bc record [channel] [record-hash] - display record with given hash

    bc read [channel] [block-hash] [record-hash]- reads entries the given channel and writes to stdout
    bc read-key [channel] [block-hash] [record-hash]- reads keys the given channel and writes to stdout
    bc read-payload [channel] [block-hash] [record-hash]- reads payloads the given channel and writes to stdout
    bc write [channel] [access...] - reads data from stdin and writes it to cache for the given channel and grants access to the given aliases
    bc mine [channel] [threshold] - mines the given channel to the given threshold

    bc peers - display list of peers
    bc add-peer [peer] - adds the given peer to the list of peers
    bc keystore - display location of keystore
    bc cache - display location of cache
    bc purge - deletes contents of cache

    bc random - generate a random number

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrintNode

func PrintNode(output io.Writer, node *bcgo.Node) error

Types

type BCClient

type BCClient struct {
	Root    string
	Peers   []string
	Cache   bcgo.Cache
	Network bcgo.Network
	Node    *bcgo.Node
}

func NewBCClient

func NewBCClient(peers ...string) *BCClient

func (*BCClient) Alias

func (c *BCClient) Alias(alias string) (string, error)

func (*BCClient) Block

func (c *BCClient) Block(channel string, hash []byte) (*bcgo.Block, error)

func (*BCClient) Chain

func (c *BCClient) Chain(channel string, callback func([]byte, *bcgo.Block) error) error

func (*BCClient) ExportKeys

func (c *BCClient) ExportKeys(peer, alias string, password []byte) (string, error)

func (*BCClient) GetCache

func (c *BCClient) GetCache() (bcgo.Cache, error)

func (*BCClient) GetNetwork

func (c *BCClient) GetNetwork() (bcgo.Network, error)

func (*BCClient) GetNode

func (c *BCClient) GetNode() (*bcgo.Node, error)

func (*BCClient) GetPeers

func (c *BCClient) GetPeers() ([]string, error)

func (*BCClient) GetRoot

func (c *BCClient) GetRoot() (string, error)

func (*BCClient) Head

func (c *BCClient) Head(channel string) ([]byte, error)

func (*BCClient) ImportKeys

func (c *BCClient) ImportKeys(peer, alias, accessCode string) error

func (*BCClient) Init

func (c *BCClient) Init(listener bcgo.MiningListener) (*bcgo.Node, error)

func (*BCClient) Mine

func (c *BCClient) Mine(channel string, threshold uint64, listener bcgo.MiningListener) ([]byte, error)

func (*BCClient) Pull

func (c *BCClient) Pull(channel string) error

func (*BCClient) Purge

func (c *BCClient) Purge() error

func (*BCClient) Push

func (c *BCClient) Push(channel string) error

func (*BCClient) Read

func (c *BCClient) Read(channel string, blockHash, recordHash []byte, output io.Writer) error

func (*BCClient) ReadKey

func (c *BCClient) ReadKey(channel string, blockHash, recordHash []byte, output io.Writer) error

func (*BCClient) ReadPayload

func (c *BCClient) ReadPayload(channel string, blockHash, recordHash []byte, output io.Writer) error

func (*BCClient) Record

func (c *BCClient) Record(channel string, hash []byte) (*bcgo.Record, error)

func (*BCClient) SetCache

func (c *BCClient) SetCache(cache bcgo.Cache)

func (*BCClient) SetNetwork

func (c *BCClient) SetNetwork(network bcgo.Network)

func (*BCClient) SetNode

func (c *BCClient) SetNode(node *bcgo.Node)

func (*BCClient) SetPeers

func (c *BCClient) SetPeers(peers ...string)

func (*BCClient) SetRoot

func (c *BCClient) SetRoot(root string)

func (*BCClient) Write

func (c *BCClient) Write(channel string, accesses []string, input io.Reader) (int, error)

Directories

Path Synopsis
cmd
bc

Jump to

Keyboard shortcuts

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