Documentation ¶
Overview ¶
Package blob provides types and functions for working with blobs, blob transactions, and index wrapper transactions.
Index ¶
- Constants
- Variables
- func MarshalBlobTx(tx []byte, blobs ...*Blob) ([]byte, error)
- func MarshalIndexWrapper(tx []byte, shareIndexes ...uint32) ([]byte, error)
- func Sort(blobs []*Blob)
- type Blob
- func (*Blob) Descriptor() ([]byte, []int)deprecated
- func (x *Blob) GetData() []byte
- func (x *Blob) GetNamespaceId() []byte
- func (x *Blob) GetNamespaceVersion() uint32
- func (x *Blob) GetShareVersion() uint32
- func (b *Blob) Namespace() namespace.Namespace
- func (*Blob) ProtoMessage()
- func (x *Blob) ProtoReflect() protoreflect.Message
- func (x *Blob) Reset()
- func (x *Blob) String() string
- func (b *Blob) Validate() error
- type BlobTx
- type IndexWrapper
- func (*IndexWrapper) Descriptor() ([]byte, []int)deprecated
- func (x *IndexWrapper) GetShareIndexes() []uint32
- func (x *IndexWrapper) GetTx() []byte
- func (x *IndexWrapper) GetTypeId() string
- func (*IndexWrapper) ProtoMessage()
- func (x *IndexWrapper) ProtoReflect() protoreflect.Message
- func (x *IndexWrapper) Reset()
- func (x *IndexWrapper) String() string
Constants ¶
MaxShareVersion is the maximum value a share version can be. See: [shares.MaxShareVersion].
const ProtoBlobTxTypeID = "BLOB"
ProtoBlobTxTypeID is included in each encoded BlobTx to help prevent decoding binaries that are not actually BlobTxs.
const ProtoIndexWrapperTypeID = "INDX"
ProtoIndexWrapperTypeID is included in each encoded IndexWrapper to help prevent decoding binaries that are not actually IndexWrappers.
Variables ¶
var File_blob_blob_proto protoreflect.FileDescriptor
var SupportedBlobNamespaceVersions = []uint8{namespace.NamespaceVersionZero}
SupportedBlobNamespaceVersions is a list of namespace versions that can be specified by a user for blobs.
Functions ¶
func MarshalBlobTx ¶
MarshalBlobTx creates a BlobTx using a normal transaction and some number of blobs.
NOTE: Any checks on the blobs or the transaction must be performed in the application
func MarshalIndexWrapper ¶
MarshalIndexWrapper creates a wrapped Tx that includes the original transaction and the share index of the start of its blob.
NOTE: must be unwrapped to be a viable sdk.Tx
Types ¶
type Blob ¶
type Blob struct { NamespaceId []byte `protobuf:"bytes,1,opt,name=namespace_id,json=namespaceId,proto3" json:"namespace_id,omitempty"` Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` NamespaceVersion uint32 `protobuf:"varint,4,opt,name=namespace_version,json=namespaceVersion,proto3" json:"namespace_version,omitempty"` // contains filtered or unexported fields }
Blob (named after binary large object) is a chunk of data submitted by a user to be published to the Celestia blockchain. The data of a Blob is published to a namespace and is encoded into shares based on the format specified by share_version.
func New ¶
New creates a new coretypes.Blob from the provided data after performing basic stateless checks over it.
func (*Blob) Descriptor
deprecated
func (*Blob) GetNamespaceId ¶
func (*Blob) GetNamespaceVersion ¶
func (*Blob) GetShareVersion ¶
func (*Blob) ProtoMessage ¶
func (*Blob) ProtoMessage()
func (*Blob) ProtoReflect ¶
func (x *Blob) ProtoReflect() protoreflect.Message
type BlobTx ¶
type BlobTx struct { Tx []byte `protobuf:"bytes,1,opt,name=tx,proto3" json:"tx,omitempty"` Blobs []*Blob `protobuf:"bytes,2,rep,name=blobs,proto3" json:"blobs,omitempty"` TypeId string `protobuf:"bytes,3,opt,name=type_id,json=typeId,proto3" json:"type_id,omitempty"` // contains filtered or unexported fields }
BlobTx wraps an encoded sdk.Tx with a second field to contain blobs of data. The raw bytes of the blobs are not signed over, instead we verify each blob using the relevant MsgPayForBlobs that is signed over in the encoded sdk.Tx.
func UnmarshalBlobTx ¶
UnmarshalBlobTx attempts to unmarshal a transaction into blob transaction. If an error is thrown, false is returned.
func (*BlobTx) Descriptor
deprecated
func (*BlobTx) ProtoMessage ¶
func (*BlobTx) ProtoMessage()
func (*BlobTx) ProtoReflect ¶
func (x *BlobTx) ProtoReflect() protoreflect.Message
type IndexWrapper ¶
type IndexWrapper struct { Tx []byte `protobuf:"bytes,1,opt,name=tx,proto3" json:"tx,omitempty"` TypeId string `protobuf:"bytes,3,opt,name=type_id,json=typeId,proto3" json:"type_id,omitempty"` // contains filtered or unexported fields }
IndexWrapper adds index metadata to a transaction. This is used to track transactions that pay for blobs, and where the blobs start in the square.
func UnmarshalIndexWrapper ¶
func UnmarshalIndexWrapper(tx []byte) (*IndexWrapper, bool)
UnmarshalIndexWrapper attempts to unmarshal the provided transaction into an IndexWrapper transaction. It returns true if the provided transaction is an IndexWrapper transaction. An IndexWrapper transaction is a transaction that contains a MsgPayForBlob that has been wrapped with a share index.
NOTE: protobuf sometimes does not throw an error if the transaction passed is not a IndexWrapper, since the protobuf definition for MsgPayForBlob is kept in the app, we cannot perform further checks without creating an import cycle.
func (*IndexWrapper) Descriptor
deprecated
func (*IndexWrapper) Descriptor() ([]byte, []int)
Deprecated: Use IndexWrapper.ProtoReflect.Descriptor instead.
func (*IndexWrapper) GetShareIndexes ¶
func (x *IndexWrapper) GetShareIndexes() []uint32
func (*IndexWrapper) GetTx ¶
func (x *IndexWrapper) GetTx() []byte
func (*IndexWrapper) GetTypeId ¶
func (x *IndexWrapper) GetTypeId() string
func (*IndexWrapper) ProtoMessage ¶
func (*IndexWrapper) ProtoMessage()
func (*IndexWrapper) ProtoReflect ¶
func (x *IndexWrapper) ProtoReflect() protoreflect.Message
func (*IndexWrapper) Reset ¶
func (x *IndexWrapper) Reset()
func (*IndexWrapper) String ¶
func (x *IndexWrapper) String() string