fibre

package
v0.34.0-corto Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConstructModule

func ConstructModule(coreCfg *core.Config) fx.Option

Types

type API

type API struct {
	Internal struct {
		Submit func(
			context.Context,
			libshare.Namespace,
			[]byte,
			*txclient.TxConfig,
		) (*SubmitResult, error) `perm:"write"`
		Upload func(
			ctx context.Context,
			ns libshare.Namespace,
			data []byte,
			config *txclient.TxConfig,
		) (*UploadResult, error) `perm:"write"`
		Download func(
			ctx context.Context,
			blobID appfibre.BlobID,
		) (*GetBlobResult, error) `perm:"read"`
		QueryEscrowAccount func(
			ctx context.Context,
			signer string,
		) (*fibre.EscrowAccount, error) `perm:"read"`
		Deposit func(
			ctx context.Context,
			amount sdktypes.Coin,
			cfg *txclient.TxConfig,
		) error `perm:"write"`
		Withdraw func(
			ctx context.Context,
			amount sdktypes.Coin,
			cfg *txclient.TxConfig,
		) error `perm:"write"`
		PendingWithdrawals func(
			ctx context.Context,
			signer string,
		) ([]fibre.PendingWithdrawal, error) `perm:"read"`
	}
}

API is a wrapper around Module for the RPC.

func (*API) Deposit

func (api *API) Deposit(ctx context.Context, amount sdktypes.Coin, cfg *txclient.TxConfig) error

func (*API) Download

func (api *API) Download(ctx context.Context, blobID appfibre.BlobID) (*GetBlobResult, error)

func (*API) PendingWithdrawals

func (api *API) PendingWithdrawals(ctx context.Context, signer string) ([]fibre.PendingWithdrawal, error)

func (*API) QueryEscrowAccount

func (api *API) QueryEscrowAccount(ctx context.Context, signer string) (*fibre.EscrowAccount, error)

func (*API) Submit

func (api *API) Submit(
	ctx context.Context,
	ns libshare.Namespace,
	data []byte,
	options *txclient.TxConfig,
) (*SubmitResult, error)

func (*API) Upload

func (api *API) Upload(
	ctx context.Context,
	ns libshare.Namespace,
	data []byte,
	options *txclient.TxConfig,
) (*UploadResult, error)

func (*API) Withdraw

func (api *API) Withdraw(ctx context.Context, amount sdktypes.Coin, cfg *txclient.TxConfig) error

type GetBlobResult

type GetBlobResult struct {
	Data []byte `json:"data"`
}

GetBlobResult holds a blob reconstructed from FSPs.

type Module

type Module interface {
	// Submit runs the full flow: upload to FSPs, aggregate validator signatures,
	// and settle MsgPayForFibre on-chain. Requires a Fibre-capable core endpoint.
	Submit(context.Context, libshare.Namespace, []byte, *txclient.TxConfig) (*SubmitResult, error)
	// Upload does the off-chain half (encode, promise, upload, aggregate
	// signatures) and then sumbits MsgPayForFibre on-chain
	// asynchronously in the background. Use Submit for the full flow.
	Upload(context.Context, libshare.Namespace, []byte, *txclient.TxConfig) (*UploadResult, error)
	// Download reconstructs a blob from FSPs by blobID.
	Download(context.Context, appfibre.BlobID) (*GetBlobResult, error)
	// QueryEscrowAccount returns the escrow account for the given signer.
	QueryEscrowAccount(_ context.Context, signer string) (*fibre.EscrowAccount, error)
	// Deposit adds funds to the node's escrow account.
	Deposit(context.Context, sdktypes.Coin, *txclient.TxConfig) error
	// Withdraw requests a withdrawal; funds unbond before becoming claimable.
	Withdraw(context.Context, sdktypes.Coin, *txclient.TxConfig) error
	// PendingWithdrawals returns not-yet-claimable withdrawals for the signer.
	PendingWithdrawals(_ context.Context, signer string) ([]fibre.PendingWithdrawal, error)
}

Module is the RPC API for the Fibre network: off-chain blob storage via Fibre Storage Providers (FSPs) with on-chain payment settlement. Only v0 blobs are supported for now. The signer for escrow/settlement operations is resolved from the TxConfig (SignerAddress or KeyName), falling back to the node's default account.

func NewModule

func NewModule(service *fibre.Service) Module

NewModule returns a Module backed by a local *fibre.Service. It is used by bridge nodes to expose the Fibre JSON-RPC API, and by api/client.Client to run all Fibre operations locally against a consensus endpoint and FSPs, without routing through a bridge node.

type PaymentPromise

type PaymentPromise struct {
	ChainID           string              `json:"chain_id"`
	Namespace         libshare.Namespace  `json:"namespace"`
	BlobSize          uint32              `json:"blob_size"`
	Commitment        appfibre.Commitment `json:"commitment"`
	RowVersion        uint32              `json:"row_version"`
	ValsetHeight      uint64              `json:"valset_height"`
	CreationTimestamp time.Time           `json:"creation_timestamp"`
	Signature         []byte              `json:"signature"`
}

PaymentPromise is the signed user↔network promise, settled on-chain via MsgPayForFibre.

type SubmitResult

type SubmitResult struct {
	UploadResult
	Height uint64 `json:"height"`
	TxHash string `json:"tx_hash"`
}

SubmitResult is an UploadResult plus the on-chain inclusion details of its settlement.

type UploadResult

type UploadResult struct {
	BlobID              appfibre.BlobID      `json:"blob_id"`
	ValidatorSignatures []ValidatorSignature `json:"validator_signatures"`
	PaymentPromise      *PaymentPromise      `json:"payment_promise,omitempty"`
}

UploadResult is returned by an off-chain Fibre upload; PaymentPromise can later settle it on-chain via MsgPayForFibre.

type ValidatorSignature

type ValidatorSignature []byte

ValidatorSignature is a validator's blob-availability attestation.

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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