gotezos

package module
v2.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2020 License: MIT Imports: 24 Imported by: 0

README

GoDoc

A Tezos Go Library

Go Tezos is a GoLang driven library for your Tezos node. This library has received a grant from the Tezos Foundation to ensure it's continuous development through 2020.

Installation

Get goTezos

go get github.com/goat-systems/go-tezos/v2
Getting A Block
package main

import (
	"fmt"
	goTezos "github.com/goat-systems/go-tezos/v2"
)

func main() {
	gt, err := goTezos.New("http://127.0.0.1:8732")
	if err != nil {
		fmt.Printf("could not connect to network: %v", err)
	}

	block, err := gt.Block(1000)
	if err != nil {
		fmt.Println(err)
	}
	fmt.Println(block)
}
Getting a Cycle
	cycle, err := gt.Cycle(50)
	if err != nil {
		fmt.Println(err)
	}
	fmt.Println(cycle)

Contributing

The Makefile

The makefile is there as a helper to run quality code checks. To run vet and staticchecks please run:

make checks

Contributers: A Special Thank You

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Documentation

Index

Constants

View Source
const (
	// TRANSACTIONOP is a kind of operation
	TRANSACTIONOP = "transaction"
	// REVEALOP is a kind of operation
	REVEALOP = "reveal"
	// ORIGINATIONOP is a kind of operation
	ORIGINATIONOP = "origination"
	// DELEGATIONOP is a kind of operation
	DELEGATIONOP = "delegation"
	// ENDORSEMENTOP is a kind of operation
	ENDORSEMENTOP = "endorsement"
)
View Source
const MUTEZ = 1000000

MUTEZ is mutez on the tezos network

Variables

This section is empty.

Functions

func B58cencode

func B58cencode(payload []byte, prefix prefix) string

B58cencode encodes a byte array into base58 with prefix

func ForgeDelegationOperation

func ForgeDelegationOperation(branch string, input ForgeDelegationOperationInput) (string, error)

ForgeDelegationOperation forges a delegation operation(s) locally. GoTezos does not use the RPC or a trusted source to forge operations. Current supported operations include transfer, reveal, delegation, and origination.

Parameters:

branch:
	The branch to forge the operation on.

input:
	The delegation contents to be formed.

func ForgeOperation

func ForgeOperation(branch string, contents ...Contents) (string, error)

ForgeOperation forges an operation locally. GoTezos does not use the RPC or a trusted source to forge operations. Current supported operations include transfer, reveal, delegation, and origination.

Parameters:

branch:
	The branch to forge the operation on.

contents:
	The operation contents to be formed.

func ForgeOriginationOperation

func ForgeOriginationOperation(branch string, input ForgeOriginationOperationInput) (string, error)

ForgeOriginationOperation forges a origination operation(s) locally. GoTezos does not use the RPC or a trusted source to forge operations. Current supported operations include transfer, reveal, delegation, and origination.

Parameters:

branch:
	The branch to forge the operation on.

input:
	The origination contents to be formed.

func ForgeRevealOperation

func ForgeRevealOperation(branch string, input ForgeRevealOperationInput) (string, error)

ForgeRevealOperation forges a reveal operation(s) locally. GoTezos does not use the RPC or a trusted source to forge operations. Current supported operations include transfer, reveal, delegation, and origination.

Parameters:

branch:
	The branch to forge the operation on.

input:
	The reveal contents to be formed.

func ForgeTransactionOperation

func ForgeTransactionOperation(branch string, input ...ForgeTransactionOperationInput) (string, error)

ForgeTransactionOperation forges a transaction operation(s) locally. GoTezos does not use the RPC or a trusted source to forge operations. Current supported operations include transfer, reveal, delegation, and origination.

Parameters:

branch:
	The branch to forge the operation on.

input:
	The transaction contents to be formed.

func StripBranchFromForgedOperation

func StripBranchFromForgedOperation(operation string, signed bool) (string, string, error)

StripBranchFromForgedOperation will strip the branch off an operation and resturn it with the rest of the operation string minus the signature if signed.

Parameters:

operation:
	The operation string.

signed:
	Whether or not the operation is signed.

Types

type ActiveChains

type ActiveChains []struct {
	ChainID        string    `json:"chain_id"`
	TestProtocol   string    `json:"test_protocol"`
	ExpirationDate time.Time `json:"expiration_date"`
	Stopping       string    `json:"stopping"`
}

ActiveChains represents the active chains RPC.

RPC:

/monitor/active_chains (GET)

Link:

https://tezos.gitlab.io/api/rpc.html#get-monitor-active-chains

type BakingRight

type BakingRight struct {
	Level         int       `json:"level"`
	Delegate      string    `json:"delegate"`
	Priority      int       `json:"priority"`
	EstimatedTime time.Time `json:"estimated_time"`
}

type BakingRights

type BakingRights []BakingRight

BakingRights represents the baking rights RPC on the tezos network.

RPC:

../<block_id>/helpers/baking_rights (GET)

Link:

https://tezos.gitlab.io/api/rpc.html#get-block-id-helpers-baking-rights

type BakingRightsInput

type BakingRightsInput struct {
	// The block level of which you want to make the query.
	Level int

	// The cycle of which you want to make the query.
	Cycle int

	// The delegate public key hash of which you want to make the query.
	Delegate string

	// The max priotity of which you want to make the query.
	MaxPriority int

	// The hash of block (height) of which you want to make the query.
	// Required.
	BlockHash string `validate:"required"`
}

BakingRightsInput is the input for the goTezos.BakingRights function.

Function:

func (t *GoTezos) BakingRights(input *BakingRightsInput) (*BakingRights, error) {}

type BalanceUpdates

type BalanceUpdates struct {
	Kind     string `json:"kind"`
	Contract string `json:"contract,omitempty"`
	Change   *Int   `json:"change"`
	Category string `json:"category,omitempty"`
	Delegate string `json:"delegate,omitempty"`
	Cycle    int    `json:"cycle,omitempty"`
	Level    int    `json:"level,omitempty"`
}

BalanceUpdates represents the balance updates in a Tezos block

RPC:

/chains/<chain_id>/blocks/<block_id> (<dyn>)

Link:

https://tezos.gitlab.io/api/rpc.html#get-block-id-context-contracts-contract-id-balance

type BallotList

type BallotList []struct {
	PublicKeyHash string `json:"pkh"`
	Ballot        string `json:"ballot"`
}

BallotList represents a list of casted ballots in a block.

Path:

../<block_id>/votes/ballot_list (GET)

Link:

https://tezos.gitlab.io/api/rpc.html#get-block-id-votes-ballot-list

type Ballots

type Ballots struct {
	Yay  int `json:"yay"`
	Nay  int `json:"nay"`
	Pass int `json:"pass"`
}

Ballots represents a ballot total.

Path:

../<block_id>/votes/ballots (GET)

Link:

https://tezos.gitlab.io/api/rpc.html#get-block-id-votes-ballots

type Block

type Block struct {
	Protocol   string         `json:"protocol"`
	ChainID    string         `json:"chain_id"`
	Hash       string         `json:"hash"`
	Header     Header         `json:"header"`
	Metadata   Metadata       `json:"metadata"`
	Operations [][]Operations `json:"operations"`
}

Block represents a Tezos block.

RPC:

/chains/<chain_id>/blocks/<block_id> (<dyn>)

Link:

https://tezos.gitlab.io/api/rpc.html#get-block-id-context-contracts-contract-id-balance

type BlocksInput

type BlocksInput struct {
	//length is the requested number of predecessors to returns (per requested head).
	Length int
	//An empty argument requests blocks from the current heads. A non empty list allow to request specific fragment of the chain.
	Head string
	// When `min_date` is provided, heads with a timestamp before `min_date` are filtered out
	MinDate *time.Time
}

