sia

package
v0.0.0-...-4ff40c0 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIClient

type APIClient struct {
	BaseAddress string
	AccessKey   string
	AuthToken   string
}

APIClient a client used to access the Sia Central API

func NewClient

func NewClient() *APIClient

NewClient creates a new API client

func (*APIClient) BroadcastTransactionSet

func (a *APIClient) BroadcastTransactionSet(transactions []types.Transaction) (err error)

BroadcastTransactionSet broadcasts the transaction set to the network

func (*APIClient) FindAddressBalance

func (a *APIClient) FindAddressBalance(limit, page int, addresses []string) (resp GetTransactionsResp, err error)

FindAddressBalance gets all unspent outputs and the last n transactions for a list of addresses

func (*APIClient) FindBlocksByHeight

func (a *APIClient) FindBlocksByHeight(heights ...uint64) (blocks []Block, err error)

FindBlocksByHeight returns all blocks with the specified heights from the Sia Central explorer

func (*APIClient) FindBlocksByID

func (a *APIClient) FindBlocksByID(ids ...string) (blocks []Block, err error)

FindBlocksByID returns all blocks with the specified ids from the Sia Central explorer

func (*APIClient) FindContractsByID

func (a *APIClient) FindContractsByID(ids ...string) (contracts []StorageContract, err error)

FindContractsByID returns all contracts with the specified ids from the Sia Central explorer

func (*APIClient) FindTransactionsByID

func (a *APIClient) FindTransactionsByID(ids ...string) (transactions []Transaction, err error)

FindTransactionsByID returns all transactions with the specified ids from the Sia Central explorer

func (*APIClient) FindUsedAddresses

func (a *APIClient) FindUsedAddresses(addresses []string) (used []AddressUsage, err error)

FindUsedAddresses gets all addresses that have been seen in a transaction on the blockchain

func (*APIClient) GetAPIFees

func (a *APIClient) GetAPIFees() (fee types.Currency, address string, err error)

GetAPIFees gets the current transaction fee and payout address of the Sia Central API

func (*APIClient) GetActiveHosts

func (a *APIClient) GetActiveHosts(page, limit int, filters ...HostFilter) (hosts []HostDetails, err error)

GetActiveHosts gets all Sia hosts that have been successfully scanned in the last 24 hours

func (*APIClient) GetAddressBalance

func (a *APIClient) GetAddressBalance(limit, page int, address string) (resp GetTransactionsResp, err error)

GetAddressBalance gets all unspent outputs and the last n transactions of an address

func (*APIClient) GetBlockByHeight

func (a *APIClient) GetBlockByHeight(height uint64) (block Block, err error)

GetBlockByHeight returns the block at the specified height in the Sia Central explorer

func (*APIClient) GetBlockByID

func (a *APIClient) GetBlockByID(id string) (block Block, err error)

GetBlockByID returns the block with the matching id in the Sia Central explorer

func (*APIClient) GetChainIndex

func (a *APIClient) GetChainIndex() (index ChainIndex, err error)

func (*APIClient) GetContractByID

func (a *APIClient) GetContractByID(id string) (contract StorageContract, err error)

GetContractByID returns the contract at the specified height in the Sia Central explorer

func (*APIClient) GetExchangeRate

func (a *APIClient) GetExchangeRate() (siacoin map[string]decimal.Decimal, siafund map[string]decimal.Decimal, err error)

GetExchangeRate gets the current market exchange rate for Siacoin and Siafund

func (*APIClient) GetHistoricalExchangeRate

func (a *APIClient) GetHistoricalExchangeRate(timestamp time.Time) (map[string]decimal.Decimal, error)

GetHistoricalExchangeRate gets the historical market exchange rate for Siacoins at the specified timestamp

func (*APIClient) GetHost

func (a *APIClient) GetHost(id string) (host HostDetails, err error)

GetHost finds a host matching the public key or netaddress

func (*APIClient) GetHostConnectivity

func (a *APIClient) GetHostConnectivity(netaddress string) (report ConnectionReport, err error)

