Categorygithub.com/ecadlabs/go-tezos
modulepackage
0.0.0-20200223205028-5c5678907b1d
Repository: https://github.com/ecadlabs/go-tezos.git
Documentation: pkg.go.dev

# README

go-tezos

go-tezos is a Go client library that is used to interact with a Tezos' nodes RPC methods.

CII Best Practices GitHub Actions Maintainability Test Coverage

Work in progress, contributions welcome.

This client RPC library is in development and should be considered alpha. Contributors are welcome. We will start to tag releases of this library in November 2018.

The library will be useful to anyone wanting to build tools, products or services on top of the Tezos RPC API in go.

The library will be:

  • Well tested
  • Nightly Integration tests against official Tezos docker images
  • Written in Idiomatic Go
  • Aim to have complete coverage of the Tezos API and stay up to date with new RPCs or changes to existing RPCs

Documentation

Library documentation lives in the code as godoc comments. Readers can view up-to-date documentation here: https://godoc.org/github.com/ecadlabs/go-tezos

Contributions

Reporting issues/feature requests

Please use the GitHub issue tracker to report bugs or request features.

Contribution

To contribute, please check the issue tracker to see if an existing issue exists for your planned contribution. If there's no Issue, please create one first, and then submit a pull request with your contribution.

For a contribution to be merged, it must be well documented, come with unit tests, and integration tests where appropriate. Submitting a "Work in progress" pull request is welcome!

Reporting Security Issues

If a security vulnerabiltiy in this project is discovered, please report the issue to [email protected] or to jevonearth on keybase.io

Reports may be encrypted using keys published on keybase.io

Tezos RPC API documentation

The best known RPC API docs are available here: http://tezos.gitlab.io/mainnet/

Users of go-tezos

Development

Running a tezos RPC node using docker-compose

To run a local tezos RPC node using docker, run the following command:

docker-compose up

The node will generate an identity and then, it will the chain from other nodes on the network. The process of synchronizing or downloading the chain can take some time, but most of the RPC will work while this process completes.

The alphanet image tag means you are not interacting with the live mainnet. You can connect to mainnet with the tezos/tezos:mainnet image, but it takes longer to sync.

The docker-compose.yml file uses volumes, so when you restart the node, it won't have to regenerate an identity, or sync the entire chain.

Running a tezos RPC node using docker

If you want to run a tezos node quickly, without using docker-compose try:

docker run -it --rm --name tezos_node -p 8732:8732 tezos/tezos:alphanet tezos-node

Interacting with tezos RPC

With the tezos-node docker image, you can test that the RPC interface is working:

curl localhost:8732/network/stat

The tezos-client cli is available in the docker image, and can be run as follows:

docker exec -it tezos_node tezos-client -A 0.0.0.0 man

docker exec -it tezos_node tezos-client -A 0.0.0.0 rpc list

Create a shell alias that you can run from your docker host for convenience;

alias tezos-client='sudo docker exec -it -e TEZOS_CLIENT_UNSAFE_DISABLE_DISCLAIMER=Y tezos_node tezos-client -A 0.0.0.0'

# Functions

NewRPCClient returns a new Tezos RPC client.

# Constants

ErrorKindBranch Tezos RPC error kind.
ErrorKindPermanent Tezos RPC error kind.
ErrorKindTemporary Tezos RPC error kind.

# Structs