BlocksInput is the input for the goTezos.Blocks function.

Function:

func (t *GoTezos) EndorsingRights(input *EndorsingRightsInput) (*EndorsingRights, error) {}

type Bootstrap

type Bootstrap struct {
	Block     string    `json:"block"`
	Timestamp time.Time `json:"timestamp"`
}

Bootstrap represents the bootstrap RPC.

RPC:

/monitor/bootstrapped (GET)

Link:

https://tezos.gitlab.io/api/rpc.html#get-monitor-bootstrapped

type Checkpoint

type Checkpoint struct {
	Block struct {
		Level          int       `json:"level"`
		Proto          int       `json:"proto"`
		Predecessor    string    `json:"predecessor"`
		Timestamp      time.Time `json:"timestamp"`
		ValidationPass int       `json:"validation_pass"`
		OperationsHash string    `json:"operations_hash"`
		Fitness        []string  `json:"fitness"`
		Context        string    `json:"context"`
		ProtocolData   string    `json:"protocol_data"`
	} `json:"block"`
	SavePoint   int    `json:"save_point"`
	Caboose     int    `json:"caboose"`
	HistoryMode string `json:"history_mode"`
}

Checkpoint represents a Tezos checkpoint.

RPC:

/chains/<chain_id>/checkpoint (GET)

Link:

https://tezos.gitlab.io/api/rpc.html#get-chains-chain-id-checkpoint

type Connections

type Connections []struct {
	Incoming bool   `json:"incoming"`
	PeerID   string `json:"peer_id"`
	IDPoint  struct {
		Addr string `json:"addr"`
		Port int    `json:"port"`
	} `json:"id_point"`
	RemoteSocketPort int `json:"remote_socket_port"`
	Versions         []struct {
		Name  string `json:"name"`
		Major int    `json:"major"`
		Minor int    `json:"minor"`
	} `json:"versions"`
	Private       bool `json:"private"`
	LocalMetadata struct {
		DisableMempool bool `json:"disable_mempool"`
		PrivateNode    bool `json:"private_node"`
	} `json:"local_metadata"`
	RemoteMetadata struct {
		DisableMempool bool `json:"disable_mempool"`
		PrivateNode    bool `json:"private_node"`
	} `json:"remote_metadata"`
}

Connections represents the connections RPC.

RPC:

/network/connections (GET)

Link:

https://tezos.gitlab.io/api/rpc.html#get-network-connections

type Constants

type Constants struct {
	ProofOfWorkNonceSize         int      `json:"proof_of_work_nonce_size"`
	NonceLength                  int      `json:"nonce_length"`
	MaxRevelationsPerBlock       int      `json:"max_revelations_per_block"`
	MaxOperationDataLength       int      `json:"max_operation_data_length"`
	MaxProposalsPerDelegate      int      `json:"max_proposals_per_delegate"`
	PreservedCycles              int      `json:"preserved_cycles"`
	BlocksPerCycle               int      `json:"blocks_per_cycle"`
	BlocksPerCommitment          int      `json:"blocks_per_commitment"`
	BlocksPerRollSnapshot        int      `json:"blocks_per_roll_snapshot"`
	BlocksPerVotingPeriod        int      `json:"blocks_per_voting_period"`
	TimeBetweenBlocks            []string `json:"time_between_blocks"`
	EndorsersPerBlock            int      `json:"endorsers_per_block"`
	HardGasLimitPerOperation     *Int     `json:"hard_gas_limit_per_operation"`
	HardGasLimitPerBlock         *Int     `json:"hard_gas_limit_per_block"`
	ProofOfWorkThreshold         uint64   `json:"proof_of_work_threshold,string"`
	TokensPerRoll                string   `json:"tokens_per_roll"`
	MichelsonMaximumTypeSize     int      `json:"michelson_maximum_type_size"`
	SeedNonceRevelationTip       string   `json:"seed_nonce_revelation_tip"`
	OriginationSize              int      `json:"origination_size"`
	BlockSecurityDeposit         *Int     `json:"block_security_deposit"`
	EndorsementSecurityDeposit   *Int     `json:"endorsement_security_deposit"`
	BlockReward                  []*Int   `json:"block_reward"`
	EndorsementReward            []*Int   `json:"endorsement_reward"`
	CostPerByte                  *Int     `json:"cost_per_byte"`
	HardStorageLimitPerOperation *Int     `json:"hard_storage_limit_per_operation"`
}

Constants represents the constants RPC.

RPC:

../<block_id>/context/constants (GET)

Link:

https://tezos.gitlab.io/api/rpc.html#get-block-id-context-constants

type Contents

type Contents struct {
	Kind             string            `json:"kind,omitempty"`
	Source           string            `json:"source,omitempty"`
	Fee              *Int              `json:"fee,omitempty"`
	Counter          *Int              `json:"counter,omitempty"`
	GasLimit         *Int              `json:"gas_limit,omitempty"`
	StorageLimit     *Int              `json:"storage_limit,omitempty"`
	Amount           *Int              `json:"amount,omitempty"`
	Destination      string            `json:"destination,omitempty"`
	Delegate         string            `json:"delegate,omitempty"`
	Phk              string            `json:"phk,omitempty"`
	Secret           string            `json:"secret,omitempty"`
	Level            int               `json:"level,omitempty"`
	ManagerPublicKey string            `json:"managerPubkey,omitempty"`
	Balance          *Int              `json:"balance,omitempty"`
	Period           int               `json:"period,omitempty"`
	Proposal         string            `json:"proposal,omitempty"`
	Proposals        []string          `json:"proposals,omitempty"`
	Ballot           string            `json:"ballot,omitempty"`
	Metadata         *ContentsMetadata `json:"metadata,omitempty"`
	Nonce            string            `json:"nonce,omitempty"` // Revealing nonce for block
}

Contents represents the contents in a Tezos operations

RPC:

/chains/<chain_id>/blocks/<block_id> (<dyn>)

Link:

https://tezos.gitlab.io/api/rpc.html#get-block-id-context-contracts-contract-id-balance

func UnforgeOperation

func UnforgeOperation(operation string, signed bool) (string, []Contents, error)

UnforgeOperation takes a forged/encoded tezos operation and decodes it by returning the operations branch, and contents.

Parameters:

operation:
	The hex string encoded operation.

signed:
	The ?true Unforge will decode a signed operation.

type ContentsMetadata

type ContentsMetadata struct {
	BalanceUpdates           []BalanceUpdates            `json:"balance_updates"`
	OperationResult          *OperationResult            `json:"operation_result,omitempty"`
	Slots                    []int                       `json:"slots"`
	InternalOperationResults []*InternalOperationResults `json:"internal_operation_results,omitempty"`
}

ContentsMetadata represents the contents metadata in a Tezos operations

RPC:

/chains/<chain_id>/blocks/<block_id> (<dyn>)

Link:

https://tezos.gitlab.io/api/rpc.html#get-block-id-context-contracts-contract-id-balance

type Cycle

type Cycle struct {
	RandomSeed   string `json:"random_seed"`
	RollSnapshot int    `json:"roll_snapshot"`
	BlockHash    string `json:"-"`
}

Cycle represents the cycle RPC.

RPC:

../blocks/<block_id>/context/raw/json/cycle/<cycle_number> (GET)

type Delegate

type Delegate struct {
	Balance              string `json:"balance"`
	FrozenBalance        string `json:"frozen_balance"`
	FrozenBalanceByCycle []struct {
		Cycle   int  `json:"cycle"`
		Deposit *Int `json:"deposit"`
		Fees    *Int `json:"fees"`
		Rewards *Int `json:"rewards"`
	} `json:"frozen_balance_by_cycle"`
	StakingBalance    string   `json:"staking_balance"`
	DelegateContracts []string `json:"delegated_contracts"`
	DelegatedBalance  string   `json:"delegated_balance"`
	Deactivated       bool     `json:"deactivated"`
	GracePeriod       int      `json:"grace_period"`
}

