beelite

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2024 License: Apache-2.0 Imports: 86 Imported by: 0

README

bee-lite

Go Reference

bee-lite is an embeddable, lightweight bee node for applications to use swarm directly

How to run

o := &bee.Options{
    FullNodeMode:             true,
    Keystore:                 keystore,
    DataDir:                  dataDir,
    Addr:                     ":1836",
    WelcomeMessage:           "welcome from bee-lite",
    Bootnodes:                []string{"/dnsaddr/testnet.ethswarm.org"},
    Logger:                   logging.New(os.Stdout, logrus.ErrorLevel),
    SwapEndpoint:             <SWAP_ENDPOINT>,
    SwapInitialDeposit:       "10000000000000000",
    SwapEnable:               true,
    WarmupTime:               0,
    ChainID:                  100,
    ChequebookEnable:         true,
    ChainEnable:              true,
    BlockTime:                uint64(5),
    PaymentThreshold:         "100000000",
    UsePostageSnapshot:       false,
    Mainnet:                  true,
    NetworkID:                1,
    DBOpenFilesLimit:         200,
    DBWriteBufferSize:        32 * 1024 * 1024,
    DBDisableSeeksCompaction: false,
    DBBlockCacheCapacity:     32 * 1024 * 1024,
    RetrievalCaching:         true,
}
b, err := bee.Start(o, password)
if err != nil {
    return err
}

Documentation

Index

Constants

View Source
const (
	LoggerName = "beelite"
)
View Source
const (
	ReserveCapacity = 4_194_304 // 2^22 chunks

)
View Source
const (
	TopicLength = 32
)

Variables

View Source
var ErrShutdownInProgress error = errors.New("shutdown in progress")

Functions

func OverlayAddr

func OverlayAddr(root, password string) (common.Address, error)

Types

type Bee

type Bee struct {
	// contains filtered or unexported fields
}

func (*Bee) Shutdown

func (b *Bee) Shutdown() error

func (*Bee) SyncingStopped

func (b *Bee) SyncingStopped() chan struct{}

type Beelite

type Beelite struct {
	// contains filtered or unexported fields
}

func NewBee

func NewBee(
	ctx context.Context,
	addr string,
	publicKey *ecdsa.PublicKey,
	signer crypto.Signer,
	networkID uint64,
	logger log.Logger,
	libp2pPrivateKey,
	pssPrivateKey *ecdsa.PrivateKey,
	o *Options,
) (bl *Beelite, err error)

func Start

func Start(mo *MobileOptions, password string, verbosity string) (bl *Beelite, errMain error)

func (*Beelite) AddBytes

func (bl *Beelite) AddBytes(parentContext context.Context, batchHex string, reader io.Reader) (reference swarm.Address, err error)

func (*Beelite) AddChunk

func (bl *Beelite) AddChunk(parentContext context.Context, batchHex string, chunk swarm.Chunk) (swarm.Address, error)

func (*Beelite) AddFeed

func (bl *Beelite) AddFeed(ctx context.Context, batchHex, owner, topic string) (reference swarm.Address, err error)

func (*Beelite) AddFileBzz

func (bl *Beelite) AddFileBzz(parentContext context.Context, batchHex, filename, contentType string, reader io.Reader) (reference swarm.Address, err error)

func (*Beelite) AddSOC

func (bl *Beelite) AddSOC(ctx context.Context, batchHex string, ch swarm.Chunk) (reference swarm.Address, err error)

func (*Beelite) BuyStamp

func (bl *Beelite) BuyStamp(amount *big.Int, depth uint64, label string, immutable bool) (common.Hash, []byte, error)

func (*Beelite) ChequebookAddr

func (bl *Beelite) ChequebookAddr() common.Address

func (*Beelite) ChequebookBalance

func (bl *Beelite) ChequebookBalance() (*big.Int, error)

func (*Beelite) ChequebookWithdraw

func (bl *Beelite) ChequebookWithdraw(amount *big.Int) (common.Hash, error)

func (*Beelite) GetAllBatches

func (bl *Beelite) GetAllBatches() []*postage.StampIssuer

func (*Beelite) GetBytes

func (bl *Beelite) GetBytes(parentContext context.Context, reference swarm.Address) (io.Reader, error)

func (*Beelite) GetBzz

func (bl *Beelite) GetBzz(parentContext context.Context, address swarm.Address) (io.Reader, string, error)

func (*Beelite) GetChunk

func (bl *Beelite) GetChunk(parentContext context.Context, reference swarm.Address) (swarm.Chunk, error)

func (*Beelite) GetUsableBatches

func (bl *Beelite) GetUsableBatches() []*postage.StampIssuer

type MobileOptions

type MobileOptions struct {
	FullNodeMode          bool
	BootnodeMode          bool
	Bootnodes             []string
	StaticNodes           []string
	DataDir               string
	WelcomeMessage        string
	SwapEndpoint          string
	BlockchainRpcEndpoint string
	SwapInitialDeposit    string
	SwapEnable            bool
	ChequebookEnable      bool
	DebugAPIEnable        bool
	Mainnet               bool
	NetworkID             uint64
	NATAddr               string
}

type Options

type Options struct {
	DataDir                       string
	CacheCapacity                 uint64
	DBOpenFilesLimit              uint64
	DBWriteBufferSize             uint64
	DBBlockCacheCapacity          uint64
	DBDisableSeeksCompaction      bool
	APIAddr                       string
	DebugAPIAddr                  string
	Addr                          string
	NATAddr                       string
	EnableWS                      bool
	WelcomeMessage                string
	Bootnodes                     []string
	CORSAllowedOrigins            []string
	Logger                        log.Logger
	TracingEnabled                bool
	TracingEndpoint               string
	TracingServiceName            string
	PaymentThreshold              string
	PaymentTolerance              int64
	PaymentEarly                  int64
	ResolverConnectionCfgs        []multiresolver.ConnectionConfig
	RetrievalCaching              bool
	BootnodeMode                  bool
	BlockchainRpcEndpoint         string
	SwapFactoryAddress            string
	SwapLegacyFactoryAddresses    []string
	SwapInitialDeposit            string
	SwapEnable                    bool
	ChequebookEnable              bool
	FullNodeMode                  bool
	PostageContractAddress        string
	PostageContractStartBlock     uint64
	StakingContractAddress        string
	PriceOracleAddress            string
	RedistributionContractAddress string
	BlockTime                     time.Duration
	DeployGasPrice                string
	WarmupTime                    time.Duration
	ChainID                       int64
	Resync                        bool
	BlockProfile                  bool
	MutexProfile                  bool
	StaticNodes                   []swarm.Address
	AllowPrivateCIDRs             bool
	Restricted                    bool
	TokenEncryptionKey            string
	AdminPasswordHash             string
	UsePostageSnapshot            bool
	EnableStorageIncentives       bool
	StatestoreCacheCapacity       uint64
	TargetNeighborhood            string
}

type Topic

type Topic [TopicLength]byte

Jump to

Keyboard shortcuts

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