node

package
v1.5.5 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2026 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultListenAddress = "0.0.0.0:47821"

Variables

View Source
var (
	ErrPaymentWalletChanged   = errors.New("active wallet changed after payment review")
	ErrPaymentFeeExceeded     = errors.New("payment fee exceeds the reviewed ceiling")
	ErrWalletRecoveryRequired = errors.New("wallet recovery must be secured before Agent Pay")
)
View Source
var ErrLegacyWalletMigrationRequired = errors.New("legacy wallet requires encrypted migration")
View Source
var ErrProtectedWalletBackupPath = errors.New("wallet backup destination conflicts with node data")
View Source
var ErrSeedModeWalletUnavailable = errors.New("wallet transactions and mining are unavailable in seed mode")
View Source
var ErrWalletChangedDuringBackup = errors.New("wallet changed while backup was being exported")

Functions

func DefaultBootstrapManifestURLs

func DefaultBootstrapManifestURLs() []string

DefaultBootstrapManifestURLs returns independent delivery paths for the public seed list. Both sources contain the same small, versioned document.

func MigrateLegacyWallet

func MigrateLegacyWallet(dataDirectory, backupPath, password string) error

Types

type BlockSummary

type BlockSummary struct {
	Height       uint64 `json:"height"`
	Hash         string `json:"hash"`
	Timestamp    int64  `json:"timestamp"`
	Transactions int    `json:"transactions"`
	Difficulty   uint8  `json:"difficulty"`
}

type Config

type Config struct {
	DataDirectory         string
	ListenAddress         string
	SyncInterval          time.Duration
	DisableDiscovery      bool
	SeedMode              bool
	PruneDepth            uint64
	PruneDepthSet         bool
	InitialPruneDepth     uint64
	FallbackPort          bool
	BootstrapPeers        []string
	BootstrapManifestURLs []string
	MaxOutboundPeers      int
	TrustLoopbackProxy    bool
}

type Dashboard

type Dashboard struct {
	Name                string          `json:"name"`
	Symbol              string          `json:"symbol"`
	Protocol            string          `json:"protocol"`
	ConsensusVersion    uint32          `json:"consensus_version"`
	ConsensusActivation uint64          `json:"consensus_activation"`
	Address             string          `json:"address"`
	ConfirmedBalance    string          `json:"confirmed_balance"`
	SpendableBalance    string          `json:"spendable_balance"`
	Height              uint64          `json:"height"`
	TipHash             string          `json:"tip_hash"`
	Difficulty          uint8           `json:"difficulty"`
	PendingCount        int             `json:"pending_count"`
	PeerCount           int             `json:"peer_count"`
	ConfiguredPeerCount int             `json:"configured_peer_count"`
	Peers               []PeerSummary   `json:"peers"`
	Mining              bool            `json:"mining"`
	Syncing             bool            `json:"syncing"`
	BestPeerHeight      uint64          `json:"best_peer_height"`
	ListenAddress       string          `json:"listen_address"`
	Issued              string          `json:"issued"`
	MaxSupply           string          `json:"max_supply"`
	TargetBlockSeconds  int             `json:"target_block_seconds"`
	EmissionBlocks      uint64          `json:"emission_blocks"`
	NextSubsidy         string          `json:"next_subsidy"`
	LastError           string          `json:"last_error"`
	DatabasePath        string          `json:"database_path"`
	DatabaseBytes       int64           `json:"database_bytes"`
	PrunedThrough       uint64          `json:"pruned_through"`
	PruneDepth          uint64          `json:"prune_depth"`
	ArchiveMode         bool            `json:"archive_mode"`
	WalletNeedsBackup   bool            `json:"wallet_needs_backup"`
	Wallets             []WalletProfile `json:"wallets"`
	BootstrapEnabled    bool            `json:"bootstrap_enabled"`
	BootstrapReady      bool            `json:"bootstrap_ready"`
	BootstrapLastUpdate int64           `json:"bootstrap_last_update,omitempty"`
	BootstrapError      string          `json:"bootstrap_error,omitempty"`
	RecentBlocks        []BlockSummary  `json:"recent_blocks"`
}

type PaymentPreview added in v1.5.2

type PaymentPreview struct {
	Wallet             string `json:"wallet"`
	Recipient          string `json:"recipient"`
	Amount             uint64 `json:"amount"`
	EstimatedFee       uint64 `json:"estimated_fee"`
	MaximumFee         uint64 `json:"maximum_fee"`
	TotalDebit         uint64 `json:"total_debit"`
	SpendableBalance   uint64 `json:"spendable_balance"`
	HasSufficientFunds bool   `json:"has_sufficient_funds"`
	WalletNeedsBackup  bool   `json:"wallet_needs_backup"`
}

type PeerSummary

type PeerSummary struct {
	URL            string `json:"url"`
	Online         bool   `json:"online"`
	Height         uint64 `json:"height"`
	Failures       int    `json:"failures"`
	LastError      string `json:"last_error,omitempty"`
	Discovered     bool   `json:"discovered"`
	Public         bool   `json:"public"`
	Bootstrap      bool   `json:"bootstrap"`
	ActiveOutbound bool   `json:"active_outbound"`
	LastSeen       int64  `json:"last_seen,omitempty"`
}