ActivateAccountOperationElem represents activate_account operation.
BalanceUpdatesOperationMetadata contains balance updates only.
Ballot holds information about a Tezos ballot.
BallotListing holds information about a Tezos delegate and his voting weight in rolls.
BallotOperationElem represents a ballot operation.
Ballots holds summary data about a voting period.
BigInt overrides UnmarshalJSON for big.Int.
Block holds information about a Tezos block.
BlockHeaderMetadata is a part of the Tezos block data.
BlockHeaderMetadataLevel is a part of BlockHeaderMetadata.
BlockInfo holds information about block returned by monitor heads endpoint.
BootstrappedBlock represents bootstrapped block stream message.
ContractBalanceUpdate is a BalanceUpdatesType variant for Kind=contract.
DelegationOperationElem represents a delegation operation.
DelegationOperationMetadata represents a delegation operation metadata.
DelegationOperationResult represents a delegation operation result.
DoubleBakingEvidenceOperationElem represents double_baking_evidence operation.
DoubleEndorsementEvidenceOperationElem represents double_endorsement_evidence operation.
EndorsementOperationElem represents an endorsement operation.
EndorsementOperationMetadata represents an endorsement operation metadata.
ForkingTestChainStatus is a TestChainStatus variant for Status=forking.
FreezerBalanceUpdate is a BalanceUpdatesType variant for Kind=freezer.
GenericBalanceUpdate holds the common values among all BalanceUpdatesType variants.
GenericError is a basic error type.
GenericOperationElem is a most generic element type.
GenericTestChainStatus holds the common values among all TestChainStatus variants.
IDTimestamp represents peer id with timestamp.
InlinedEndorsement corresponds to $inlined.endorsement.
InlinedEndorsementContents corresponds to $inlined.endorsement.contents.
InvalidBlock represents invalid block hash along with the errors that led to it being declared invalid.
MaxOperationListLength is a part of the BlockHeaderMetadata.
MempoolOperations represents mempool operations.
NetworkAddress models a point's address and port.
NetworkConnection models detailed information for one network connection.
NetworkConnectionTimestamp represents peer address with timestamp added.
NetworkMetadata models metadata of a node.
NetworkPeer represents peer info.
NetworkPeerLogEntry represents peer log entry.
NetworkPoint represents network point info.
NetworkPointLogEntry represents point's log entry.
NetworkPointState represents point state.
NetworkStats models global network bandwidth totals and usage in B/s.
NetworkVersion models a network-layer version of a node.
NotRunningTestChainStatus is a TestChainStatus variant for Status=not_running.
Operation represents an operation included into block.
OperationWithError represents unsuccessful operation.
OriginationOperationElem represents a origination operation.
OriginationOperationMetadata represents a origination operation metadata.
OriginationOperationResult represents a origination operation result.
Proposal holds summary data about a proposal and his number of supporter.
ProposalOperationElem represents a proposal operation.
RawBlockHeader is a part of the Tezos block data.
RevealOperationElem represents a reveal operation.
RPCClient manages communication with a Tezos RPC server.
RunningTestChainStatus is a TestChainStatus variant for Status=running.
ScriptedContracts corresponds to $scripted.contracts.
SeedNonceRevelationOperationElem represents seed_nonce_revelation operation.
Service implements fetching of information from Tezos nodes via JSON.
TransactionOperationElem represents a transaction operation.
TransactionOperationMetadata represents a transaction operation metadata.
TransactionOperationResult represents a transaction operation result.

# Interfaces

BalanceUpdate is a variable structure depending on the Kind field.
BalanceUpdatesOperation is implemented by operations providing balance updates.
Error is a Tezos error as documented on http://tezos.gitlab.io/mainnet/api/errors.html.
HTTPError retains HTTP status.
HTTPStatus interface represents an unprocessed HTTP reply.
Logger is an extension to logrus.FieldLogger.
OperationElem must be implemented by all operation elements.
OperationWithFee is implemented by operations with fees.
RPCError is a Tezos RPC error as documented on http://tezos.gitlab.io/mainnet/api/errors.html.
TestChainStatus is a variable structure depending on the Status field.

# Type aliases

BalanceUpdates is a list of balance update operations.
Errors is a slice of Error with custom JSON unmarshaller.
HexBytes represents bytes as a JSON string of hexadecimal digits.
OperationAlt is a heterogeneously encoded Operation with hash as a first array member, i.e.
OperationElements is a slice of OperationElem with custom JSON unmarshaller.
OperationWithErrorAlt is a heterogeneously encoded OperationWithError with hash as a first array member.
PeriodKind contains information about tezos voting period kind.
RevealOperationMetadata represents a reveal operation metadata.