bee

package module
v0.0.0-...-280724c Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2022 License: Apache-2.0 Imports: 76 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 (
	TopicLength = 32
)

Variables

This section is empty.

Functions

func OverlayAddr

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

Types

type Bee

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

Bee client.

func Start

func Start(o *Options, password string) (*Bee, error)

func (*Bee) AddBytes

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

func (*Bee) AddChunk

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

func (*Bee) AddFeed

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

func (*Bee) AddFileBzz

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

func (*Bee) AddSOC

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

func (*Bee) Addr

func (b *Bee) Addr() common.Address

func (*Bee) BuyStamp

func (b *Bee) BuyStamp(amount *big.Int, depth uint64, label string, immutable bool) ([]byte, error)

func (*Bee) ChequebookAddr

func (b *Bee) ChequebookAddr() common.Address

func (*Bee) ChequebookBalance

func (b *Bee) ChequebookBalance() (*big.Int, error)

func (*Bee) ChequebookWithdraw

func (b *Bee) ChequebookWithdraw(amount *big.Int) (common.Hash, error)

func (*Bee) GetAllBatches

func (b *Bee) GetAllBatches() []*postage.StampIssuer

func (*Bee) GetBytes

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

func (*Bee) GetBzz

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

func (*Bee) GetChunk

func (b *Bee) GetChunk(parentContext context.Context, reference swarm.Address) (swarm.Chunk, error)

func (*Bee) GetUsableBatches

func (b *Bee) GetUsableBatches() []*postage.StampIssuer

func (*Bee) Shutdown

func (b *Bee) Shutdown() error

func (*Bee) Signer

func (b *Bee) Signer() crypto.Signer

func (*Bee) SyncingStopped

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

func (*Bee) Topology

func (b *Bee) Topology() *topology.KadParams

type Options

type Options struct {
	FullNodeMode               bool
	Keystore                   string
	DataDir                    string
	Addr                       string
	NATAddr                    string
	WelcomeMessage             string
	Bootnodes                  []string
	Logger                     logging.Logger
	SwapEndpoint               string
	SwapFactoryAddress         string
	SwapLegacyFactoryAddresses []string
	SwapInitialDeposit         string
	SwapEnable                 bool
	WarmupTime                 time.Duration
	ChainID                    int64
	ChequebookEnable           bool
	ChainEnable                bool
	DeployGasPrice             string
	BlockTime                  uint64
	Transaction                string
	BlockHash                  string
	PostageContractAddress     string
	PriceOracleAddress         string
	PaymentThreshold           string
	PaymentTolerance           int64
	PaymentEarly               int64
	UsePostageSnapshot         bool
	Mainnet                    bool
	NetworkID                  uint64
	Resync                     bool
	CacheCapacity              uint64
	DBOpenFilesLimit           uint64
	DBWriteBufferSize          uint64
	DBDisableSeeksCompaction   bool
	DBBlockCacheCapacity       uint64
	RetrievalCaching           bool
}

type Topic

type Topic [TopicLength]byte

Jump to

Keyboard shortcuts

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