type Service

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

func New

func New(config Config) (*Service, error)

func NewContext

func NewContext(ctx context.Context, config Config) (*Service, error)

func (*Service) ActualAddress

func (s *Service) ActualAddress() string

func (*Service) AddPeer

func (s *Service) AddPeer(raw string) error

func (*Service) Address

func (s *Service) Address() string

func (*Service) Close

func (s *Service) Close(ctx context.Context) error

func (*Service) CommitPreparedPayment added in v1.5.2

func (s *Service) CommitPreparedPayment(expectedWallet, to string, amount, fee, maximumFee uint64, transaction core.Transaction) error

func (*Service) ConfirmWalletRecovery

func (s *Service) ConfirmWalletRecovery() error

func (*Service) CreateWallet

func (s *Service) CreateWallet() (string, error)

func (*Service) Dashboard

func (s *Service) Dashboard() (Dashboard, error)

func (*Service) DataDirectory added in v1.5.2

func (s *Service) DataDirectory() string

func (*Service) ExportWalletBackup

func (s *Service) ExportWalletBackup(path, password string) error

func (*Service) FilteredTransactionHistory added in v1.0.10

func (s *Service) FilteredTransactionHistory(limit int, filter string) ([]TransactionSummary, error)

func (*Service) HealthEvents

func (s *Service) HealthEvents(activeOnly bool, limit int) ([]ledger.HealthEvent, error)

func (*Service) MineOnce

func (s *Service) MineOnce(ctx context.Context) (core.Block, error)

func (*Service) PrepareRecommendedPayment added in v1.5.2

func (s *Service) PrepareRecommendedPayment(expectedWallet, to string, amount, maximumFee uint64) (core.Transaction, uint64, error)

func (*Service) PreviewRecommendedPayment added in v1.5.2

func (s *Service) PreviewRecommendedPayment(expectedWallet, to string, amount uint64) (PaymentPreview, error)

func (*Service) PruneLedger

func (s *Service) PruneLedger(retainRecent uint64) (uint64, error)

func (*Service) RecoveryPhrase

func (s *Service) RecoveryPhrase() (string, error)

func (*Service) RemovePeer

func (s *Service) RemovePeer(raw string) error

func (*Service) RemoveWallet

func (s *Service) RemoveWallet(address string) error

func (*Service) ResolveHealthEvent

func (s *Service) ResolveHealthEvent(id int64) error

func (*Service) RestoreWalletBackup

func (s *Service) RestoreWalletBackup(path, password string) (string, error)

func (*Service) RestoreWalletMnemonic

func (s *Service) RestoreWalletMnemonic(phrase string) (string, error)

func (*Service) Send

func (s *Service) Send(to, amountText, feeText string) (core.Transaction, error)

func (*Service) SendRecommended

func (s *Service) SendRecommended(to, amountText string) (core.Transaction, uint64, error)

func (*Service) SendRecommendedFrom added in v1.5.2

func (s *Service) SendRecommendedFrom(expectedWallet, to string, amount, maximumFee uint64) (core.Transaction, uint64, error)

func (*Service) Start

func (s *Service) Start(parent context.Context) error

func (*Service) StartMining

func (s *Service) StartMining() error

func (*Service) StopMining

func (s *Service) StopMining()

func (*Service) SwitchWallet

func (s *Service) SwitchWallet(address string) error

func (*Service) TransactionHistory

func (s *Service) TransactionHistory(limit int) ([]TransactionSummary, error)

func (*Service) WalletProfiles

func (s *Service) WalletProfiles() ([]WalletProfile, error)

type TransactionInputSummary

type TransactionInputSummary struct {
	TransactionID string `json:"transaction_id"`
	OutputIndex   uint32 `json:"output_index"`
}

type TransactionOutputSummary

type TransactionOutputSummary struct {
	Index   uint32 `json:"index"`
	Address string `json:"address"`
	Amount  string `json:"amount"`
}

type TransactionSummary

type TransactionSummary struct {
	ID            string                     `json:"id"`
	BlockHeight   *uint64                    `json:"block_height,omitempty"`
	BlockHash     string                     `json:"block_hash,omitempty"`
	BlockPosition *int                       `json:"block_position,omitempty"`
	Pending       bool                       `json:"pending"`
	Coinbase      bool                       `json:"coinbase"`
	Pruned        bool                       `json:"pruned"`
	Confirmations uint64                     `json:"confirmations"`
	Timestamp     int64                      `json:"timestamp"`
	Received      string                     `json:"received"`
	Sent          string                     `json:"sent"`
	Inputs        []TransactionInputSummary  `json:"inputs"`
	Outputs       []TransactionOutputSummary `json:"outputs"`
}

type WalletProfile

type WalletProfile struct {
	Address     string `json:"address"`
	Active      bool   `json:"active"`
	NeedsBackup bool   `json:"needs_backup"`
}

Jump to

Keyboard shortcuts

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