explorer

package
v0.0.0-...-9307437 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventTypeTransaction       = "transaction"
	EventTypeV2Transaction     = "v2transaction"
	EventTypeMinerPayout       = "miner payout"
	EventTypeContractPayout    = "contract payout"
	EventTypeSiafundClaim      = "siafund claim"
	EventTypeFoundationSubsidy = "foundation subsidy"
)

event type constants

Variables

View Source
var (
	// ErrNoTip is returned when we are unable to find the tip in the
	// database or there is no tips at all.
	ErrNoTip = errors.New("no tip found")

	// ErrContractNotFound is returned when ContractRevisions is unable to find
	// the specified contract ID.
	ErrContractNotFound = errors.New("contract not found")
)
View Source
var (
	SpecifierAnnouncement = types.NewSpecifier("HostAnnouncement")
)

Arbitrary data specifiers

Functions

func UpdateChainState

func UpdateChainState(tx UpdateTx, crus []chain.RevertUpdate, caus []chain.ApplyUpdate) error

UpdateChainState applies the reverts and updates.

Types

type Block

type Block struct {
	Height       uint64          `json:"height"`
	ParentID     types.BlockID   `json:"parentID"`
	Nonce        uint64          `json:"nonce"`
	Timestamp    time.Time       `json:"timestamp"`
	LeafIndex    uint64          `json:"leafIndex"`
	MinerPayouts []SiacoinOutput `json:"minerPayouts"`
	Transactions []Transaction   `json:"transactions"`

	V2 *V2BlockData `json:"v2,omitempty"`
}

A Block is a block containing wrapped transactions and siacoin outputs for the miner payouts.

type ChainManager

type ChainManager interface {
	Tip() types.ChainIndex
	TipState() consensus.State
	BestIndex(height uint64) (types.ChainIndex, bool)

	OnReorg(fn func(types.ChainIndex)) (cancel func())
	UpdatesSince(index types.ChainIndex, max int) (rus []chain.RevertUpdate, aus []chain.ApplyUpdate, err error)
}

A ChainManager manages the consensus state

type ChainUpdate

type ChainUpdate interface {
	ForEachSiacoinElement(func(sce types.SiacoinElement, created, spent bool))
	ForEachSiafundElement(func(sfe types.SiafundElement, created, spent bool))
	ForEachFileContractElement(func(fce types.FileContractElement, created bool, rev *types.FileContractElement, resolved, valid bool))
	ForEachV2FileContractElement(func(fce types.V2FileContractElement, created bool, rev *types.V2FileContractElement, res types.V2FileContractResolutionType))
}

A ChainUpdate is a set of changes to the consensus state.

type ContractSiacoinOutput

type ContractSiacoinOutput struct {
	ID types.SiacoinOutputID `json:"id"`
	types.SiacoinOutput
}

A ContractSiacoinOutput is a SiacoinOutput with an added field for its ID.

type DBFileContract

type DBFileContract struct {
	ID             types.FileContractID
	RevisionNumber uint64
}

A DBFileContract represents a file contract element in the DB.

type Event

type Event struct {
	ID             types.Hash256    `json:"id"`
	Index          types.ChainIndex `json:"index"`
	Timestamp      time.Time        `json:"timestamp"`
	MaturityHeight uint64           `json:"maturityHeight"`
	Addresses      []types.Address  `json:"addresses"`
	Data           eventData        `json:"data"`
}

An Event is something interesting that happened on the Sia blockchain.

func AppliedEvents

func AppliedEvents(cs consensus.State, b types.Block, cu ChainUpdate) []Event

AppliedEvents extracts a list of relevant events from a chain update.

type EventContractPayout

type EventContractPayout struct {
	FileContract  types.FileContractElement `json:"fileContract"`
	SiacoinOutput types.SiacoinElement      `json:"siacoinOutput"`
	Missed        bool                      `json:"missed"`
}

An EventContractPayout represents a file contract payout

func (*EventContractPayout) EventType

func (*EventContractPayout) EventType() string

EventType implements Event.

type EventFileContract