GetHostConnectivity checks that a host is running and connectable at the provided netaddress

func (*APIClient) GetLatestBlock

func (a *APIClient) GetLatestBlock() (block Block, err error)

GetLatestBlock returns the latest block in the Sia Central explorer

func (*APIClient) GetNetworkAverages

func (a *APIClient) GetNetworkAverages() (settings HostConfig, rhp3Bench AvgHostBenchmark, rhp2Bench AvgHostBenchmark, err error)

GetNetworkAverages gets the average settings and benchmarks of all active hosts on the network

func (*APIClient) GetTransactionByID

func (a *APIClient) GetTransactionByID(id string) (transaction Transaction, err error)

GetTransactionByID returns the transaction at the specified height in the Sia Central explorer

func (*APIClient) GetTransactionFees

func (a *APIClient) GetTransactionFees() (min, max types.Currency, err error)

GetTransactionFees gets the current transaction fees of the Sia network

func (*APIClient) GetYearExchangeRate

func (a *APIClient) GetYearExchangeRate(timestamp time.Time) ([]ExchangeRate, error)

GetYearExchangeRate gets the rates for a full calendar year

type APIResponse

type APIResponse struct {
	Message string `json:"message"`
	Type    string `json:"type"`
}

APIResponse APIResponse

type AddressUsage

type AddressUsage struct {
	Address   string `json:"address"`
	UsageType string `json:"usage_type"`
}

AddressUsage AddressUsage

type Announcement

type Announcement struct {
	TransactionID string    `json:"transaction_id"`
	BlockID       string    `json:"block_id"`
	PublicKey     string    `json:"public_key"`
	NetAddress    string    `json:"net_address"`
	Height        uint64    `json:"block_height"`
	Timestamp     time.Time `json:"timestamp,omitempty"`
}

Announcement a host announcement on the blockchain

type AvgHostBenchmark

type AvgHostBenchmark struct {
	ContractTime uint64 `json:"contract_time"`
	UploadTime   uint64 `json:"upload_time"`
	DownloadTime uint64 `json:"download_time"`
	DataSize     uint64 `json:"data_size"`
}

AvgHostBenchmark AvgHostBenchmark

type Block

type Block struct {
	ID                string          `json:"id"`
	ParentID          string          `json:"parent_id"`
	Height            uint64          `json:"height"`
	Nonce             [8]byte         `json:"nonce"`
	Transactions      []Transaction   `json:"transactions"`
	HostAnnouncements []Announcement  `json:"host_announcements"`
	SiacoinOutputs    []SiacoinOutput `json:"siacoin_outputs"`
	Timestamp         time.Time       `json:"timestamp"`
}

Block a block on the Sia blockchain

type ChainIndex

type ChainIndex struct {
	ID       string `json:"id"`
	ParentID string `json:"parent_id"`
	Height   uint64 `json:"height"`
}

type ConnectionReport

type ConnectionReport struct {
	NetAddress    string               `json:"netaddress"`
	PublicKey     string               `json:"public_key"`
	ConnectedIP   string               `json:"connected_ip"`
	Resolved      bool                 `json:"resolved"`
	Announced     bool                 `json:"announced"`
	Connected     bool                 `json:"connected"`
	Scanned       bool                 `json:"scanned"`
	Latency       uint64               `json:"latency"`
	ResolvedIPs   []string             `json:"resolved_ips"`
	Settings      HostExternalSettings `json:"external_settings"`
	Announcements []Announcement       `json:"announcements"`
	Errors        []ScanError          `json:"errors"`
}

ConnectionReport information about the connection

type CoveredFields

type CoveredFields struct {
	WholeTransaction         bool     `json:"whole_transaction"`
	SiacoinInputs            []uint64 `json:"siacoin_inputs"`
	SiacoinOutputs           []uint64 `json:"siacoin_outputs"`
	StorageContracts         []uint64 `json:"storage_contracts"`
	StorageContractRevisions []uint64 `json:"storage_contract_revisions"`
	StorageProofs            []uint64 `json:"storage_proofs"`
	MinerFees                []uint64 `json:"miner_fees"`
	ArbitraryData            []uint64 `json:"arbitrary_data"`
	TransactionSignatures    []uint64 `json:"transaction_signatures"`
}

