covalent

package module
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2023 License: Apache-2.0 Imports: 4 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

covalent-indexer-go

Covalent indexer acts as an extra proxy layer over Multiversx' Proxy by providing avro encoded hyper blocks.

How it works

  1. Covalent proxy hyperBlock request is triggered(e.g.: http://127.0.0.1:7952/hyperblock/by-nonce/37).
  2. Covalent proxy will interrogate the backing Multiversx proxy via REST API to fetch requested hyperBlock using query parameters defined in the config(cmd/proxy/config.toml).
  3. Received data from Multiversx proxy will be converted to defined avro schema (schema/block.multiversx.avsc)
  4. Covalent proxy response will have the following format (compatible with Multiversx proxy API responses):
{
   "data": {},
   "error": "",
   "code": "successful"
}

Data field contains a byte array corresponding to the encoded avro schema.

How to use

  1. Go to cmd/proxy
  2. Build go build
  3. Run ./proxy

In cmd/proxy/config.toml one can find:

  1. Multiversx & Covalent proxy configuration(e.g. port, multiversxProxyUrl, etc.)
  2. hyperBlockQueryOptions used to format hyperblock queries for Multiversx proxy. E.g.: following Covalent request: localhost:port/hyperblock/by-nonce/4, having withAlteredAccounts = true and tokens = all will trigger the following request : multiversxProxy:port/hyperblock/by-nonce/4?withAlteredAccounts=true&tokens=all

Please note that altered-accounts endpoints will only work if the backing observers of the Multiversx Proxy have support for historical balances (--operation-mode historical-balances when starting the node)

Endpoints

  • /hyperblock/by-nonce/:nonce (GET) --> returns a hyperblock by nonce, with transactions included
  • /hyperblock/by-hash/:hash (GET) --> returns a hyperblock by hash, with transactions included
  • /hyperblocks?startNonce=4&endNonce=8 (GET) --> returns an array of encoded hyperblocks in [startNonce, endNonce] interval

Avro schema update

In case you want to modify the existing avro schema, after finishing your changes, you need to re-generate the corresponding code, by:

  • Running go generate from schema/codegen.go

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrBlockBodyAssertion = errors.New("error asserting BodyHandler interface of type block body")

ErrBlockBodyAssertion signals that an error occurred when trying to assert BodyHandler interface of type block body

View Source
var ErrCannotCastAccountHandlerToUserAccount = errors.New("cannot cast AccountHandler to UserAccountHandler")

ErrCannotCastAccountHandlerToUserAccount signals an error when trying to cast from AccountHandler to UserAccountHandler

View Source
var ErrNilAccountsAdapter = errors.New("received nil input value: accounts adapter")

ErrNilAccountsAdapter signals that an accounts adapter input parameter is nil

View Source
var ErrNilHasher = errors.New("received nil input value: hasher")

ErrNilHasher signals that a nil hasher has been provided

View Source
var ErrNilMarshaller = errors.New("received nil input value: marshaller")

ErrNilMarshaller signals that a nil marshaller has been provided

View Source
var ErrNilMiniBlockHandler = errors.New("received nil input value: mini block handler")

ErrNilMiniBlockHandler signals that a nil mini block handler has been provided

View Source
var ErrNilPubKeyConverter = errors.New("received nil input value: pub key converter")

ErrNilPubKeyConverter signals that a pub key converter input parameter is nil

View Source
var ErrNilShardCoordinator = errors.New("received nil input value: shard coordinator")

ErrNilShardCoordinator signals that a shard coordinator input parameter is nil

Functions

This section is empty.

Types

type AvroMarshaller

type AvroMarshaller interface {
	Encode(record avro.AvroRecord) ([]byte, error)
	Decode(record avro.AvroRecord, buffer []byte) error
}

AvroMarshaller defines what an avro marshaller should do

type HyperBlockProcessor

type HyperBlockProcessor interface {
	Process(hyperBlock *hyperBlock.HyperBlock) (*schema.HyperBlock, error)
}

HyperBlockProcessor shall handle hyper block processing into avro schema blocks

Jump to

Keyboard shortcuts

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