type EventFileContract struct {
	FileContract types.FileContractElement `json:"fileContract"`
	// only non-nil if transaction revised contract
	Revision *types.FileContract `json:"revision,omitempty"`
	// only non-nil if transaction resolved contract
	ValidOutputs []types.SiacoinElement `json:"validOutputs,omitempty"`
}

An EventFileContract represents a file contract within an EventTransaction.

type EventFoundationSubsidy

type EventFoundationSubsidy struct {
	SiacoinOutput types.SiacoinElement `json:"siacoinOutput"`
}

EventFoundationSubsidy represents a foundation subsidy from a block.

func (*EventFoundationSubsidy) EventType

func (*EventFoundationSubsidy) EventType() string

EventType implements Event.

type EventMinerPayout

type EventMinerPayout struct {
	SiacoinOutput types.SiacoinElement `json:"siacoinOutput"`
}

An EventMinerPayout represents a miner payout from a block.

func (*EventMinerPayout) EventType

func (*EventMinerPayout) EventType() string

EventType implements Event.

type EventSiafundInput

type EventSiafundInput struct {
	SiafundElement types.SiafundElement `json:"siafundElement"`
	ClaimElement   types.SiacoinElement `json:"claimElement"`
}

An EventSiafundInput represents a siafund input within an EventTransaction.

type EventTransaction

type EventTransaction struct {
	Transaction       Transaction              `json:"transaction"`
	HostAnnouncements []chain.HostAnnouncement `json:"hostAnnouncements"`
	Fee               types.Currency           `json:"fee"`
}

An EventTransaction represents a transaction that affects the wallet.

func (*EventTransaction) EventType

func (*EventTransaction) EventType() string

EventType implements Event.

type EventV2FileContract

type EventV2FileContract struct {
	FileContract types.V2FileContractElement `json:"fileContract"`
	// only non-nil if transaction revised contract
	Revision *types.V2FileContract `json:"revision,omitempty"`
	// only non-nil if transaction resolved contract
	Resolution types.V2FileContractResolutionType `json:"resolution,omitempty"`
	Outputs    []types.SiacoinElement             `json:"outputs,omitempty"`
}

An EventV2FileContract represents a v2 file contract within an EventTransaction.

type EventV2Transaction

type EventV2Transaction V2Transaction

An EventV2Transaction represents a v2 transaction that affects the wallet.

func (*EventV2Transaction) EventType

func (*EventV2Transaction) EventType() string

EventType implements Event.

type Explorer

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

Explorer implements a Sia explorer.

func NewExplorer

func NewExplorer(cm ChainManager, store Store, batchSize int, scanCfg config.Scanner, log *zap.Logger) (*Explorer, error)

NewExplorer returns a Sia explorer.

func (*Explorer) AddressEvents

func (e *Explorer) AddressEvents(address types.Address, offset, limit uint64) (events []Event, err error)

AddressEvents returns the events of a single address.

func (*Explorer) Balance

func (e *Explorer) Balance(address types.Address) (sc types.Currency, immatureSC types.Currency, sf uint64, err error)

Balance returns the balance of an address.

func (*Explorer) BestTip

func (e *Explorer) BestTip(height uint64) (types.ChainIndex, error)

BestTip returns the chain index at the specified height.

func (*Explorer) Block

func (e *Explorer) Block(id types.BlockID) (Block, error)

Block returns the block with the specified ID.

func (*Explorer) ContractRevisions

func (e *Explorer) ContractRevisions(id types.FileContractID) (result []ExtendedFileContract, err error)

ContractRevisions returns all the revisions of the contract with the specified ID.

func (*Explorer) Contracts

func (e *Explorer) Contracts(ids []types.FileContractID) (result []ExtendedFileContract, err error)

Contracts returns the contracts with the specified IDs.

func (*Explorer) ContractsKey

func (e *Explorer) ContractsKey(key types.PublicKey) (result []ExtendedFileContract, err error)

ContractsKey returns the contracts for a particular ed25519 key.

func (*Explorer) HostMetrics

func (e *Explorer) HostMetrics() (HostMetrics, error)