CoveredFields the covered fields of a transaction signature and their indexes

type ExchangeRate

type ExchangeRate struct {
	Currency  string                     `json:"currency"`
	Rates     map[string]decimal.Decimal `json:"rates"`
	Timestamp time.Time                  `json:"timestamp"`
}

type GetTransactionsResp

type GetTransactionsResp struct {
	APIResponse
	UnspentSiacoins         types.Currency  `json:"unspent_siacoins"`
	UnspentSiafunds         types.Currency  `json:"unspent_siafunds"`
	UnspentSiacoinOutputs   []SiacoinOutput `json:"unspent_siacoin_outputs"`
	UnspentSiafundOutputs   []SiafundOutput `json:"unspent_siafund_outputs"`
	Transactions            []Transaction   `json:"transactions"`
	UnconfirmedTransactions []Transaction   `json:"unconfirmed_transactions"`
	SiafundClaim            types.Currency  `json:"siafund_claim"`
}

GetTransactionsResp holds balance and transactions for an address or set of addresses

type HTTPMethod

type HTTPMethod string

HTTPMethod an http method

type HostBenchmark

type HostBenchmark struct {
	ContractTime   uint64    `json:"contract_time"`
	UploadTime     uint64    `json:"upload_time"`
	DownloadTime   uint64    `json:"download_time"`
	DataSize       uint64    `json:"data_size"`
	LastAttempt    time.Time `json:"last_attempt"`
	LastSuccessful time.Time `json:"last_successful"`
	ErrorMessage   *string   `json:"error"`
}

HostBenchmark a benchmark from the host

type HostConfig

type HostConfig struct {
	MaxDownloadBatchSize   uint64         `json:"max_download_batch_size"`
	MaxDuration            uint64         `json:"max_duration"`
	MaxReviseBatchSize     uint64         `json:"max_revise_batch_size"`
	RemainingStorage       uint64         `json:"remaining_storage"`
	SectorSize             uint64         `json:"sector_size"`
	TotalStorage           uint64         `json:"total_storage"`
	WindowSize             uint64         `json:"window_size"`
	RevisionNumber         uint64         `json:"revision_number"`
	BaseRPCPrice           types.Currency `json:"base_rpc_price"`
	Collateral             types.Currency `json:"collateral"`
	MaxCollateral          types.Currency `json:"max_collateral"`
	ContractPrice          types.Currency `json:"contract_price"`
	DownloadBandwidthPrice types.Currency `json:"download_price"`
	SectorAccessPrice      types.Currency `json:"sector_access_price"`
	StoragePrice           types.Currency `json:"storage_price"`
	UploadBandwidthPrice   types.Currency `json:"upload_price"`
}

HostConfig the settings pulled from the host during a scan

type HostDetails

type HostDetails struct {
	NetAddress         string                 `json:"net_address"`
	PublicKey          string                 `json:"public_key"`
	Version            string                 `json:"version"`
	EstimatedUptime    float32                `json:"estimated_uptime"`
	Online             bool                   `json:"online"`
	FirstSeenHeight    uint64                 `json:"first_seen_height"`
	FirstSeenTimestamp time.Time              `json:"first_seen_timestamp"`
	LastScan           time.Time              `json:"last_scan"`
	LastSuccessScan    time.Time              `json:"last_success_scan"`
	Settings           *HostExternalSettings  `json:"settings"`
	PriceTable         *modules.RPCPriceTable `json:"price_table"`
	Benchmark          *HostBenchmark         `json:"benchmark"`
	BenchmarkRHP2      *HostBenchmark         `json:"benchmark_rhp2"`
}

HostDetails the latest details on the host

type HostExternalSettings