Delegate represents the frozen delegate RPC on the tezos network.

RPC:

../<block_id>/context/delegates/<pkh> (GET)

Link:

https://tezos.gitlab.io/api/rpc.html#get-block-id-context-delegates-pkh

type DelegatesInput

type DelegatesInput struct {

	// The hash of block (height) of which you want to make the query.
	// Required.
	BlockHash string `validate:"required"`
	// contains filtered or unexported fields
}

DelegatesInput is the input for the goTezos.Delegates function.

Function:

func (t *GoTezos) Delegates(blockhash string) ([]string, error) {}

type EndorsingPowerInput

type EndorsingPowerInput struct {
	Endorsement Operations `json:"endorsement_operation"`
	ChainID     string     `json:"chain_id"`
}

type EndorsingRight

type EndorsingRight struct {
	Level         int       `json:"level"`
	Delegate      string    `json:"delegate"`
	Slots         []int     `json:"slots"`
	EstimatedTime time.Time `json:"estimated_time"`
}

type EndorsingRights

type EndorsingRights []EndorsingRight

EndorsingRights represents the endorsing rights RPC on the tezos network.

RPC:

../<block_id>/helpers/baking_rights (GET)

Link:

https://tezos.gitlab.io/api/rpc.html#get-block-id-helpers-baking-rights

type EndorsingRightsInput

type EndorsingRightsInput struct {
	// The block level of which you want to make the query.
	Level int

	// The cycle of which you want to make the query.
	Cycle int

	// The delegate public key hash of which you want to make the query.
	Delegate string

	// The hash of block (height) of which you want to make the query.
	// Required.
	BlockHash string `validate:"required"`
}

EndorsingRightsInput is the input for the goTezos.EndorsingRights function.

Function:

func (t *GoTezos) EndorsingRights(input *EndorsingRightsInput) (*EndorsingRights, error) {}

type Error

type Error struct {
	Kind string `json:"kind"`
	ID   string `json:"id"`
}

Error respresents an error for operation results

RPC:

/chains/<chain_id>/blocks/<block_id> (<dyn>)

Link:

https://tezos.gitlab.io/api/rpc.html#get-block-id-context-contracts-contract-id-balance

type ForgeDelegationOperationInput

type ForgeDelegationOperationInput struct {
	Source       string `validate:"required"`
	Fee          *Int   `validate:"required"`
	Counter      int    `validate:"required"`
	GasLimit     *Int   `validate:"required"`
	Delegate     string `validate:"required"`
	StorageLimit *Int
}

ForgeDelegationOperationInput is the input for the ForgeDelegationOperation function.

Function:

func ForgeDelegationOperation(branch string, input ...ForgeDelegationOperationInput) (string, error) {}

func (*ForgeDelegationOperationInput) Contents

func (f *ForgeDelegationOperationInput) Contents() *Contents

Contents returns ForgeDelegationOperationInput as a pointer to Contents

type ForgeOperationWithRPCInput

type ForgeOperationWithRPCInput struct {
	Blockhash    string     `validate:"required"`
	Branch       string     `validate:"required"`
	Contents     []Contents `validate:"required"`
	CheckRPCAddr string
}

ForgeOperationWithRPCInput is the input for the goTezos.ForgeOperationWithRPC function.

Fields:

Blockhash:
	The hash of block (height) of which you want to make the query.

Contents:
	The contents of the of the operation.

Branch:
	The branch of the operation to be forged.

CheckRPCAddr:
	Overides the GoTezos client with a new one pointing to a different address. This allows the user to validate the forge against different nodes for security.

Function:

func (t *GoTezos) ForgeOperationWithRPC(blockhash, branch string, contents ...Contents) (string, error) {}

type ForgeOriginationOperationInput

type ForgeOriginationOperationInput struct {
	Source       string `validate:"required"`
	Fee          *Int   `validate:"required"`
	Counter      int    `validate:"required"`
	GasLimit     *Int   `validate:"required"`
	Balance      *Int   `validate:"required"`
	StorageLimit *Int
	Delegate     string
}

ForgeOriginationOperationInput is the input for the ForgeOriginationOperation function.

Function:

func ForgeOriginationOperation(branch string, input ...ForgeOriginationOperationInput) (string, error) {}

func (*ForgeOriginationOperationInput) Contents

Contents returns ForgeOriginationOperationInput as a pointer to Contents

type ForgeRevealOperationInput

type ForgeRevealOperationInput struct {
	Source       string `validate:"required"`
	Fee          *Int   `validate:"required"`
	Counter      int    `validate:"required"`
	GasLimit     *Int   `validate:"required"`
	Phk          string `validate:"required"`
	StorageLimit *Int
}

ForgeRevealOperationInput is the input for the ForgeRevalOperation function.

Function:

func ForgeRevalOperation(branch string, input ...ForgeRevealOperationInput) (string, error) {}

func (*ForgeRevealOperationInput) Contents

func (f *ForgeRevealOperationInput) Contents() *Contents

Contents returns ForgeRevealOperationInput as a pointer to Contents

type ForgeTransactionOperationInput

type ForgeTransactionOperationInput struct {
	Source       string `validate:"required"`
	Fee          *Int   `validate:"required"`
	Counter      int    `validate:"required"`
	GasLimit     *Int   `validate:"required"`
	Destination  string `validate:"required"`
	Amount       *Int   `validate:"required"`
	StorageLimit *Int
}

ForgeTransactionOperationInput is the input for the ForgeTransactionOperation function.

Function:

func ForgeTransactionOperation(branch string, input ...ForgeTransactionOperationInput) (string, error) {}

func (*ForgeTransactionOperationInput) Contents

Contents returns ForgeTransactionOperationInput as a pointer to Contents

type ForgedBlockHeader

type ForgedBlockHeader struct {
	BlockHeader string `json:"block"`
}

type FrozenBalance

type FrozenBalance struct {
	Deposits *Int `json:"deposits"`
	Fees     *Int `json:"fees"`
	Rewards  *Int `json:"rewards"`
}

FrozenBalance represents the frozen balance RPC on the tezos network.

RPC:

../<block_id>/context/delegates/<pkh>/frozen_balance (GET)

Link:

https://tezos.gitlab.io/api/rpc.html#get-block-id-context-delegates-pkh-frozen-balance

type GoTezos

type GoTezos struct {
	NetworkConstants *Constants
	// contains filtered or unexported fields
}

GoTezos contains a client (http.Client), network contents, and the host of the node. Gives access to RPC related functions.

func New

func New(host string) (*GoTezos, error)

New returns a pointer to a GoTezos and initializes the library with the host's Tezos netowrk constants.

Parameters:

host:
	A Tezos node.

func (*GoTezos) ActiveChains

func (t *GoTezos) ActiveChains() (ActiveChains, error)

ActiveChains monitor every chain creation and destruction. Currently active chains will be given as first elements.

Path:

/monitor/active_chains (GET)

Link:

https://tezos.gitlab.io/api/rpc.html#get-monitor-active-chains

func (*GoTezos) BakingRights

func (t *GoTezos) BakingRights(input BakingRightsInput) (*BakingRights, error)

BakingRights retrieves the list of delegates allowed to bake a block. By default, it gives the best baking priorities for bakers that have at least one opportunity below the 64th priority for the next block. Parameters `level` and `cycle` can be used to specify the (valid) level(s) in the past or future at which the baking rights have to be returned. Parameter `delegate` can be used to restrict the results to the given delegates. If parameter `all` is set, all the baking opportunities for each baker at each level are returned, instead of just the first one. Returns the list of baking slots. Also returns the minimal timestamps that correspond to these slots. The timestamps are omitted for levels in the past, and are only estimates for levels later that the next block, based on the hypothesis that all predecessor blocks were baked at the first priority.