HostMetrics returns various metrics about currently available hosts.

func (*Explorer) Hosts

func (e *Explorer) Hosts(pks []types.PublicKey) ([]Host, error)

Hosts returns the hosts with the specified public keys.

func (*Explorer) MerkleProof

func (e *Explorer) MerkleProof(leafIndex uint64) ([]types.Hash256, error)

MerkleProof returns the proof of a given leaf.

func (*Explorer) Metrics

func (e *Explorer) Metrics(id types.BlockID) (Metrics, error)

Metrics returns various metrics about Sia.

func (*Explorer) Search

func (e *Explorer) Search(id types.Hash256) (SearchType, error)

Search returns the element type (address, block, transaction, contract ID) for a given ID.

func (*Explorer) Shutdown

func (e *Explorer) Shutdown(ctx context.Context) error

Shutdown tries to close the scanning goroutines in the explorer.

func (*Explorer) SiacoinElements

func (e *Explorer) SiacoinElements(ids []types.SiacoinOutputID) (result []SiacoinOutput, err error)

SiacoinElements returns the siacoin elements with the specified IDs.

func (*Explorer) SiafundElements

func (e *Explorer) SiafundElements(ids []types.SiafundOutputID) (result []SiafundOutput, err error)

SiafundElements returns the siafund elements with the specified IDs.

func (*Explorer) Tip

func (e *Explorer) Tip() (types.ChainIndex, error)

Tip returns the tip of the best known valid chain.

func (*Explorer) TransactionChainIndices

func (e *Explorer) TransactionChainIndices(id types.TransactionID, offset, limit uint64) ([]types.ChainIndex, error)

TransactionChainIndices returns the chain indices of the blocks the transaction was included in. If the transaction has not been included in any blocks, the result will be nil,nil.

func (*Explorer) Transactions

func (e *Explorer) Transactions(ids []types.TransactionID) ([]Transaction, error)

Transactions returns the transactions with the specified IDs.

func (*Explorer) UnspentSiacoinOutputs

func (e *Explorer) UnspentSiacoinOutputs(address types.Address, offset, limit uint64) ([]SiacoinOutput, error)

UnspentSiacoinOutputs returns the unspent siacoin outputs owned by the specified address.

func (*Explorer) UnspentSiafundOutputs

func (e *Explorer) UnspentSiafundOutputs(address types.Address, offset, limit uint64) ([]SiafundOutput, error)

UnspentSiafundOutputs returns the unspent siafund outputs owned by the specified address.

func (*Explorer) V2ContractRevisions

func (e *Explorer) V2ContractRevisions(id types.FileContractID) (result []V2FileContract, err error)

V2ContractRevisions returns all the revisions of the v2 contract with the specified ID.

func (*Explorer) V2Contracts

func (e *Explorer) V2Contracts(ids []types.FileContractID) (result []V2FileContract, err error)

V2Contracts returns the v2 contracts with the specified IDs.

func (*Explorer) V2ContractsKey

func (e *Explorer) V2ContractsKey(key types.PublicKey) (result []V2FileContract, err error)

V2ContractsKey returns the v2 contracts for a particular ed25519 key.

func (*Explorer) V2TransactionChainIndices

func (e *Explorer) V2TransactionChainIndices(id types.TransactionID, offset, limit uint64) ([]types.ChainIndex, error)

V2TransactionChainIndices returns the chain indices of the blocks the transaction was included in. If the transaction has not been included in any blocks, the result will be nil,nil.

func (*Explorer) V2Transactions

func (e *Explorer) V2Transactions(ids []types.TransactionID) ([]V2Transaction, error)

V2Transactions returns the v2 transactions with the specified IDs.

type ExtendedFileContract