type HostExternalSettings struct {
	NetAddress             string         `json:"netaddress"`
	Version                string         `json:"version"`
	AcceptingContracts     bool           `json:"accepting_contracts"`
	MaxDownloadBatchSize   uint64         `json:"max_download_batch_size"`
	MaxDuration            uint64         `json:"max_duration"`
	MaxReviseBatchSize     uint64         `json:"max_revise_batch_size"`
	RemainingStorage       uint64         `json:"remaining_storage"`
	SectorSize             uint64         `json:"sector_size"`
	TotalStorage           uint64         `json:"total_storage"`
	WindowSize             uint64         `json:"window_size"`
	RevisionNumber         uint64         `json:"revision_number"`
	BaseRPCPrice           types.Currency `json:"base_rpc_price"`
	Collateral             types.Currency `json:"collateral"`
	MaxCollateral          types.Currency `json:"max_collateral"`
	ContractPrice          types.Currency `json:"contract_price"`
	DownloadBandwidthPrice types.Currency `json:"download_price"`
	SectorAccessPrice      types.Currency `json:"sector_access_price"`
	StoragePrice           types.Currency `json:"storage_price"`
	UploadBandwidthPrice   types.Currency `json:"upload_price"`
}

HostExternalSettings the settings pulled from the host during a scan

type HostFilter

type HostFilter func(url.Values)

func HostFilterAcceptingContracts

func HostFilterAcceptingContracts(accepting bool) HostFilter

HostFilterAcceptingContracts sets the accepting contracts parameter for the host's query

func HostFilterBenchmarked

func HostFilterBenchmarked(benchmarked bool) HostFilter

HostFilterBenchmarked sets the benchmark parameter for the host's query

func HostFilterMaxBaseRPCPrice

func HostFilterMaxBaseRPCPrice(price types.Currency) HostFilter

HostFilterMaxBaseRPCPrice sets the max base RPC price for the host query

func HostFilterMaxContractPrice

func HostFilterMaxContractPrice(price types.Currency) HostFilter

HostFilterMaxContractPrice sets the max contract price for the host query

func HostFilterMaxDownloadPrice

func HostFilterMaxDownloadPrice(price types.Currency) HostFilter

HostFilterMaxDownloadPrice sets the max download price for the host query

func HostFilterMaxStoragePrice

func HostFilterMaxStoragePrice(price types.Currency) HostFilter

HostFilterMaxStoragePrice sets the max storage price for the host query

func HostFilterMaxUploadPrice

func HostFilterMaxUploadPrice(price types.Currency) HostFilter

HostFilterMaxUploadPrice sets the max upload price for the host query

func HostFilterMinAge

func HostFilterMinAge(age uint64) HostFilter

HostFilterMinAge sets the min age for the host query

func HostFilterMinDownloadSpeed

func HostFilterMinDownloadSpeed(minDownloadSpeed uint64) HostFilter

HostFilterMinDownloadSpeed sets the min download speed for the host query

func HostFilterMinDuration

func HostFilterMinDuration(minDuration uint64) HostFilter

HostFilterMinDuration sets the min contract duration for the host query

func HostFilterMinStorage

func HostFilterMinStorage(minStorage uint64) HostFilter

HostFilterMinStorage sets the min available storage for the host query

func HostFilterMinUploadSpeed

func HostFilterMinUploadSpeed(minUploadSpeed uint64) HostFilter

HostFilterMinUploadSpeed sets the min upload speed for the host query

func HostFilterMinUptime

func HostFilterMinUptime(minUptime float64) HostFilter

HostFilterMinUptime sets the min uptime for the host query

func HostFilterOnline

func HostFilterOnline(online bool) HostFilter

HostFilterOnline sets the online parameter for the host's query

func HostFilterSectorAccessPrice

func HostFilterSectorAccessPrice(price types.Currency) HostFilter

HostFilterSectorAccessPrice sets the sector access price for the host query

func HostFilterSort

func HostFilterSort(field HostSort, desc bool) HostFilter

HostFilterSort sets the sort order for the host's query

type HostSort