Path:

../<block_id>/helpers/baking_rights (GET)

Link:

https://tezos.gitlab.io/api/rpc.html#get-block-id-helpers-baking-rights

Parameters:

BakingRightsInput:
	Modifies the BakingRights RPC query by passing optional URL parameters. BlockHash is required.

func (*GoTezos) Balance

func (t *GoTezos) Balance(blockhash, address string) (*big.Int, error)

Balance gives access to the balance of a contract.

Path:

../<block_id>/context/contracts/<contract_id>/balance (GET)

Link:

https://tezos.gitlab.io/api/rpc.html#get-block-id-context-contracts-contract-id-balance

Parameters:

blockhash:
	The hash of block (height) of which you want to make the query.

address:
	Any tezos public address.

func (*GoTezos) BallotList

func (t *GoTezos) BallotList(blockhash string) (BallotList, error)

BallotList returns ballots casted so far during a voting period.

Path:

../<block_id>/votes/ballot_list (GET)

Link:

https://tezos.gitlab.io/api/rpc.html#get-block-id-votes-ballot-list

Parameters:

blockhash:
	The hash of block (height) of which you want to make the query.

func (*GoTezos) Ballots

func (t *GoTezos) Ballots(blockhash string) (Ballots, error)

Ballots returns sum of ballots casted so far during a voting period.

Path:

../<block_id>/votes/ballots (GET)

Link:

https://tezos.gitlab.io/api/rpc.html#get-block-id-votes-ballots

Parameters:

blockhash:
	The hash of block (height) of which you want to make the query.

func (*GoTezos) Block

func (t *GoTezos) Block(id interface{}) (*Block, error)

Block gets all the information about block.RPC

Path

/chains/<chain_id>/blocks/<block_id> (GET)

Link

https://tezos.gitlab.io/api/rpc.html#get-chains-chain-id-blocks

Parameters:

id:
	hash = <string> : The block hash.
	level = <int> : The block level.

func (*GoTezos) Blocks

func (t *GoTezos) Blocks(input BlocksInput) ([][]string, error)

Blocks lists known heads of the blockchain sorted with decreasing fitness. Optional arguments allows to returns the list of predecessors for known heads or the list of predecessors for a given list of blocks.

Path:

/chains/<chain_id>/blocks (GET)

Link:

https://tezos.gitlab.io/api/rpc.html#get-chains-chain-id-blocks

Parameters:

input:
	Modifies the Blocks RPC query by passing optional URL parameters.

func (*GoTezos) Bootstrap

func (t *GoTezos) Bootstrap() (Bootstrap, error)

