Documentation ¶
Index ¶
- Variables
- func BlobsToShares(blobs ...*Blob) ([]share.Share, error)
- type Blob
- type Commitment
- type GasPrice
- type Proof
- type Service
- func (s *Service) Get(ctx context.Context, height uint64, namespace share.Namespace, ...) (blob *Blob, err error)
- func (s *Service) GetAll(ctx context.Context, height uint64, namespaces []share.Namespace) ([]*Blob, error)
- func (s *Service) GetProof(ctx context.Context, height uint64, namespace share.Namespace, ...) (proof *Proof, err error)
- func (s *Service) Included(ctx context.Context, height uint64, namespace share.Namespace, proof *Proof, ...) (_ bool, err error)
- func (s *Service) Submit(ctx context.Context, blobs []*Blob, gasPrice GasPrice) (uint64, error)
- type SubmitOptions
- type Submitter
Constants ¶
This section is empty.
Variables ¶
var ( ErrBlobNotFound = errors.New("blob: not found") ErrInvalidProof = errors.New("blob: invalid proof") )
Functions ¶
Types ¶
type Blob ¶
type Blob struct { types.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 NewBlobV0 ¶
NewBlobV0 constructs a new blob from the provided Namespace and data. The blob will be formatted as v0 shares.
func (*Blob) Index ¶ added in v0.13.1
Index returns the blob's first share index in the EDS. Only retrieved, on-chain blobs will have the index set. Default is -1.
func (*Blob) MarshalJSON ¶
func (*Blob) UnmarshalJSON ¶
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 GasPrice ¶ added in v0.13.0
type GasPrice float64
GasPrice represents the amount to be paid per gas unit. Fee is set by multiplying GasPrice by GasLimit, which is determined by the blob sizes.
func DefaultGasPrice ¶ added in v0.13.0
func DefaultGasPrice() GasPrice
DefaultGasPrice returns the default gas price, letting node automatically determine the Fee based on the passed blob sizes.
type Proof ¶
The Proof is a set of nmt proofs that can be verified only through the included method (due to limitation of the nmt https://github.com/celestiaorg/nmt/issues/218). Proof proves the WHOLE namespaced data to the row roots. TODO (@vgonkivs): rework `Proof` in order to prove a particular blob. https://github.com/celestiaorg/celestia-node/issues/2303
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func (*Service) Get ¶
func (s *Service) Get( ctx context.Context, height uint64, namespace share.Namespace, commitment Commitment, ) (blob *Blob, err error)
Get retrieves all the blobs for given namespaces at the given height by commitment. Get collects all namespaced data from the EDS, constructs blobs and compares commitments. `ErrBlobNotFound` can be returned in case blob was not found.
func (*Service) GetAll ¶
func (s *Service) GetAll(ctx context.Context, height uint64, namespaces []share.Namespace) ([]*Blob, error)
GetAll returns all blobs under the given namespaces at the given height. GetAll can return blobs and an error in case if some requests failed.
func (*Service) GetProof ¶
func (s *Service) GetProof( ctx context.Context, height uint64, namespace share.Namespace, commitment Commitment, ) (proof *Proof, err error)
GetProof retrieves all blobs in the given namespaces at the given height by commitment and returns their Proof. It collects all namespaced data from the EDS, constructs blobs and compares commitments.
func (*Service) Included ¶
func (s *Service) Included( ctx context.Context, height uint64, namespace share.Namespace, proof *Proof, commitment Commitment, ) (_ bool, err error)
Included verifies that the blob was included in a specific height. To ensure that blob was included in a specific height, we need: 1. verify the provided commitment by recomputing it; 2. verify the provided Proof against subtree roots that were used in 1.;
type SubmitOptions ¶
SubmitOptions contains the information about fee and gasLimit price in order to configure the Submit request.
func DefaultSubmitOptions ¶
func DefaultSubmitOptions() *SubmitOptions
DefaultSubmitOptions creates a default fee and gas price values.
type Submitter ¶
type Submitter interface {
SubmitPayForBlob(ctx context.Context, fee sdkmath.Int, gasLim uint64, blobs []*Blob) (*types.TxResponse, error)
}
Submitter is an interface that allows submitting blobs to the celestia-core. It is used to avoid a circular dependency between the blob and the state package, since the state package needs the blob.Blob type for this signature.