type HostSort string
var (
	HostSortDateCreated        HostSort = "date_created"
	HostSortNetAddress         HostSort = "net_address"
	HostSortPublicKey          HostSort = "public_key"
	HostSortAcceptingContracts HostSort = "accepting_contracts"
	HostSortUptime             HostSort = "uptime"
	HostSortUploadSpeed        HostSort = "upload_speed"
	HostSortDownloadSpeed      HostSort = "download_speed"
	HostSortRemainingStorage   HostSort = "remaining_storage"
	HostSortTotalStorage       HostSort = "total_storage"
	HostSortUsedStorage        HostSort = "used_storage"
	HostSortAge                HostSort = "age"
	HostSortUtilization        HostSort = "utilization"
	HostSortContractPrice      HostSort = "contract_price"
	HostSortStoragePrice       HostSort = "storage_price"
	HostSortDownloadPrice      HostSort = "download_price"
	HostSortUploadPrice        HostSort = "upload_price"
)

type RPCPriceTable

type RPCPriceTable struct {
	// UID is a specifier that uniquely identifies this price table
	UID UniqueID `json:"uid"`

	// Validity is a duration that specifies how long the host guarantees these
	// prices for and are thus considered valid.
	Validity time.Duration `json:"validity"`

	// HostBlockHeight is the block height of the host. This allows the renter
	// to create valid withdrawal messages in case it is not synced yet.
	HostBlockHeight types.BlockHeight `json:"hostblockheight"`

	// UpdatePriceTableCost refers to the cost of fetching a new price table
	// from the host.
	UpdatePriceTableCost types.Currency `json:"updatepricetablecost"`

	// AccountBalanceCost refers to the cost of fetching the balance of an
	// ephemeral account.
	AccountBalanceCost types.Currency `json:"accountbalancecost"`

	// FundAccountCost refers to the cost of funding an ephemeral account on the
	// host.
	FundAccountCost types.Currency `json:"fundaccountcost"`

	// LatestRevisionCost refers to the cost of asking the host for the latest
	// revision of a contract.
	// TODO: should this be free?
	LatestRevisionCost types.Currency `json:"latestrevisioncost"`

	// SubscriptionMemoryCost is the cost of storing a byte of data for
	// SubscriptionPeriod time.
	SubscriptionMemoryCost types.Currency `json:"subscriptionmemorycost"`

	// SubscriptionNotificationCost is the cost of a single notification on top
	// of what is charged for bandwidth.
	SubscriptionNotificationCost types.Currency `json:"subscriptionnotificationcost"`

	// MDM related costs
	//
	// InitBaseCost is the amount of cost that is incurred when an MDM program
	// starts to run. This doesn't include the memory used by the program data.
	// The total cost to initialize a program is calculated as
	// InitCost = InitBaseCost + MemoryTimeCost * Time
	InitBaseCost types.Currency `json:"initbasecost"`

	// MemoryTimeCost is the amount of cost per byte per time that is incurred
	// by the memory consumption of the program.
	MemoryTimeCost types.Currency `json:"memorytimecost"`

	// Cost values specific to the bandwidth consumption.
	DownloadBandwidthCost types.Currency `json:"downloadbandwidthcost"`
	UploadBandwidthCost   types.Currency `json:"uploadbandwidthcost"`

	// Cost values specific to the DropSectors instruction.
	DropSectorsBaseCost types.Currency `json:"dropsectorsbasecost"`
	DropSectorsUnitCost types.Currency `json:"dropsectorsunitcost"`

	// Cost values specific to the HasSector command.
	HasSectorBaseCost types.Currency `json:"hassectorbasecost"`

	// Cost values specific to the Read instruction.
	ReadBaseCost   types.Currency `json:"readbasecost"`
	ReadLengthCost types.Currency `json:"readlengthcost"`

	// Cost values specific to the RenewContract instruction.
	RenewContractCost types.Currency `json:"renewcontractcost"`

	// Cost values specific to the Revision command.
	RevisionBaseCost types.Currency `json:"revisionbasecost"`

	// SwapSectorCost is the cost of swapping 2 full sectors by root.
	SwapSectorCost types.Currency `json:"swapsectorcost"`

	// Cost values specific to the Write instruction.
	WriteBaseCost   types.Currency `json:"writebasecost"`   // per write
	WriteLengthCost types.Currency `json:"writelengthcost"` // per byte written
	WriteStoreCost  types.Currency `json:"writestorecost"`  // per byte / block of additional storage

	// TxnFee estimations.
	TxnFeeMinRecommended types.Currency `json:"txnfeeminrecommended"`
	TxnFeeMaxRecommended types.Currency `json:"txnfeemaxrecommended"`

	// ContractPrice is the additional fee a host charges when forming/renewing
	// a contract to cover the miner fees when submitting the contract and
	// revision to the blockchain.
	ContractPrice types.Currency `json:"contractprice"`

	// CollateralCost is the amount of money per byte the host is promising to
	// lock away as collateral when adding new data to a contract. It's paid out
	// to the host regardless of the outcome of the storage proof.
	CollateralCost types.Currency `json:"collateralcost"`

	// MaxCollateral is the maximum amount of collateral the host is willing to
	// put into a single file contract.
	MaxCollateral types.Currency `json:"maxcollateral"`

	// MaxDuration is the max duration for which the host is willing to form a
	// contract.
	MaxDuration types.BlockHeight `json:"maxduration"`

	// WindowSize is the minimum time in blocks the host requests the
	// renewWindow of a new contract to be.
	WindowSize types.BlockHeight `json:"windowsize"`

	// Registry related fields.
	RegistryEntriesLeft  uint64 `json:"registryentriesleft"`
	RegistryEntriesTotal uint64 `json:"registryentriestotal"`
}

