blob

package
v1.0.0-rc64 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const ProtoBlobTxTypeID = "BLOB"

ProtoBlobTxTypeID is included in each encoded BlobTx to help prevent decoding binaries that are not actually BlobTxs.

Variables

View Source
var (
	ErrInvalidLengthBlob        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowBlob          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupBlob = fmt.Errorf("proto: unexpected end of group")
)

Functions

func MarshalBlobTx

func MarshalBlobTx(tx []byte, blobs ...*Blob) ([]byte, error)

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 Sort

func Sort(blobs []*Blob)

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"`
	ShareVersion     uint32 `protobuf:"varint,3,opt,name=share_version,json=shareVersion,proto3" json:"share_version,omitempty"`
	NamespaceVersion uint32 `protobuf:"varint,4,opt,name=namespace_version,json=namespaceVersion,proto3" json:"namespace_version,omitempty"`
}

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

func New(ns namespace.Namespace, blob []byte, shareVersion uint8) *Blob

NewBlob creates a new coretypes.Blob from the provided data after performing basic stateless checks over it.

func (*Blob) Descriptor

func (*Blob) Descriptor() ([]byte, []int)

func (*Blob) GetData

func (m *Blob) GetData() []byte

func (*Blob) GetNamespaceId

func (m *Blob) GetNamespaceId() []byte

func (*Blob) GetNamespaceVersion

func (m *Blob) GetNamespaceVersion() uint32

func (*Blob) GetShareVersion

func (m *Blob) GetShareVersion() uint32

func (*Blob) Marshal

func (m *Blob) Marshal() (dAtA []byte, err error)

func (*Blob) MarshalTo

func (m *Blob) MarshalTo(dAtA []byte) (int, error)

func (*Blob) MarshalToSizedBuffer

func (m *Blob) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (Blob) Namespace

func (b Blob) Namespace() namespace.Namespace

Namespace returns the namespace of the blob

func (*Blob) ProtoMessage

func (*Blob) ProtoMessage()

func (*Blob) Reset

func (m *Blob) Reset()

func (*Blob) Size

func (m *Blob) Size() (n int)

func (*Blob) String

func (m *Blob) String() string

func (*Blob) Unmarshal

func (m *Blob) Unmarshal(dAtA []byte) error

func (*Blob) Validate

func (b *Blob) Validate() error

Validate runs a stateless validity check on the form of the struct.

func (*Blob) XXX_DiscardUnknown

func (m *Blob) XXX_DiscardUnknown()

func (*Blob) XXX_Marshal

func (m *Blob) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Blob) XXX_Merge

func (m *Blob) XXX_Merge(src proto.Message)

func (*Blob) XXX_Size

func (m *Blob) XXX_Size() int

func (*Blob) XXX_Unmarshal

func (m *Blob) XXX_Unmarshal(b []byte) error

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"`
}

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

func UnmarshalBlobTx(tx []byte) (bTx BlobTx, isBlob bool)

UnmarshalBlobTx attempts to unmarshal a transaction into blob transaction. If an error is thrown, false is returned.

func (*BlobTx) Descriptor

func (*BlobTx) Descriptor() ([]byte, []int)

func (*BlobTx) GetBlobs

func (m *BlobTx) GetBlobs() []*Blob

func (*BlobTx) GetTx

func (m *BlobTx) GetTx() []byte

func (*BlobTx) GetTypeId

func (m *BlobTx) GetTypeId() string

func (*BlobTx) Marshal

func (m *BlobTx) Marshal() (dAtA []byte, err error)

func (*BlobTx) MarshalTo

func (m *BlobTx) MarshalTo(dAtA []byte) (int, error)

func (*BlobTx) MarshalToSizedBuffer

func (m *BlobTx) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*BlobTx) ProtoMessage

func (*BlobTx) ProtoMessage()

func (*BlobTx) Reset

func (m *BlobTx) Reset()

func (*BlobTx) Size

func (m *BlobTx) Size() (n int)

func (*BlobTx) String

func (m *BlobTx) String() string

func (*BlobTx) Unmarshal

func (m *BlobTx) Unmarshal(dAtA []byte) error

func (*BlobTx) XXX_DiscardUnknown

func (m *BlobTx) XXX_DiscardUnknown()

func (*BlobTx) XXX_Marshal

func (m *BlobTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*BlobTx) XXX_Merge

func (m *BlobTx) XXX_Merge(src proto.Message)

func (*BlobTx) XXX_Size

func (m *BlobTx) XXX_Size() int

func (*BlobTx) XXX_Unmarshal

func (m *BlobTx) XXX_Unmarshal(b []byte) error

Jump to

Keyboard shortcuts

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