type ExtendedFileContract struct {
	Resolved bool `json:"resolved"`
	Valid    bool `json:"valid"`

	TransactionID types.TransactionID `json:"transactionID"`

	ConfirmationIndex         types.ChainIndex    `json:"confirmationIndex"`
	ConfirmationTransactionID types.TransactionID `json:"confirmationTransactionID"`

	ProofIndex         *types.ChainIndex    `json:"proofIndex"`
	ProofTransactionID *types.TransactionID `json:"proofTransactionID"`

	ID                 types.FileContractID    `json:"id"`
	Filesize           uint64                  `json:"filesize"`
	FileMerkleRoot     types.Hash256           `json:"fileMerkleRoot"`
	WindowStart        uint64                  `json:"windowStart"`
	WindowEnd          uint64                  `json:"windowEnd"`
	Payout             types.Currency          `json:"payout"`
	ValidProofOutputs  []ContractSiacoinOutput `json:"validProofOutputs"`
	MissedProofOutputs []ContractSiacoinOutput `json:"missedProofOutputs"`
	UnlockHash         types.Address           `json:"unlockHash"`
	RevisionNumber     uint64                  `json:"revisionNumber"`
}

A ExtendedFileContract is a FileContract with added fields for resolved/valid state, and when the transaction was confirmed and proved.

type FileContractRevision

type FileContractRevision struct {
	ParentID         types.FileContractID   `json:"parentID"`
	UnlockConditions types.UnlockConditions `json:"unlockConditions"`

	ExtendedFileContract
}

A FileContractRevision is a FileContract with extra fields for revision information.

type FileContractUpdate

type FileContractUpdate struct {
	FileContractElement types.FileContractElement
	Revision            *types.FileContractElement
	Resolved, Valid     bool

	ConfirmationTransactionID *types.TransactionID
	ProofTransactionID        *types.TransactionID
}

FileContractUpdate represents a file contract from a consensus update.

type Host

type Host struct {
	PublicKey      types.PublicKey    `json:"publicKey"`
	NetAddress     string             `json:"netAddress"`
	V2NetAddresses []chain.NetAddress `json:"v2NetAddresses,omitempty"`

	CountryCode string `json:"countryCode"`

	KnownSince             time.Time `json:"knownSince"`
	LastScan               time.Time `json:"lastScan"`
	LastScanSuccessful     bool      `json:"lastScanSuccessful"`
	LastAnnouncement       time.Time `json:"lastAnnouncement"`
	TotalScans             uint64    `json:"totalScans"`
	SuccessfulInteractions uint64    `json:"successfulInteractions"`
	FailedInteractions     uint64    `json:"failedInteractions"`

	Settings   rhpv2.HostSettings   `json:"settings"`
	PriceTable rhpv3.HostPriceTable `json:"priceTable"`

	RHPV4Settings rhpv4.HostSettings `json:"rhpV4Settings"`
}

Host represents a host and the information gathered from scanning it.

func (Host) IsV2

func (h Host) IsV2() bool

IsV2 returns whether a host supports V2 or not.

func (Host) V2SiamuxAddr

func (h Host) V2SiamuxAddr() (string, bool)

V2SiamuxAddr returns the `Address` of the first TCP siamux `NetAddress` it finds in the host's list of net addresses. The protocol for this address is ProtocolTCPSiaMux.

type HostMetrics

type HostMetrics struct {
	ActiveHosts uint64               `json:"activeHosts"`
	Settings    rhpv2.HostSettings   `json:"settings"`
	PriceTable  rhpv3.HostPriceTable `json:"priceTable"`
}

HostMetrics represents averages of scanned information from hosts.

type HostScan

type HostScan struct {
	PublicKey   types.PublicKey `json:"publicKey"`
	CountryCode string          `json:"countryCode"`
	Success     bool            `json:"success"`
	Timestamp   time.Time       `json:"timestamp"`

	Settings   rhpv2.HostSettings   `json:"settings"`
	PriceTable rhpv3.HostPriceTable `json:"priceTable"`

	RHPV4Settings rhpv4.HostSettings `json:"rhpV4Settings"`
}

HostScan represents the results of a host scan.

type Metrics