RPCPriceTable contains the cost of executing a RPC on a host. Each host can set its own prices for the individual MDM instructions and RPC costs.

type ScanError

type ScanError struct {
	Severity    string   `json:"severity"`
	Type        string   `json:"type"`
	Message     string   `json:"message"`
	Reasons     []string `json:"reasons"`
	Resolutions []string `json:"resolutions"`
}

ScanError an error connecting to the host

type SiacoinInput

type SiacoinInput struct {
	SiacoinOutput
	UnlockConditions UnlockCondition `json:"unlock_conditions"`
}

SiacoinInput an input of siacoins for a transaction

type SiacoinOutput

type SiacoinOutput struct {
	OutputID           string         `json:"output_id"`
	UnlockHash         string         `json:"unlock_hash"`
	Source             string         `json:"source"`
	SpentTransactionID string         `json:"spent_transaction_id"`
	MaturityHeight     uint64         `json:"maturity_height"`
	BlockHeight        uint64         `json:"block_height"`
	Value              types.Currency `json:"value"`
}

SiacoinOutput an output of siacoins for a transaction

type SiafundInput

type SiafundInput struct {
	SiafundOutput
	ClaimUnlockHash  string          `json:"claim_unlock_hash"`
	UnlockConditions UnlockCondition `json:"unlock_conditions"`
}

SiafundInput an input of siafunds for a transaction

type SiafundOutput

type SiafundOutput struct {
	OutputID           string         `json:"output_id"`
	BlockID            string         `json:"block_id"`
	SpentTransactionID string         `json:"spent_transaction_id"`
	UnlockHash         string         `json:"unlock_hash"`
	BlockHeight        uint64         `json:"block_height"`
	Value              types.Currency `json:"value"`
	ClaimStart         types.Currency `json:"claim_start"`
	ClaimValue         types.Currency `json:"claim_value"`
}

SiafundOutput an output of siafunds for a transaction

type StorageContract