Bootstrap waits for the node to have synchronized its chain with a few peers (configured by the node's administrator), streaming head updates that happen during the bootstrapping process, and closing the stream at the end. If the node was already bootstrapped, returns the current head immediately.

Path:

/monitor/bootstrapped (GET)

Link:

https://tezos.gitlab.io/api/rpc.html#get-monitor-bootstrapped

func (*GoTezos) ChainID

func (t *GoTezos) ChainID() (string, error)

ChainID gets the chain unique identifier.

Path:

/chains/<chain_id>/chain_id (GET)

Link:

https://tezos.gitlab.io/api/rpc.html#get-chains-chain-id-chain-id

func (*GoTezos) Checkpoint

func (t *GoTezos) Checkpoint() (Checkpoint, error)

Checkpoint gets the current checkpoint for this chain.

Path:

/chains/<chain_id>/checkpoint (GET)RPC

Link:

https://tezos.gitlab.io/api/rpc.html#get-chains-chain-id-checkpoint

func (*GoTezos) Commit

func (t *GoTezos) Commit() (string, error)

Commit gets information on the build of the node.

Path:

/monitor/commit_hash (GET)

Link:

https://tezos.gitlab.io/api/rpc.html#get-monitor-commit-hash

func (*GoTezos) Connections

func (t *GoTezos) Connections() (Connections, error)

Connections lists the running P2P connection.

Path:

/network/connections (GET)

Link:

https://tezos.gitlab.io/api/rpc.html#get-network-connections

func (*GoTezos) Constants

func (t *GoTezos) Constants(blockhash string) (Constants, error)

Constants gets all constants.

Path:

../<block_id>/context/constants (GET)

Link:

https://tezos.gitlab.io/api/rpc.html#get-block-id-context-constants

func (*GoTezos) ContractStorage

func (t *GoTezos) ContractStorage(blockhash string, KT1 string) ([]byte, error)

ContractStorage gets access the data of the contract.

Path:

../<block_id>/context/contracts/<contract_id>/storage (GET)

Link:

https://tezos.gitlab.io/api/rpc.html#get-block-id-context-contracts-contract-id-storage

Parameters:

blockhash:
	The hash of block (height) of which you want to make the query.

KT1:
	The contract address.

func (*GoTezos) Counter

func (t *GoTezos) Counter(blockhash, pkh string) (int, error)

Counter access the counter of a contract, if any.

Path:

../<block_id>/context/contracts/<contract_id>/counter (GET)

Link:

https://tezos.gitlab.io/api/rpc.html#get-block-id-context-contracts-contract-id-counter

Parameters:

blockhash:
	The hash of block (height) of which you want to make the query.

pkh:
	The pkh (address) of the contract for the query.

func (*GoTezos) CurrentPeriodKind

func (t *GoTezos) CurrentPeriodKind(blockhash string) (string, error)

CurrentPeriodKind returns the current period kind.

Path:

../<block_id>/votes/current_period_kind (GET)

Link:

https://tezos.gitlab.io/api/rpc.html#get-block-id-votes-current-period-kind

Parameters:

blockhash:
	The hash of block (height) of which you want to make the query.

func (*GoTezos) CurrentProposal

func (t *GoTezos) CurrentProposal(blockhash string) (string, error)

CurrentProposal returns the current proposal under evaluation.

Path:

../<block_id>/votes/current_proposal (GET)

Link:

https://tezos.gitlab.io/api/rpc.html#get-block-id-votes-current-proposal

Parameters:

blockhash:
	The hash of block (height) of which you want to make the query.

func (*GoTezos) CurrentQuorum

func (t *GoTezos) CurrentQuorum(blockhash string) (int, error)

CurrentQuorum returns the current expected quorum.

Path:

../<block_id>/votes/current_proposal (GET)

Link:

https://tezos.gitlab.io/api/rpc.html#get-block-id-votes-current-quorum

Parameters:

blockhash:
	The hash of block (height) of which you want to make the query.

func (*GoTezos) Cycle

func (t *GoTezos) Cycle(cycle int) (Cycle, error)

Cycle gets information about a tezos snapshot or cycle.

Path:

../context/raw/json/cycle/%d" (GET)

Link:

https://tezos.gitlab.io/api/rpc.html#get-block-id-context-raw-bytes

func (*GoTezos) Delegate

func (t *GoTezos) Delegate(blockhash, delegate string) (Delegate, error)

Delegate gets everything about a delegate.

Path:

../<block_id>/context/delegates/<pkh> (GET)

Link:

https://tezos.gitlab.io/api/rpc.html#get-block-id-context-delegates-pkh

Parameters:

cycle:
	The cycle of which you want to make the query.

delegate:
	The tz(1-3) address of the delegate.

func (*GoTezos) DelegatedContracts

func (t *GoTezos) DelegatedContracts(blockhash, delegate string) ([]*string, error)

DelegatedContracts Returns the list of contracts that delegate to a given delegate.

Path:

../<block_id>/context/delegates/<pkh>/delegated_contracts (GET)

Link:

https://tezos.gitlab.io/api/rpc.html#get-block-id-context-delegates-pkh-delegated-contracts

Parameters:

blockhash:
	The hash of block (height) of which you want to make the query.

delegate:
	The tz(1-3) address of the delegate.

func (*GoTezos) DelegatedContractsAtCycle

func (t *GoTezos) DelegatedContractsAtCycle(cycle int, delegate string) ([]*string, error)

DelegatedContractsAtCycle returns the list of contracts that delegate to a given delegate at a specific cycle or snapshot.

Path:

../<block_id>/context/delegates/<pkh>/delegated_contracts (GET)

Link:

https://tezos.gitlab.io/api/rpc.html#get-block-id-context-delegates-pkh-delegated-contracts

Parameters:

cycle:
	The cycle of which you want to make the query.

delegate:
	The tz(1-3) address of the delegate.

func (*GoTezos) Delegates

func (t *GoTezos) Delegates(input DelegatesInput) ([]*string, error)

Delegates lists all registered delegates.

Path:

../<block_id>/context/delegates (GET)

Link:

https://tezos.gitlab.io/api/rpc.html#get-block-id-context-delegates

Parameters:

cycle:
	The cycle of which you want to make the query.

delegate:
	The tz(1-3) address of the delegate.

func (*GoTezos) DeleteInvalidBlock

func (t *GoTezos) DeleteInvalidBlock(blockHash string) error

DeleteInvalidBlock remove an invalid block for the tezos storage.

Path:

/chains/<chain_id>/invalid_blocks/<block_hash> (DELETE)

Link:

https://tezos.gitlab.io/api/rpc.html#delete-chains-chain-id-invalid-blocks-block-hash

func (*GoTezos) EndorsingRights

func (t *GoTezos) EndorsingRights(input EndorsingRightsInput) (*EndorsingRights, error)

EndorsingRights retrieves the delegates allowed to endorse a block. By default, it gives the endorsement slots for delegates that have at least one in the next block. Parameters `level` and `cycle` can be used to specify the (valid) level(s) in the past or future at which the endorsement rights have to be returned. Parameter `delegate` can be used to restrict the results to the given delegates. Returns the list of endorsement slots. Also returns the minimal timestamps that correspond to these slots. The timestamps are omitted for levels in the past, and are only estimates for levels later that the next block, based on the hypothesis that all predecessor blocks were baked at the first priority.

Path:

../<block_id>/helpers/endorsing_rights (GET)

Link:

https://tezos.gitlab.io/api/rpc.html#get-block-id-helpers-endorsing-rights

Parameters:

EndorsingRightsInput:
	Modifies the EndorsingRights RPC query by passing optional URL parameters. BlockHash is required.

func (*GoTezos) ForgeBlockHeader

func (t *GoTezos) ForgeBlockHeader(sh ShellHeader) (ForgedBlockHeader, error)

func (*GoTezos) ForgeOperationWithRPC

func (t *GoTezos) ForgeOperationWithRPC(input ForgeOperationWithRPCInput) (string, error)

ForgeOperationWithRPC will forge an operation with the tezos RPC. For security purposes ForgeOperationWithRPC will preapply an operation to verify the node forged the operation with the requested contents.

If you would rather not use a node at all, GoTezos supports local forging operations REVEAL, TRANSFER, ORIGINATION, and DELEGATION.

Path:

../<block_id>/helpers/forge/operations (POST)

Link:

https://tezos.gitlab.io/api/rpc.html#post-block-id-helpers-forge-operations

Parameters:

blockhash:
	The hash of block (height) of which you want to make the query.

branch:
	The branch of the operation.

contents:
	The contents of the of the operation.

func (*GoTezos) FrozenBalance

func (t *GoTezos) FrozenBalance(cycle int, delegate string) (FrozenBalance, error)

FrozenBalance returns the total frozen balances of a given delegate, this includes the frozen deposits, rewards and fees.

Path:

../<block_id>/context/delegates/<pkh>/frozen_balance (GET)

Link:

https://tezos.gitlab.io/api/rpc.html#get-block-id-context-delegates-pkh-frozen-balance

Parameters:

cycle:
	The cycle of which you want to make the query.

delegate:
	The tz(1-3) address of the delegate.

func (*GoTezos) GetEndorsingPower

func (t *GoTezos) GetEndorsingPower(operation EndorsingPowerInput) (int, error)

func (*GoTezos) Head

func (t *GoTezos) Head() (*Block, error)

Head gets all the information about the head block.

Path:

/chains/<chain_id>/blocks/head (GET)

Link:

https://tezos.gitlab.io/api/rpc.html#get-chains-chain-id-blocks

func (*GoTezos) InjectionBlock

func (t *GoTezos) InjectionBlock(input InjectionBlockInput) ([]byte, error)

InjectionBlock inject a block in the node and broadcast it. The `operations` embedded in `blockHeader` might be pre-validated using contextual RPCs from the latest block (e.g. '/blocks/head/context/preapply'). Returns the ID of the block. By default, the RPC will wait for the block to be validated before answering. If ?async is true, the function returns immediately. Otherwise, the block will be validated before the result is returned. If ?force is true, it will be injected even on non strictly increasing fitness. An optional ?chain parameter can be used to specify whether to inject on the test chain or the main chain.

Path:

/injection/block (POST)

Link:

https/tezos.gitlab.io/api/rpc.html#post-injection-operation

Parameters:

input:
	Modifies the InjectionBlock RPC query by passing optional URL parameters. Block is required.

func (*GoTezos) InjectionOperation

func (t *GoTezos) InjectionOperation(input InjectionOperationInput) (string, error)

InjectionOperation injects an operation in node and broadcast it. Returns the ID of the operation. The `signedOperationContents` should be constructed using a contextual RPCs from the latest block and signed by the client. By default, the RPC will wait for the operation to be (pre-)validated before answering. See RPCs under /blocks/prevalidation for more details on the prevalidation context. If ?async is true, the function returns immediately. Otherwise, the operation will be validated before the result is returned. An optional ?chain parameter can be used to specify whether to inject on the test chain or the main chain.

Path:

/injection/operation (POST)

Link:

https/tezos.gitlab.io/api/rpc.html#post-injection-operation

Parameters:

input:
	Modifies the InjectionOperation RPC query by passing optional URL parameters. Operation is required.

func (*GoTezos) InvalidBlock

func (t *GoTezos) InvalidBlock(blockHash string) (InvalidBlock, error)

InvalidBlock gets the errors that appears during the block (in)validation.

Path:

/chains/<chain_id>/invalid_blocks/<block_hash> (GET)

Link:

https://tezos.gitlab.io/api/rpc.html#get-chains-chain-id-invalid-blocks-block-hash

func (*GoTezos) InvalidBlocks

func (t *GoTezos) InvalidBlocks() ([]InvalidBlock, error)

InvalidBlocks lists blocks that have been declared invalid along with the errors that led to them being declared invalid.

Path:

/chains/<chain_id>/invalid_blocks (GET)

Link:

https://tezos.gitlab.io/api/rpc.html#get-chains-chain-id-invalid-blocks

func (*GoTezos) Mempool

func (t *GoTezos) Mempool(input MempoolInput) (Mempool, error)

Mempool fetches the current contents of main the chain mempool.

Path:

/chains/<chain_id>/mempool/pending_operations (GET)

Parameters:

None

func (*GoTezos) MinimalValidTime

func (t *GoTezos) MinimalValidTime(endorsingPower, priority int, chainID string) (time.Time, error)

func (*GoTezos) OperationHashes

func (t *GoTezos) OperationHashes(blockhash string) ([][]string, error)

OperationHashes is the hashes of all the operations included in the block.

Path:

../<block_id>/operation_hashes (GET)

Link:

https://tezos.gitlab.io/api/rpc.html#get-block-id-context-contracts-contract-id-balance

Parameters:

blockhash:
	The hash of block (height) of which you want to make the query.

func (*GoTezos) PreapplyBlockOperation

func (t *GoTezos) PreapplyBlockOperation(input PreapplyBlockOperationInput) (PreapplyResult, error)

func (*GoTezos) PreapplyOperations

func (t *GoTezos) PreapplyOperations(input PreapplyOperationsInput) ([]Operations, error)

PreapplyOperations simulates the validation of an operation.

Path:

../<block_id>/helpers/preapply/operations (POST)

Link:

https://tezos.gitlab.io/api/rpc.html#post-block-id-helpers-preapply-operations

Parameters:

input:
	PreapplyOperationsInput contains the blockhash, protocol, signature, and operation contents needed to fufill this RPC.

func (*GoTezos) Proposals

func (t *GoTezos) Proposals(blockhash string) (Proposals, error)

Proposals returns a list of proposals with number of supporters.

Path:

../<block_id>/votes/proposals (GET)

Link:

https://tezos.gitlab.io/api/rpc.html#get-block-id-votes-proposals

Parameters:

blockhash:
	The hash of block (height) of which you want to make the query.

func (*GoTezos) SetClient

func (t *GoTezos) SetClient(client *http.Client)

SetClient overrides GoTezos's client. *http.Client satisfies the client interface.

Parameters:

client:
	A pointer to an http.Client.

func (*GoTezos) SetConstants

func (t *GoTezos) SetConstants(constants Constants)

SetConstants overrides GoTezos's NetworkConstants.

Parameters:

constants:
	Tezos Network Constants.

func (*GoTezos) StakingBalance

func (t *GoTezos) StakingBalance(blockhash, delegate string) (*big.Int, error)

StakingBalance returns the total amount of tokens delegated to a given delegate. This includes the balances of all the contracts that delegate to it, but also the balance of the delegate itself and its frozen fees and deposits. The rewards do not count in the delegated balance until they are unfrozen.

Path:

../<block_id>/context/delegates/<pkh>/staking_balance (GET)

Link:

https://tezos.gitlab.io/api/rpc.html#get-block-id-context-delegates-pkh-staking-balance

Parameters:

blockhash:
	The hash of block (height) of which you want to make the query.

delegate:
	The tz(1-3) address of the delegate.

func (*GoTezos) StakingBalanceAtCycle

func (t *GoTezos) StakingBalanceAtCycle(cycle int, delegate string) (*big.Int, error)

StakingBalanceAtCycle returns the total amount of tokens delegated to a given delegate. This includes the balances of all the contracts that delegate to it, but also the balance of the delegate itself and its frozen fees and deposits. The rewards do not count in the delegated balance until they are unfrozen.

Path:

../<block_id>/context/delegates/<pkh>/staking_balance (GET)

Link:

https://tezos.gitlab.io/api/rpc.html#get-block-id-context-delegates-pkh-staking-balance

Parameters:

cycle:
	The cycle of which you want to make the query.

delegate:
	The tz(1-3) address of the delegate.

func (*GoTezos) UnforgeOperationWithRPC

func (t *GoTezos) UnforgeOperationWithRPC(blockhash string, input UnforgeOperationWithRPCInput) ([]Operations, error)

UnforgeOperationWithRPC will unforge an operation with the tezos RPC.

If you would rather not use a node at all, GoTezos supports local unforging operations REVEAL, TRANSFER, ORIGINATION, and DELEGATION.

Path:

../<block_id>/helpers/parse/operations (POST)

Link:

https://tezos.gitlab.io/api/rpc.html#post-block-id-helpers-parse-operations

Parameters:

blockhash:
	The hash of block (height) of which you want to make the query.

input:
	Contains the operations and the option to verify the operations signatures.

func (*GoTezos) UserActivatedProtocolOverrides

func (t *GoTezos) UserActivatedProtocolOverrides() (UserActivatedProtocolOverrides, error)

UserActivatedProtocolOverrides list of protocols which replace other protocols.

Path:

/config/network/user_activated_protocol_overrides (GET)

Link:

https://tezos.gitlab.io/api/rpc.html#get-config-network-user-activated-protocol-overrides

func (*GoTezos) Version

func (t *GoTezos) Version() (Version, error)

Version gets supported network layer version.

Path:

/network/version (GET)

Link:

https://tezos.gitlab.io/api/rpc.html#get-network-version

func (*GoTezos) VoteListings

func (t *GoTezos) VoteListings(blockhash string) (Listings, error)

VoteListings returns a list of delegates with their voting weight, in number of rolls.

Path:

../<block_id>/votes/listings (GET)

Link:

https://tezos.gitlab.io/api/rpc.html#get-block-id-votes-listings

Parameters:

blockhash:
	The hash of block (height) of which you want to make the query.
type Header struct {
	Level            int       `json:"level"`
	Proto            int       `json:"proto"`
	Predecessor      string    `json:"Predecessor"`
	Timestamp        time.Time `json:"timestamp"`
	ValidationPass   int       `json:"validation_pass"`
	OperationsHash   string    `json:"operations_hash"`
	Fitness          []string  `json:"fitness"`
	Context          string    `json:"context"`
	Priority         int       `json:"priority"`
	ProofOfWorkNonce string    `json:"proof_of_work_nonce"`
	Signature        string    `json:"signature"`
}

Header represents the header in a Tezos block

RPC:

/chains/<chain_id>/blocks/<block_id> (<dyn>)

Link:

https://tezos.gitlab.io/api/rpc.html#get-block-id-context-contracts-contract-id-balance

type IFace

type IFace interface {
	ActiveChains() (ActiveChains, error)
	BakingRights(input BakingRightsInput) (*BakingRights, error)
	Balance(blockhash, address string) (*big.Int, error)
	BallotList(blockhash string) (BallotList, error)
	Ballots(blockhash string) (Ballots, error)
	Block(id interface{}) (*Block, error)
	Blocks(input BlocksInput) ([][]string, error)
	Bootstrap() (Bootstrap, error)
	ChainID() (string, error)
	Checkpoint() (Checkpoint, error)
	Commit() (string, error)
	Connections() (Connections, error)
	Constants(blockhash string) (Constants, error)
	ContractStorage(blockhash string, KT1 string) ([]byte, error)
	Counter(blockhash, pkh string) (int, error)
	CurrentPeriodKind(blockhash string) (string, error)
	CurrentProposal(blockhash string) (string, error)
	CurrentQuorum(blockhash string) (int, error)
	Cycle(cycle int) (Cycle, error)
	Delegate(blockhash, delegate string) (Delegate, error)
	Delegates(input DelegatesInput) ([]*string, error)
	DelegatedContracts(blockhash, delegate string) ([]*string, error)
	DelegatedContractsAtCycle(cycle int, delegate string) ([]*string, error)
	DeleteInvalidBlock(blockHash string) error
	EndorsingRights(input EndorsingRightsInput) (*EndorsingRights, error)
	ForgeOperationWithRPC(input ForgeOperationWithRPCInput) (string, error)
	FrozenBalance(cycle int, delegate string) (FrozenBalance, error)
	Head() (*Block, error)
	InjectionBlock(input InjectionBlockInput) ([]byte, error)
	InjectionOperation(input InjectionOperationInput) (string, error)
	InvalidBlock(blockHash string) (InvalidBlock, error)
	InvalidBlocks() ([]InvalidBlock, error)
	OperationHashes(blockhash string) ([][]string, error)
	PreapplyOperations(input PreapplyOperationsInput) ([]Operations, error)
	Proposals(blockhash string) (Proposals, error)
	StakingBalance(blockhash, delegate string) (*big.Int, error)
	StakingBalanceAtCycle(cycle int, delegate string) (*big.Int, error)
	UnforgeOperationWithRPC(blockhash string, input UnforgeOperationWithRPCInput) ([]Operations, error)
	UserActivatedProtocolOverrides() (UserActivatedProtocolOverrides, error)
	Version() (Version, error)
}

IFace is an interface mocking a GoTezos object.

type InjectionBlockInput

type InjectionBlockInput struct {

	// Block header signature
	SignedBytes string `validate:"required"`

	// Operations included in the block
	// This is not the same as operations found in mempool
	// and also not like preapply result
	Operations [][]interface{} `validate:"required"`

	// If ?async is true, the function returns immediately.
	Async bool

	// If ?force is true, it will be injected even on non strictly increasing fitness.
	Force bool

	// Specify the ChainID.
	ChainID string
}

InjectionBlockInput is the input for the goTezos.InjectionBlock function.

Function:

func (t *GoTezos) InjectionBlock(input InjectionBlockInput) ([]byte, error) {}

type InjectionOperationInput

type InjectionOperationInput struct {
	// The operation string.
	Operation string `validate:"required"`

	// If ?async is true, the function returns immediately.
	Async bool

	// Specify the ChainID.
	ChainID string
}

InjectionOperationInput is the input for the goTezos.InjectionOperation function.

Function:

func (t *GoTezos) InjectionOperation(input InjectionOperationInput) ([]byte, error) {}

type Int

type Int struct {
	Big *big.Int
}

Int Wrapper Description: Int wraps go's big.Int.

func NewInt

func NewInt(i int) *Int

NewInt returns a pointer GoTezos's wrapper Int

func (*Int) MarshalJSON

func (i *Int) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for BigInt

func (*Int) UnmarshalJSON

func (i *Int) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Marshaler interface for BigInt

Parameters:

b:
	The byte representation of a BigInt.

type InternalOperationResults

type InternalOperationResults struct {
	Kind        string           `json:"kind"`
	Source      string           `json:"source"`
	Nonce       uint64           `json:"nonce"`
	Amount      string           `json:"amount"`
	Destination string           `json:"destination"`
	Result      *OperationResult `json:"result"`
}

InternalOperationResults represents a field in contents metadata in a Tezos operations

RPC:

/chains/<chain_id>/blocks/<block_id> (<dyn>)

Link:

https://tezos.gitlab.io/api/rpc.html#get-block-id-context-contracts-contract-id-balance

type InvalidBlock

type InvalidBlock struct {
	Block  string    `json:"block"`
	Level  int       `json:"level"`
	Errors RPCErrors `json:"errors"`
}

InvalidBlock represents Tezos invalid blocks.

RPC:

/chains/<chain_id>/invalid_blocks (GET)

Link:

https://tezos.gitlab.io/api/rpc.html#get-chains-chain-id-invalid-blocks

type Level

type Level struct {
	Level                int  `json:"level"`
	LevelPosition        int  `json:"level_position"`
	Cycle                int  `json:"cycle"`
	CyclePosition        int  `json:"cycle_position"`
	VotingPeriod         int  `json:"voting_period"`
	VotingPeriodPosition int  `json:"voting_period_position"`
	ExpectedCommitment   bool `json:"expected_commitment"`
}

Level represents the level in a Tezos block

RPC:

/chains/<chain_id>/blocks/<block_id> (<dyn>)

Link:

https://tezos.gitlab.io/api/rpc.html#get-block-id-context-contracts-contract-id-balance

type Listings

type Listings []struct {
	PublicKeyHash string `json:"pkh"`
	Rolls         int    `json:"rolls"`
}

Listings represents a list of delegates with their voting weight, in number of rolls.

Path:

../<block_id>/votes/listings (GET)

Link:

https://tezos.gitlab.io/api/rpc.html#get-block-id-votes-listings

type MaxOperationListLength

type MaxOperationListLength struct {
	MaxSize int `json:"max_size"`
	MaxOp   int `json:"max_op,omitempty"`
}

MaxOperationListLength represents the maxoperationlistlength in a Tezos block

RPC:

/chains/<chain_id>/blocks/<block_id> (<dyn>)

Link:

https://tezos.gitlab.io/api/rpc.html#get-block-id-context-contracts-contract-id-balance

type Mempool

type Mempool struct {
	Applied       []Operations    `json:"applied"`
	Refused       []OperationsAlt `json:"refused"`
	BranchRefused []OperationsAlt `json:"branch_refused"`
	BranchDelayed []OperationsAlt `json:"branch_delayed"`
	Unprocessed   []OperationsAlt `json:"unprocessed"`
}

Mempool represents the contents of the Tezos mempool.

RPC:

/chains/<chain_id>/mempool/pending_operations (GET)

type MempoolInput

type MempoolInput struct {
	// Specify the ChainID.
	ChainID string `validate:"required"`

	// Mempool filters
	Applied       bool
	BranchDelayed bool
	Refused       bool
	BranchRefused bool
}

MempoolInput is the input for the goTezos.Mempool function.

Function:

func (t *GoTezos) Mempool(input *MempoolInput) (Mempool, error) {}

type Metadata

type Metadata struct {
	Protocol               string                   `json:"protocol"`
	NextProtocol           string                   `json:"next_protocol"`
	TestChainStatus        TestChainStatus          `json:"test_chain_status"`
	MaxOperationsTTL       int                      `json:"max_operations_ttl"`
	MaxOperationDataLength int                      `json:"max_operation_data_length"`
	MaxBlockHeaderLength   int                      `json:"max_block_header_length"`
	MaxOperationListLength []MaxOperationListLength `json:"max_operation_list_length"`
	Baker                  string                   `json:"baker"`
	Level                  Level                    `json:"level"`
	VotingPeriodKind       string                   `json:"voting_period_kind"`
	NonceHash              interface{}              `json:"nonce_hash"`
	ConsumedGas            string                   `json:"consumed_gas"`
	Deactivated            []string                 `json:"deactivated"`
	BalanceUpdates         []BalanceUpdates         `json:"balance_updates"`
}

Metadata represents the metadata in a Tezos block

RPC:

/chains/<chain_id>/blocks/<block_id> (<dyn>)

Link:

https://tezos.gitlab.io/api/rpc.html#get-block-id-context-contracts-contract-id-balance

type OperationResult

type OperationResult struct {
	BalanceUpdates      []BalanceUpdates `json:"balance_updates"`
	OriginatedContracts []string         `json:"originated_contracts"`
	Status              string           `json:"status"`
	ConsumedGas         *Int             `json:"consumed_gas,omitempty"`
	Errors              []Error          `json:"errors,omitempty"`
}

OperationResult represents the operation result in a Tezos block

RPC:

/chains/<chain_id>/blocks/<block_id> (<dyn>)

Link:

https://tezos.gitlab.io/api/rpc.html#get-block-id-context-contracts-contract-id-balance

type Operations

type Operations struct {
	Protocol  string     `json:"protocol,omitempty"`
	ChainID   string     `json:"chain_id,omitempty"`
	Hash      string     `json:"hash,omitempty"`
	Branch    string     `json:"branch"`
	Contents  []Contents `json:"contents"`
	Signature string     `json:"signature,omitempty"`
	Data      string     `json:"data,omitempty"`
	Errors    []Error    `json:"errors,omitempty"`
}

Operations represents the operations in a Tezos block

RPC:

/chains/<chain_id>/blocks/<block_id> (<dyn>)

Link:

https://tezos.gitlab.io/api/rpc.html#get-block-id-context-contracts-contract-id-balance

type OperationsAlt

type OperationsAlt Operations

OperationsAlt represents a JSON array containing an opHash at index 0, and an Operation object at index 1. The RPC does not properly objectify Refused, BranchRefused, BranchDelayed, and Unprocessed sections of the mempool, so we must parse them manually.

Code hints used from github.com/blockwatch-cc/tzindex/rpc/mempool.go

func (*OperationsAlt) UnmarshalJSON

func (o *OperationsAlt) UnmarshalJSON(buf []byte) error

type PreApplyOperations

type PreApplyOperations struct {
	Hash   string `json:"hash"`
	Branch string `json:"branch"`
	Data   string `json:"data"`
}

type PreApplyOperationsAlt

type PreApplyOperationsAlt PreApplyOperations

func (*PreApplyOperationsAlt) UnmarshalJSON

func (o *PreApplyOperationsAlt) UnmarshalJSON(buf []byte) error

type PreapplyBlockOperationInput

type PreapplyBlockOperationInput struct {
	// Header data for the new block
	Protocoldata ProtocolData `validate:"required"`

	// Operations (txn, endorsements, etc) to be contained in the next block
	Operations [][]Operations `validate:"required"`

	// Sort operations on return
	Sort bool `validate:"required"`

	// Earliest timestamp of next block
	Timestamp time.Time `validate:"required"`
}

PreapplyBlockOperationInput is the input for the goTezos.PreapplyBlockOperation function.

Function:

func (t *GoTezos) PreapplyBlockOperation(input PreapplyBlockOperationInput) ([]interface{}, error) {}

type PreapplyOperationsInput

type PreapplyOperationsInput struct {
	Blockhash string     `validate:"required"`
	Protocol  string     `validate:"required"`
	Signature string     `validate:"required"`
	Contents  []Contents `validate:"required"`
}

PreapplyOperationsInput is the input for the PreapplyOperations.

Function:

func PreapplyOperations(input PreapplyOperationsInput) ([]byte, error) {}

type PreapplyResult

type PreapplyResult struct {
	Shellheader ShellHeader       `json:"shell_header"`
	Operations  []ShellOperations `json:"operations"`
}

type Proposals

type Proposals []struct {
	Hash       string
	Supporters int
}

Proposals represents a list of proposals with number of supporters.

Path:

../<block_id>/votes/proposals (GET)

Link:

https://tezos.gitlab.io/api/rpc.html#get-block-id-votes-proposals

func (*Proposals) UnmarshalJSON

func (p *Proposals) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Marshaler interface for Proposals

Parameters:

b:
	The byte representation of a Proposals.

type ProtocolData

type ProtocolData struct {
	Protocol      string `json:"protocol"`
	Priority      int    `json:"priority"`
	POWNonce      string `json:"proof_of_work_nonce"`
	Signature     string `json:"signature"`
	SeedNonceHash string `json:"seed_nonce_hash,omitempty"`
}

ProtocolData is information required in any newly forged Blocks

type RPCError

type RPCError struct {
	Kind string `json:"kind"`
	Err  string `json:"error"`
}

RPCError represents and RPC error

func (*RPCError) Error

func (r *RPCError) Error() string

type RPCErrors

type RPCErrors []RPCError

RPCErrors represents multiple RPCError(s).s

type ShellHeader

type ShellHeader struct {
	Level          int       `json:"level"`
	Proto          int       `json:"proto"`
	Predecessor    string    `json:"predecessor"`
	Timestamp      time.Time `json:"timestamp"`
	ValidationPass int       `json:"validation_pass"`
	OperationsHash string    `json:"operations_hash"`
	Fitness        []string  `json:"fitness"`
	Context        string    `json:"context"`
	ProtocolData   string    `json:"protocol_data"`
}

PreapplyBlock returns a succesful baked block

Path:

/chains/<chain_id>/blocks/head/helpers/preapply/block

Parameters:

sort:
    Sorts the resulting operations
timestamp:
    ??

type ShellOperations

type ShellOperations struct {
	Applied       []PreApplyOperations    `json:"applied"`
	Refused       []PreApplyOperationsAlt `json:"refused"`
	BranchRefused []PreApplyOperationsAlt `json:"branch_refused"`
	BranchDelayed []PreApplyOperationsAlt `json:"branch_delayed"`
	Unprocessed   []PreApplyOperationsAlt `json:"unprocessed"`
}

type SignOperationOutput

type SignOperationOutput struct {
	SignedOperation string
	Signature       string
	EDSig           string
}

SignOperationOutput contains an operation with the signature appended, and the signature

type TestChainStatus

type TestChainStatus struct {
	Status string `json:"status"`
}

TestChainStatus represents the testchainstatus in a Tezos block

RPC:

/chains/<chain_id>/blocks/<block_id> (<dyn>)

Link:

https://tezos.gitlab.io/api/rpc.html#get-block-id-context-contracts-contract-id-balance

type UnforgeOperationWithRPCInput

type UnforgeOperationWithRPCInput struct {
	Operations     []UnforgeOperationWithRPCOperation `json:"operations" validate:"required"`
	CheckSignature bool                               `json:"check_signature"`
}

UnforgeOperationWithRPCInput is the input for the goTezos.UnforgeOperationWithRPC function.

Function:

func (t *GoTezos) UnforgeOperationWithRPC(blockhash string, operation string, checkSignature bool) (Operations, error) {}

type UnforgeOperationWithRPCOperation

type UnforgeOperationWithRPCOperation struct {
	Data   string `json:"data" validate:"required"`
	Branch string `json:"branch" validate:"required"`
}

UnforgeOperationWithRPCOperation -

type UserActivatedProtocolOverrides

type UserActivatedProtocolOverrides struct {
	ReplacedProtocol    string `json:"replaced_protocol"`
	ReplacementProtocol string `json:"replacement_protocol"`
}

UserActivatedProtocolOverrides represents user activated protocl overrides on the Tezos network.

RPC:

/config/network/user_activated_protocol_overrides (GET)

Link:

https://tezos.gitlab.io/api/rpc.html#get-config-network-user-activated-protocol-overrides

type Version

type Version struct {
	ChainName            string `json:"chain_name"`
	DistributedDbVersion int    `json:"distributed_db_version"`
	P2PVersion           int    `json:"p2p_version"`
}

Version represents the Version RPC.

RPC:

/network/version (GET)

Link:

https://tezos.gitlab.io/api/rpc.html#get-network-version

type Wallet

type Wallet struct {
	Address  string
	Mnemonic string
	Seed     []byte
	Kp       keyPair
	Sk       string
	Pk       string
}

Wallet is a Tezos wallet.

func CreateWallet

func CreateWallet(mnenomic string, password string) (*Wallet, error)

CreateWallet creates a new wallet.

Parameters:

mnenomic:
	The seed phrase for the new wallet.

password:
	The password for the wallet.

func ImportEncryptedWallet

func ImportEncryptedWallet(password, esk string) (*Wallet, error)

ImportEncryptedWallet imports an encrypted wallet.

Parameters:

password:
	The password for the wallet.

esk:
	The encrypted secret key of the wallet (encrypted:edesk).

func ImportWallet

func ImportWallet(hash, pk, sk string) (*Wallet, error)

ImportWallet imports an unencrypted wallet.

Parameters:

hash:
	The public key hash of the wallet (tz1, KT1).

pk:
	The public key of the wallet (edpk).

sk:
	The secret key of the wallet (edsk).

func (*Wallet) SignBlock

func (w *Wallet) SignBlock(operation, chainID string) (SignOperationOutput, error)

func (*Wallet) SignEndorsementOperation

func (w *Wallet) SignEndorsementOperation(operation, chainID string) (SignOperationOutput, error)

func (*Wallet) SignOperation

func (w *Wallet) SignOperation(operation string) (SignOperationOutput, error)

SignOperation will return an operation string signed by wallet

Jump to

Keyboard shortcuts

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