blob

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: May 16, 2024 License: Apache-2.0 Imports: 11 Imported by: 5

Documentation

Index

Constants

View Source
const (
	// NMTIgnoreMaxNamespace is currently used value for IgnoreMaxNamespace option in NMT.
	// IgnoreMaxNamespace defines whether the largest possible Namespace MAX_NID should be 'ignored'.
	// If set to true, this allows for shorter proofs in particular use-cases.
	NMTIgnoreMaxNamespace = true
)

Variables

View Source
var (
	ErrBlobNotFound = errors.New("blob: not found")
	ErrInvalidProof = errors.New("blob: invalid proof")
)

Functions

func DefaultGasPrice

func DefaultGasPrice() float64

DefaultGasPrice returns the default gas price, letting node automatically determine the Fee based on the passed blob sizes.

Types

type API

type API struct {
	// Submit sends Blobs and reports the height in which they were included.
	// Allows sending multiple Blobs atomically synchronously.
	// Uses default wallet registered on the Node.
	Submit func(context.Context, []*Blob, float64) (uint64, error) `perm:"write"`
	// Get retrieves the blob by commitment under the given namespace and height.
	Get func(context.Context, uint64, share.Namespace, Commitment) (*Blob, error) `perm:"read"`
	// GetAll returns all blobs at the given height under the given namespaces.
	GetAll func(context.Context, uint64, []share.Namespace) ([]*Blob, error) `perm:"read"`
	// GetProof retrieves proofs in the given namespaces at the given height by commitment.
	GetProof func(context.Context, uint64, share.Namespace, Commitment) (*Proof, error) `perm:"read"`
	// Included checks whether a blob's given commitment(Merkle subtree root) is included at
	// given height and under the namespace.
	Included func(context.Context, uint64, share.Namespace, *Proof, Commitment) (bool, error) `perm:"read"`
}

type Blob

type Blob struct {
	blob.Blob `json:"blob"`

	Commitment Commitment `json:"commitment"`
	// contains filtered or unexported fields
}

Blob represents any application-specific binary data that anyone can submit to Celestia.

func NewBlob

func NewBlob(shareVersion uint8, namespace share.Namespace, data []byte) (*Blob, error)

NewBlob constructs a new blob from the provided Namespace, data and share version.

func NewBlobV0

func NewBlobV0(namespace share.Namespace, data []byte) (*Blob, error)

NewBlobV0 constructs a new blob from the provided Namespace and data. The blob will be formatted as v0 shares.

func (*Blob) MarshalJSON

func (b *Blob) MarshalJSON() ([]byte, error)

func (*Blob) UnmarshalJSON

func (b *Blob) UnmarshalJSON(data []byte) error

type Commitment

type Commitment []byte

Commitment is a Merkle Root of the subtree built from shares of the Blob. It is computed by splitting the blob into shares and building the Merkle subtree to be included after Submit.

func (Commitment) Equal

func (com Commitment) Equal(c Commitment) bool

Equal ensures that commitments are the same

func (Commitment) String

func (com Commitment) String() string

type Proof

type Proof []*nmt.Proof

Proof is a collection of nmt.Proofs that verifies the inclusion of the data. Proof proves the WHOLE namespaced data for the particular row. TODO (@vgonkivs): rework `Proof` in order to prove a particular blob. https://github.com/celestiaorg/celestia-node/issues/2303

func (Proof) Len

func (p Proof) Len() int

Jump to

Keyboard shortcuts

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