type StorageContract struct {
	ID                     string            `json:"id"`
	BlockID                string            `json:"block_id"`
	TransactionID          string            `json:"transaction_id"`
	MerkleRoot             string            `json:"merkle_root"`
	UnlockHash             string            `json:"unlock_hash"`
	Status                 string            `json:"status"`
	RevisionNumber         uint64            `json:"revision_number"`
	NegotiationHeight      uint64            `json:"negotiation_height"`
	ExpirationHeight       uint64            `json:"expiration_height"`
	ProofDeadline          uint64            `json:"proof_deadline"`
	ProofHeight            uint64            `json:"proof_height"`
	Payout                 types.Currency    `json:"payout"`
	FileSize               types.Currency    `json:"file_size"`
	ValidProofOutputs      []SiacoinOutput   `json:"valid_proof_outputs"`
	MissedProofOutputs     []SiacoinOutput   `json:"missed_proof_outputs"`
	NegotiationTimestamp   time.Time         `json:"negotiation_timestamp"`
	ExpirationTimestamp    time.Time         `json:"expiration_timestamp"`
	ProofDeadlineTimestamp time.Time         `json:"proof_deadline_timestamp"`
	ProofTimestamp         time.Time         `json:"proof_timestamp"`
	ProofConfirmed         bool              `json:"proof_confirmed"`
	Unused                 bool              `json:"unused"`
	PreviousRevisions      []StorageContract `json:"previous_revisions"`
}

StorageContract a storage contract on the blockchain

type StorageProof

type StorageProof struct {
	ContractID    string    `json:"contract_id"`
	TransactionID string    `json:"transaction_id"`
	BlockID       string    `json:"block_id"`
	BlockHeight   uint64    `json:"block_height"`
	Segment       [64]byte  `json:"segment"`
	Hashset       []string  `json:"hashset"`
	Timestamp     time.Time `json:"timestamp"`
}

StorageProof a storage proof on the blockchain

type Transaction

type Transaction struct {
	ID                    string                 `json:"id"`
	BlockID               string                 `json:"block_id"`
	BlockHeight           uint64                 `json:"block_height,omitempty"`
	Confirmations         uint64                 `json:"confirmations"`
	BlockIndex            int                    `json:"-"`
	Timestamp             time.Time              `json:"timestamp"`
	Fees                  types.Currency         `json:"fees"`
	SiacoinInputs         []SiacoinInput         `json:"siacoin_inputs"`
	SiacoinOutputs        []SiacoinOutput        `json:"siacoin_outputs"`
	SiafundInputs         []SiafundInput         `json:"siafund_inputs"`
	SiafundOutputs        []SiafundOutput        `json:"siafund_outputs"`
	StorageContracts      []StorageContract      `json:"storage_contracts"`
	ContractRevisions     []StorageContract      `json:"contract_revisions"`
	StorageProofs         []StorageProof         `json:"storage_proofs"`
	MinerFees             []types.Currency       `json:"miner_fees"`
	HostAnnouncements     []Announcement         `json:"host_announcements"`
	ArbitraryData         [][]byte               `json:"arbitrary_data"`
	TransactionSignatures []TransactionSignature `json:"transaction_signatures"`
}

Transaction a transaction on the blockchain

type TransactionSignature

type TransactionSignature struct {
	ParentID       string        `json:"parent_id"`
	TransactionID  string        `json:"transaction_id"`
	BlockID        string        `json:"block_id"`
	Signature      string        `json:"signature"`
	PublicKeyIndex uint64        `json:"public_key_index"`
	CoveredFields  CoveredFields `json:"covered_fields"`
}

TransactionSignature a signature verifying a part of the transaction

type UniqueID

type UniqueID types.Specifier

UniqueID is a unique identifier

func (UniqueID) MarshalJSON

func (uid UniqueID) MarshalJSON() ([]byte, error)

MarshalJSON marshals an id as a hex string.

func (UniqueID) String

func (uid UniqueID) String() string

String prints the uid in hex.

type UnlockCondition

type UnlockCondition struct {
	PublicKeys         []string `json:"public_keys"`
	Timelock           uint64   `json:"timelock"`
	RequiredSignatures uint64   `json:"required_signatures"`
}

UnlockCondition unlock conditions of a transaction input

Jump to

Keyboard shortcuts

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