type Metrics struct {
	// Current chain index
	Index types.ChainIndex `json:"index"`
	// Current difficulty
	Difficulty consensus.Work `json:"difficulty"`
	// Siafund pool value
	SiafundTaxRevenue types.Currency `json:"siafundTaxRevenue"`
	// Total announced hosts
	TotalHosts uint64 `json:"totalHosts"`
	// Number of leaves in the accumulator
	NumLeaves uint64 `json:"numLeaves"`
	// Number of active contracts
	ActiveContracts uint64 `json:"activeContracts"`
	// Number of failed contracts
	FailedContracts uint64 `json:"failedContracts"`
	// Number of successful contracts
	SuccessfulContracts uint64 `json:"successfulContracts"`
	// Current storage utilization, in bytes
	StorageUtilization uint64 `json:"storageUtilization"`
	// Current circulating supply
	CirculatingSupply types.Currency `json:"circulatingSupply"`
	// Total contract revenue
	ContractRevenue types.Currency `json:"contractRevenue"`
}

Metrics contains various statistics relevant to the health of the Sia network.

type SearchType

type SearchType string

A SearchType represents the type of element found during a search.

const (
	// SearchTypeInvalid means we were unable to find any element with the
	// given identifier.
	SearchTypeInvalid SearchType = "invalid"
	// SearchTypeAddress means we found an address with the given ID.
	SearchTypeAddress SearchType = "address"
	// SearchTypeBlock means we found a block with the given ID.
	SearchTypeBlock SearchType = "block"
	// SearchTypeTransaction means we found a transaction with the given ID.
	SearchTypeTransaction SearchType = "transaction"
	// SearchTypeSiacoinElement means we found a contract with the given ID.
	SearchTypeSiacoinElement SearchType = "siacoinElement"
	// SearchTypeSiafundElement means we found a contract with the given ID.
	SearchTypeSiafundElement SearchType = "siafundElement"
	// SearchTypeContract means we found a contract with the given ID.
	SearchTypeContract SearchType = "contract"
)

type SiacoinInput

type SiacoinInput struct {
	Address types.Address  `json:"address"`
	Value   types.Currency `json:"value"`
	types.SiacoinInput
}

A SiacoinInput is a types.SiacoinInput with information about the parent value.

type SiacoinOutput

type SiacoinOutput struct {
	Source     Source            `json:"source"`
	SpentIndex *types.ChainIndex `json:"spentIndex"`
	types.SiacoinElement
}

A SiacoinOutput is a types.SiacoinElement with added fields for the source and when it was spent.

type SiafundInput

type SiafundInput struct {
	Address types.Address `json:"address"`
	Value   uint64        `json:"value"`
	types.SiafundInput
}

A SiafundInput is a types.SiafundInput with information about the parent value.

type SiafundOutput

type SiafundOutput struct {
	SpentIndex *types.ChainIndex `json:"spentIndex"`
	types.SiafundElement
}

A SiafundOutput is a types.SiafundElement with an added field for when it was spent.

type Source

type Source int

A Source represents where a siacoin output came from.

const (
	// SourceInvalid represents a source we are not aware of.
	SourceInvalid Source = iota
	// SourceMinerPayout means the source of the output is a miner payout.
	SourceMinerPayout
	// SourceTransaction means the source of the output is a transaction.
	SourceTransaction
	// SourceValidProofOutput me ans the source of the output is a valid proof
	// output.
	SourceValidProofOutput
	// SourceMissedProofOutput me ans the source of the output is a missed
	// proof output.
	SourceMissedProofOutput
)

func (Source) MarshalJSON

func (s Source) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (*Source) UnmarshalJSON

func (s *Source) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

type Store

type Store interface {
	Close() error

	UpdateChainState(reverted []chain.RevertUpdate, applied []chain.ApplyUpdate) error
	AddHostScans(scans []HostScan) error

	Tip() (types.ChainIndex, error)
	Block(id types.BlockID) (Block, error)
	BestTip(height uint64) (types.ChainIndex, error)
	MerkleProof(leafIndex uint64) ([]types.Hash256, error)
	Metrics(id types.BlockID) (Metrics, error)
	HostMetrics() (HostMetrics, error)
	Transactions(ids []types.TransactionID) ([]Transaction, error)
	TransactionChainIndices(txid types.TransactionID, offset, limit uint64) ([]types.ChainIndex, error)
	V2Transactions(ids []types.TransactionID) ([]V2Transaction, error)
	V2TransactionChainIndices(txid types.TransactionID, offset, limit uint64) ([]types.ChainIndex, error)
	UnspentSiacoinOutputs(address types.Address, offset, limit uint64) ([]SiacoinOutput, error)
	UnspentSiafundOutputs(address types.Address, offset, limit uint64) ([]SiafundOutput, error)
	AddressEvents(address types.Address, offset, limit uint64) (events []Event, err error)
	Balance(address types.Address) (sc types.Currency, immatureSC types.Currency, sf uint64, err error)
	Contracts(ids []types.FileContractID) (result []ExtendedFileContract, err error)
	ContractsKey(key types.PublicKey) (result []ExtendedFileContract, err error)
	ContractRevisions(id types.FileContractID) (result []ExtendedFileContract, err error)
	V2Contracts(ids []types.FileContractID) (result []V2FileContract, err error)
	V2ContractsKey(key types.PublicKey) (result []V2FileContract, err error)
	V2ContractRevisions(id types.FileContractID) (result []V2FileContract, err error)
	SiacoinElements(ids []types.SiacoinOutputID) (result []SiacoinOutput, err error)
	SiafundElements(ids []types.SiafundOutputID) (result []SiafundOutput, err error)

	Hosts(pks []types.PublicKey) ([]Host, error)
	HostsForScanning(maxLastScan, minLastAnnouncement time.Time, offset, limit uint64) ([]Host, error)
}

A Store is a database that stores information about elements, contracts, and blocks.

type Transaction

type Transaction struct {
	ID types.TransactionID `json:"id"`

	SiacoinInputs         []SiacoinInput               `json:"siacoinInputs,omitempty"`
	SiacoinOutputs        []SiacoinOutput              `json:"siacoinOutputs,omitempty"`
	SiafundInputs         []SiafundInput               `json:"siafundInputs,omitempty"`
	SiafundOutputs        []SiafundOutput              `json:"siafundOutputs,omitempty"`
	FileContracts         []ExtendedFileContract       `json:"fileContracts,omitempty"`
	FileContractRevisions []FileContractRevision       `json:"fileContractRevisions,omitempty"`
	StorageProofs         []types.StorageProof         `json:"storageProofs,omitempty"`
	MinerFees             []types.Currency             `json:"minerFees,omitempty"`
	ArbitraryData         [][]byte                     `json:"arbitraryData,omitempty"`
	Signatures            []types.TransactionSignature `json:"signatures,omitempty"`

	HostAnnouncements []chain.HostAnnouncement `json:"hostAnnouncements,omitempty"`
}

A Transaction is a transaction that uses the wrapped types above.

type TreeNodeUpdate

type TreeNodeUpdate struct {
	Row    uint64
	Column uint64
	Hash   types.Hash256
}

A TreeNodeUpdate is a change to a merkle tree node.

type UpdateState

type UpdateState struct {
	Block             types.Block
	ChainIndexElement types.ChainIndexElement

	Events      []Event
	Metrics     Metrics
	TreeUpdates []TreeNodeUpdate

	HostAnnouncements   []chain.HostAnnouncement
	V2HostAnnouncements []V2HostAnnouncement

	NewSiacoinElements       []SiacoinOutput
	SpentSiacoinElements     []SiacoinOutput
	EphemeralSiacoinElements []SiacoinOutput

	NewSiafundElements       []types.SiafundElement
	SpentSiafundElements     []types.SiafundElement
	EphemeralSiafundElements []types.SiafundElement

	FileContractElements   []FileContractUpdate
	V2FileContractElements []V2FileContractUpdate
}

An UpdateState contains information relevant to the block being applied or reverted.

type UpdateTx

type UpdateTx interface {
	Metrics(height uint64) (Metrics, error)
	HostExists(pubkey types.PublicKey) (bool, error)

	ApplyIndex(state UpdateState) error
	RevertIndex(state UpdateState) error
}

An UpdateTx atomically updates the state of a store.

type V2BlockData

type V2BlockData struct {
	Height       uint64          `json:"height"`
	Commitment   types.Hash256   `json:"commitment"`
	Transactions []V2Transaction `json:"transactions"`
}

V2BlockData is a struct containing the fields from types.V2BlockData and our modified explorer.V2Transaction type.

type V2FileContract

type V2FileContract struct {
	TransactionID types.TransactionID `json:"transactionID"`

	ConfirmationIndex         types.ChainIndex    `json:"confirmationIndex"`
	ConfirmationTransactionID types.TransactionID `json:"confirmationTransactionID"`

	ResolutionIndex         *types.ChainIndex    `json:"resolutionIndex"`
	ResolutionTransactionID *types.TransactionID `json:"resolutionTransactionID"`

	types.V2FileContractElement
}

A V2FileContract is a v2 file contract.

type V2FileContractRenewal

type V2FileContractRenewal struct {
	FinalRenterOutput types.SiacoinOutput `json:"finalRenterOutput"`
	FinalHostOutput   types.SiacoinOutput `json:"finalHostOutput"`
	RenterRollover    types.Currency      `json:"renterRollover"`
	HostRollover      types.Currency      `json:"hostRollover"`
	NewContract       V2FileContract      `json:"newContract"`

	// signatures cover above fields
	RenterSignature types.Signature `json:"renterSignature"`
	HostSignature   types.Signature `json:"hostSignature"`
}

A V2FileContractRenewal renews a file contract.

type V2FileContractResolution

type V2FileContractResolution struct {
	Parent     V2FileContract `json:"parent"`
	Type       string         `json:"string"`
	Resolution any            `json:"resolution"`
}

A V2FileContractResolution closes a v2 file contract's payment channel. There are four resolution types: renewwal, storage proof, finalization, and expiration.

type V2FileContractRevision

type V2FileContractRevision struct {
	Parent   V2FileContract `json:"parent"`
	Revision V2FileContract `json:"revision"`
}

A V2FileContractRevision is a V2 file contract revision with the explorer V2FileContract type.

type V2FileContractUpdate

type V2FileContractUpdate struct {
	FileContractElement types.V2FileContractElement
	Revision            *types.V2FileContractElement
	Resolution          types.V2FileContractResolutionType

	ConfirmationTransactionID *types.TransactionID
	ResolutionTransactionID   *types.TransactionID
}

V2FileContractUpdate represents a v2 file contract from a consensus update.

type V2HostAnnouncement

type V2HostAnnouncement struct {
	PublicKey types.PublicKey `json:"publicKey"`
	chain.V2HostAnnouncement
}

A V2HostAnnouncement is a types.V2HostAnnouncement list of net addresses with the host public key attached.

type V2Transaction

type V2Transaction struct {
	ID types.TransactionID `json:"id"`

	SiacoinInputs  []types.V2SiacoinInput `json:"siacoinInputs,omitempty"`
	SiacoinOutputs []SiacoinOutput        `json:"siacoinOutputs,omitempty"`
	SiafundInputs  []types.V2SiafundInput `json:"siafundInputs,omitempty"`
	SiafundOutputs []SiafundOutput        `json:"siafundOutputs,omitempty"`

	FileContracts           []V2FileContract           `json:"fileContracts,omitempty"`
	FileContractRevisions   []V2FileContractRevision   `json:"fileContractRevisions,omitempty"`
	FileContractResolutions []V2FileContractResolution `json:"fileContractResolutions,omitempty"`

	Attestations  []types.Attestation `json:"attestations,omitempty"`
	ArbitraryData []byte              `json:"arbitraryData,omitempty"`

	NewFoundationAddress *types.Address `json:"newFoundationAddress,omitempty"`
	MinerFee             types.Currency `json:"minerFee"`

	HostAnnouncements []V2HostAnnouncement `json:"hostAnnouncements,omitempty"`
}

A V2Transaction is a V2 transaction that uses the wrapped types above.

Jump to

Keyboard shortcuts

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