Documentation ¶
Index ¶
- Constants
- func SplitBalanceEqually(splitNumber int, balance iotago.BaseToken) []iotago.BaseToken
- func WithAccountsWallet(wallet *accountwallet.AccountWallet) options.Option[EvilWallet]
- func WithClients(urls ...string) options.Option[EvilWallet]
- type AliasManager
- func (a *AliasManager) AddInputAlias(input *models.Output, aliasName string)
- func (a *AliasManager) AddInputAliases(inputs []*models.Output, aliases []string) error
- func (a *AliasManager) AddOutputAlias(output *models.Output, aliasName string)
- func (a *AliasManager) AddOutputAliases(outputs []*models.Output, aliases []string) error
- func (a *AliasManager) ClearAliases(aliases ScenarioAlias)
- func (a *AliasManager) ClearAllAliases()
- func (a *AliasManager) GetInput(aliasName string) (*models.Output, bool)
- func (a *AliasManager) GetOutput(aliasName string) *models.Output
- type ConflictSlice
- type EvilBatch
- func ConflictSetCircle(size int) EvilBatch
- func GetScenario(scenarioName string) (batch EvilBatch, ok bool)
- func NSpendBatch(nSpent int) EvilBatch
- func NoConflictsScenario1() EvilBatch
- func Scenario1() EvilBatch
- func Scenario2() EvilBatch
- func Scenario3() EvilBatch
- func Scenario4() EvilBatch
- func Scenario5() EvilBatch
- func Scenario6() EvilBatch
- func Scenario7() EvilBatch
- func SingleTransactionBatch() EvilBatch
- type EvilScenario
- type EvilWallet
- func (e *EvilWallet) AddClient(clientURL string)
- func (e *EvilWallet) ClearAliases(aliases ScenarioAlias)
- func (e *EvilWallet) ClearAllAliases()
- func (e *EvilWallet) Connector() models.Connector
- func (e *EvilWallet) CreateTransaction(options ...Option) (*models.PayloadIssuanceData, error)
- func (e *EvilWallet) GetAccount(alias string) (blockhandler.Account, error)
- func (e *EvilWallet) GetClients(num int) []models.Client
- func (e *EvilWallet) LastFaucetUnspentOutput() iotago.OutputID
- func (e *EvilWallet) NewWallet(wType ...WalletType) *Wallet
- func (e *EvilWallet) NumOfClient() int
- func (e *EvilWallet) PrepareAccountSpam(scenario *EvilScenario, strategy *models.IssuancePaymentStrategy) (*models.PayloadIssuanceData, ScenarioAlias, error)
- func (e *EvilWallet) PrepareAndPostBlock(clt models.Client, payload iotago.Payload, ...) (iotago.BlockID, error)
- func (e *EvilWallet) PrepareCustomConflicts(conflictsMaps []ConflictSlice) (conflictBatch [][]*models.PayloadIssuanceData, err error)
- func (e *EvilWallet) PrepareCustomConflictsSpam(scenario *EvilScenario, strategy *models.IssuancePaymentStrategy) (txsData [][]*models.PayloadIssuanceData, allAliases ScenarioAlias, err error)
- func (e *EvilWallet) RemoveClient(clientURL string)
- func (e *EvilWallet) RequestFreshBigFaucetWallet() error
- func (e *EvilWallet) RequestFreshBigFaucetWallets(numberOfWallets int)
- func (e *EvilWallet) RequestFreshFaucetWallet() error
- func (e *EvilWallet) RequestFundsFromFaucet(options ...FaucetRequestOption) (initWallet *Wallet, err error)
- func (e *EvilWallet) SetTxOutputsSolid(outputs iotago.OutputIDs, clientID string)
- func (e *EvilWallet) UnspentOutputsLeft(walletType WalletType) int
- type FaucetRequestOption
- type FaucetRequestOptions
- type Option
- func WithInputWallet(issuer *Wallet) Option
- func WithInputs(inputs interface{}) Option
- func WithIssuanceStrategy(strategy models.AllotmentStrategy, issuerID iotago.AccountID) Option
- func WithIssuingTime(issuingTime time.Time) Option
- func WithOutputBatchAliases(outputAliases map[string]types.Empty) Option
- func WithOutputWallet(wallet *Wallet) Option
- func WithOutputs(outputsOptions []*OutputOption) Option
- func WithReuseOutputs() Option
- type Options
- type OutputManager
- func (o *OutputManager) AddOutput(w *Wallet, output *models.Output) *models.Output
- func (o *OutputManager) AwaitOutputToBeAccepted(outputID iotago.OutputID, waitFor time.Duration) (accepted bool)
- func (o *OutputManager) AwaitOutputToBeSolid(outID iotago.OutputID, clt models.Client, waitFor time.Duration) error
- func (o *OutputManager) AwaitOutputsToBeSolid(outputs iotago.OutputIDs, clt models.Client, maxGoroutines int) (allSolid bool)
- func (o *OutputManager) AwaitTransactionToBeAccepted(txID iotago.TransactionID, waitFor time.Duration) error
- func (o *OutputManager) AwaitTransactionsConfirmation(txIDs ...iotago.TransactionID)
- func (o *OutputManager) AwaitWalletOutputsToBeConfirmed(wallet *Wallet)
- func (o *OutputManager) GetOutput(outputID iotago.OutputID) (output *models.Output)
- func (o *OutputManager) IssuerSolidOutIDMap(issuer string, outputID iotago.OutputID) (isSolid bool)
- func (o *OutputManager) OutputIDAddrMap(outputID string) (addr string)
- func (o *OutputManager) OutputIDWalletMap(outputID string) *Wallet
- func (o *OutputManager) RequestOutputsByTxID(txID iotago.TransactionID) (outputIDs iotago.OutputIDs)
- func (o *OutputManager) SetOutputIDSolidForIssuer(outputID iotago.OutputID, issuer string)
- func (o *OutputManager) Track(outputIDs ...iotago.OutputID) (allConfirmed bool)
- type OutputOption
- type ScenarioAlias
- type ScenarioOption
- type Wallet
- func (w *Wallet) AddReuseAddress(addr string)
- func (w *Wallet) AddUnspentOutput(output *models.Output)
- func (w *Wallet) AddrIndexMap(address string) uint64
- func (w *Wallet) Address() *iotago.Ed25519Address
- func (w *Wallet) AddressOnIndex(index uint64) *iotago.Ed25519Address
- func (w *Wallet) AddressSigner(addr *iotago.Ed25519Address) iotago.AddressSigner
- func (w *Wallet) GetReuseAddress() string
- func (w *Wallet) GetUnspentOutput() *models.Output
- func (w *Wallet) IndexAddrMap(outIndex uint64) string
- func (w *Wallet) IsEmpty() (empty bool)
- func (w *Wallet) KeyPair(index uint64) (ed25519.PrivateKey, ed25519.PublicKey)
- func (w *Wallet) Type() WalletType
- func (w *Wallet) UnspentOutput(addr string) *models.Output
- func (w *Wallet) UnspentOutputBalance(addr string) iotago.BaseToken
- func (w *Wallet) UnspentOutputs() (outputs map[string]*models.Output)
- func (w *Wallet) UnspentOutputsLeft() (left int)
- func (w *Wallet) UnspentOutputsLength() int
- type WalletStatus
- type WalletType
- type Wallets
- func (w *Wallets) GetNextWallet(walletType WalletType, minOutputsLeft int) (*Wallet, error)
- func (w *Wallets) GetUnspentOutput(wallet *Wallet) *models.Output
- func (w *Wallets) GetWallet(walletID walletID) *Wallet
- func (w *Wallets) IsFaucetWalletAvailable() bool
- func (w *Wallets) NewWallet(walletType WalletType) *Wallet
- func (w *Wallets) SetWalletReady(wallet *Wallet)
- func (w *Wallets) UnspentOutputsLeft(walletType WalletType) int
Constants ¶
const (
// FaucetRequestSplitNumber defines the number of outputs to split from a faucet request.
FaucetRequestSplitNumber = 100
)
Variables ¶
This section is empty.
Functions ¶
func SplitBalanceEqually ¶
SplitBalanceEqually splits the balance equally between `splitNumber` outputs.
func WithAccountsWallet ¶
func WithAccountsWallet(wallet *accountwallet.AccountWallet) options.Option[EvilWallet]
func WithClients ¶
func WithClients(urls ...string) options.Option[EvilWallet]
Types ¶
type AliasManager ¶
type AliasManager struct {
// contains filtered or unexported fields
}
AliasManager is the manager for output aliases.
func NewAliasManager ¶
func NewAliasManager() *AliasManager
NewAliasManager creates and returns a new AliasManager.
func (*AliasManager) AddInputAlias ¶
func (a *AliasManager) AddInputAlias(input *models.Output, aliasName string)
AddInputAlias adds an input alias.
func (*AliasManager) AddInputAliases ¶
func (a *AliasManager) AddInputAliases(inputs []*models.Output, aliases []string) error
AddInputAliases batch adds the inputs their respective aliases.
func (*AliasManager) AddOutputAlias ¶
func (a *AliasManager) AddOutputAlias(output *models.Output, aliasName string)
AddOutputAlias maps the given outputAliasName to output, if there's duplicate outputAliasName, it will be overwritten.
func (*AliasManager) AddOutputAliases ¶
func (a *AliasManager) AddOutputAliases(outputs []*models.Output, aliases []string) error
AddOutputAliases batch adds the outputs their respective aliases.
func (*AliasManager) ClearAliases ¶
func (a *AliasManager) ClearAliases(aliases ScenarioAlias)
ClearAliases clears provided aliases.
func (*AliasManager) ClearAllAliases ¶
func (a *AliasManager) ClearAllAliases()
ClearAllAliases clears all aliases.
type ConflictSlice ¶
type ConflictSlice [][]Option
ConflictSlice represents a set of conflict transactions.
type EvilBatch ¶
type EvilBatch [][]ScenarioAlias
func ConflictSetCircle ¶
ConflictSetCircle creates a circular conflict set for a given size, e.g. for size=3, conflict set: A-B-C-A.
func GetScenario ¶
GetScenario returns an evil batch based i=on its name.
func NSpendBatch ¶
func NoConflictsScenario1 ¶
func NoConflictsScenario1() EvilBatch
NoConflictsScenario1 returns batch with no conflicts that is 3 levels deep.
func Scenario1 ¶
func Scenario1() EvilBatch
Scenario1 describes two double spends and aggregates them.
func Scenario2 ¶
func Scenario2() EvilBatch
Scenario2 is a reflection of UTXO unit test scenario example B - packages/ledgerstate/utxo_dag_test_exampleB.png.
func Scenario3 ¶
func Scenario3() EvilBatch
Scenario3 is a reflection of UTXO unit test scenario example C - packages/ledgerstate/utxo_dag_test_exampleC.png.
func Scenario4 ¶
func Scenario4() EvilBatch
Scenario4 is a reflection of ledgerstate unit test for conflict confirmation - packages/ledgerstate/ledgerstate_test_SetConflictConfirmed.png.
func Scenario5 ¶
func Scenario5() EvilBatch
Scenario5 uses ConflictSetCircle with size 4 and aggregate its outputs.
func Scenario7 ¶
func Scenario7() EvilBatch
Scenario7 three level deep scenario, with two separate conflict sets aggregated.
func SingleTransactionBatch ¶
func SingleTransactionBatch() EvilBatch
SingleTransactionBatch returns an EvilBatch that is a single transaction.
type EvilScenario ¶
type EvilScenario struct { ID string // provides a user-friendly way of listing input and output aliases ConflictBatch EvilBatch // determines whether outputs of the batch should be reused during the spam to create deep UTXO tree structure. Reuse bool // specifies the output type of the spam, if not provided, defaults to BasicOutput OutputType iotago.OutputType // if provided, the outputs from the spam will be saved into this wallet, accepted types of wallet: Reuse, RestrictedReuse. // if type == Reuse, then wallet is available for reuse spamming scenarios that did not provide RestrictedWallet. OutputWallet *Wallet // if provided and reuse set to true, outputs from this wallet will be used for deep spamming, allows for controllable building of UTXO deep structures. // if not provided evil wallet will use Reuse wallet if any is available. Accepts only RestrictedReuse wallet type. RestrictedInputWallet *Wallet // used together with scenario ID to create a prefix for distinct batch alias creation BatchesCreated *atomic.Uint64 // used to determine how many clients are needed to run this scenario, some double spends need more than one client to pass the filter NumOfClientsNeeded int }
func NewEvilScenario ¶
func NewEvilScenario(options ...ScenarioOption) *EvilScenario
func (*EvilScenario) ConflictBatchWithPrefix ¶
func (e *EvilScenario) ConflictBatchWithPrefix() (prefixedBatch EvilBatch, allAliases ScenarioAlias, batchOutputs map[string]types.Empty)
ConflictBatchWithPrefix generates a new conflict batch with scenario prefix created from scenario ID and batch count. BatchOutputs are outputs of the batch that can be reused in deep spamming by collecting them in Reuse wallet.
type EvilWallet ¶
type EvilWallet struct {
// contains filtered or unexported fields
}
EvilWallet provides a user-friendly way to do complicated double spend scenarios.
func NewEvilWallet ¶
func NewEvilWallet(opts ...options.Option[EvilWallet]) *EvilWallet
NewEvilWallet creates an EvilWallet instance.
func (*EvilWallet) AddClient ¶
func (e *EvilWallet) AddClient(clientURL string)
func (*EvilWallet) ClearAliases ¶
func (e *EvilWallet) ClearAliases(aliases ScenarioAlias)
ClearAliases remove only provided aliases from AliasManager.
func (*EvilWallet) ClearAllAliases ¶
func (e *EvilWallet) ClearAllAliases()
ClearAllAliases remove all registered alias names.
func (*EvilWallet) Connector ¶
func (e *EvilWallet) Connector() models.Connector
Connector give access to the EvilWallet connector.
func (*EvilWallet) CreateTransaction ¶
func (e *EvilWallet) CreateTransaction(options ...Option) (*models.PayloadIssuanceData, error)
CreateTransaction creates a transaction based on provided options. If no input wallet is provided, the next non-empty faucet wallet is used. Inputs of the transaction are determined in three ways: 1 - inputs are provided directly without associated alias, 2- alias is provided, and input is already stored in an alias manager, 3 - alias is provided, and there are no inputs assigned in Alias manager, so aliases are assigned to next ready inputs from input wallet.
func (*EvilWallet) GetAccount ¶
func (e *EvilWallet) GetAccount(alias string) (blockhandler.Account, error)
func (*EvilWallet) GetClients ¶
func (e *EvilWallet) GetClients(num int) []models.Client
GetClients returns the given number of clients.
func (*EvilWallet) LastFaucetUnspentOutput ¶
func (e *EvilWallet) LastFaucetUnspentOutput() iotago.OutputID
func (*EvilWallet) NewWallet ¶
func (e *EvilWallet) NewWallet(wType ...WalletType) *Wallet
NewWallet creates a new wallet of the given wallet type.
func (*EvilWallet) NumOfClient ¶
func (e *EvilWallet) NumOfClient() int
func (*EvilWallet) PrepareAccountSpam ¶
func (e *EvilWallet) PrepareAccountSpam(scenario *EvilScenario, strategy *models.IssuancePaymentStrategy) (*models.PayloadIssuanceData, ScenarioAlias, error)
func (*EvilWallet) PrepareAndPostBlock ¶
func (e *EvilWallet) PrepareAndPostBlock(clt models.Client, payload iotago.Payload, congestionResp *apimodels.CongestionResponse, issuer blockhandler.Account) (iotago.BlockID, error)
func (*EvilWallet) PrepareCustomConflicts ¶
func (e *EvilWallet) PrepareCustomConflicts(conflictsMaps []ConflictSlice) (conflictBatch [][]*models.PayloadIssuanceData, err error)
func (*EvilWallet) PrepareCustomConflictsSpam ¶
func (e *EvilWallet) PrepareCustomConflictsSpam(scenario *EvilScenario, strategy *models.IssuancePaymentStrategy) (txsData [][]*models.PayloadIssuanceData, allAliases ScenarioAlias, err error)
func (*EvilWallet) RemoveClient ¶
func (e *EvilWallet) RemoveClient(clientURL string)
func (*EvilWallet) RequestFreshBigFaucetWallet ¶
func (e *EvilWallet) RequestFreshBigFaucetWallet() error
RequestFreshBigFaucetWallet creates a new wallet and fills the wallet with 1000 outputs created from funds requested from the Faucet.
func (*EvilWallet) RequestFreshBigFaucetWallets ¶
func (e *EvilWallet) RequestFreshBigFaucetWallets(numberOfWallets int)
RequestFreshBigFaucetWallets creates n new wallets, each wallet is created from one faucet request and contains 1000 outputs.
func (*EvilWallet) RequestFreshFaucetWallet ¶
func (e *EvilWallet) RequestFreshFaucetWallet() error
RequestFreshFaucetWallet creates a new wallet and fills the wallet with 100 outputs created from funds requested from the Faucet.
func (*EvilWallet) RequestFundsFromFaucet ¶
func (e *EvilWallet) RequestFundsFromFaucet(options ...FaucetRequestOption) (initWallet *Wallet, err error)
RequestFundsFromFaucet requests funds from the faucet, then track the confirmed status of unspent output, also register the alias name for the unspent output if provided.
func (*EvilWallet) SetTxOutputsSolid ¶
func (e *EvilWallet) SetTxOutputsSolid(outputs iotago.OutputIDs, clientID string)
SetTxOutputsSolid marks all outputs as solid in OutputManager for clientID.
func (*EvilWallet) UnspentOutputsLeft ¶
func (e *EvilWallet) UnspentOutputsLeft(walletType WalletType) int
type FaucetRequestOption ¶
type FaucetRequestOption func(*FaucetRequestOptions)
FaucetRequestOption is an option for faucet request.
func WithOutputAlias ¶
func WithOutputAlias(aliasName string) FaucetRequestOption
WithOutputAlias returns an Option that is used to provide the Output of the Transaction.
type FaucetRequestOptions ¶
type FaucetRequestOptions struct {
// contains filtered or unexported fields
}
FaucetRequestOptions is options for faucet request.
func NewFaucetRequestOptions ¶
func NewFaucetRequestOptions(options ...FaucetRequestOption) *FaucetRequestOptions
NewFaucetRequestOptions creates options for a faucet request.
type Option ¶
type Option func(*Options)
Option is the type that is used for options that can be passed into the CreateBlock method to configure its behavior.
func WithInputWallet ¶
WithInputWallet returns a BlockOption that is used to define the inputWallet of the Block.
func WithInputs ¶
func WithInputs(inputs interface{}) Option
WithInputs returns an Option that is used to provide the Inputs of the Transaction.
func WithIssuanceStrategy ¶
func WithIssuanceStrategy(strategy models.AllotmentStrategy, issuerID iotago.AccountID) Option
func WithIssuingTime ¶
WithIssuingTime returns a BlockOption that is used to set issuing time of the Block.
func WithOutputBatchAliases ¶
WithOutputBatchAliases returns a BlockOption that is used to determine which outputs should be added to the outWallet.
func WithOutputWallet ¶
WithOutputWallet returns a BlockOption that is used to define the inputWallet of the Block.
func WithOutputs ¶
func WithOutputs(outputsOptions []*OutputOption) Option
WithOutputs returns an Option that is used to define a non-colored Outputs for the Transaction in the Block.
func WithReuseOutputs ¶
func WithReuseOutputs() Option
WithReuseOutputs returns a BlockOption that is used to enable deep spamming with Reuse wallet outputs.
type Options ¶
type Options struct {
// contains filtered or unexported fields
}
Options is a struct that represents a collection of options that can be set when creating a block.
func NewOptions ¶
NewOptions is the constructor for the tx creation.
type OutputManager ¶
OutputManager keeps track of the output statuses.
func NewOutputManager ¶
func NewOutputManager(connector models.Connector, wallets *Wallets, log *logger.Logger) *OutputManager
NewOutputManager creates an OutputManager instance.
func (*OutputManager) AddOutput ¶
AddOutput adds existing output from wallet w to the OutputManager.
func (*OutputManager) AwaitOutputToBeAccepted ¶
func (o *OutputManager) AwaitOutputToBeAccepted(outputID iotago.OutputID, waitFor time.Duration) (accepted bool)
AwaitOutputToBeAccepted awaits for output from a provided outputID is accepted. Timeout is waitFor. Useful when we have only an address and no transactionID, e.g. faucet funds request.
func (*OutputManager) AwaitOutputToBeSolid ¶
func (o *OutputManager) AwaitOutputToBeSolid(outID iotago.OutputID, clt models.Client, waitFor time.Duration) error
AwaitOutputToBeSolid awaits for solidification of a single output by provided clt.
func (*OutputManager) AwaitOutputsToBeSolid ¶
func (o *OutputManager) AwaitOutputsToBeSolid(outputs iotago.OutputIDs, clt models.Client, maxGoroutines int) (allSolid bool)
AwaitOutputsToBeSolid awaits for all provided outputs are solid for a provided client.
func (*OutputManager) AwaitTransactionToBeAccepted ¶
func (o *OutputManager) AwaitTransactionToBeAccepted(txID iotago.TransactionID, waitFor time.Duration) error
AwaitTransactionToBeAccepted awaits for acceptance of a single transaction.
func (*OutputManager) AwaitTransactionsConfirmation ¶
func (o *OutputManager) AwaitTransactionsConfirmation(txIDs ...iotago.TransactionID)
AwaitTransactionsConfirmation awaits for transaction confirmation and updates wallet with outputIDs.
func (*OutputManager) AwaitWalletOutputsToBeConfirmed ¶
func (o *OutputManager) AwaitWalletOutputsToBeConfirmed(wallet *Wallet)
AwaitWalletOutputsToBeConfirmed awaits for all outputs in the wallet are confirmed.
func (*OutputManager) GetOutput ¶
func (o *OutputManager) GetOutput(outputID iotago.OutputID) (output *models.Output)
GetOutput returns the Output of the given outputID. Firstly checks if output can be retrieved by outputManager from wallet, if not does an API call.
func (*OutputManager) IssuerSolidOutIDMap ¶
func (o *OutputManager) IssuerSolidOutIDMap(issuer string, outputID iotago.OutputID) (isSolid bool)
IssuerSolidOutIDMap checks whether output was marked as solid for a given node.
func (*OutputManager) OutputIDAddrMap ¶
func (o *OutputManager) OutputIDAddrMap(outputID string) (addr string)
OutputIDAddrMap returns address corresponding to the outputID stored in OutputManager.
func (*OutputManager) OutputIDWalletMap ¶
func (o *OutputManager) OutputIDWalletMap(outputID string) *Wallet
OutputIDWalletMap returns wallet corresponding to the outputID stored in OutputManager.
func (*OutputManager) RequestOutputsByTxID ¶
func (o *OutputManager) RequestOutputsByTxID(txID iotago.TransactionID) (outputIDs iotago.OutputIDs)
RequestOutputsByTxID adds the outputs of a given transaction to the output status map.
func (*OutputManager) SetOutputIDSolidForIssuer ¶
func (o *OutputManager) SetOutputIDSolidForIssuer(outputID iotago.OutputID, issuer string)
SetOutputIDSolidForIssuer sets solid flag for the provided outputID and issuer.
type OutputOption ¶
type OutputOption struct {
// contains filtered or unexported fields
}
type ScenarioAlias ¶
func NewScenarioAlias ¶
func NewScenarioAlias() ScenarioAlias
type ScenarioOption ¶
type ScenarioOption func(scenario *EvilScenario)
func WithCreateAccounts ¶
func WithCreateAccounts() ScenarioOption
func WithScenarioCustomConflicts ¶
func WithScenarioCustomConflicts(batch EvilBatch) ScenarioOption
WithScenarioCustomConflicts specifies the EvilBatch that describes the UTXO structure that should be used for the spam.
func WithScenarioDeepSpamEnabled ¶
func WithScenarioDeepSpamEnabled() ScenarioOption
WithScenarioDeepSpamEnabled enables deep spam, the outputs from available Reuse wallets or RestrictedReuse wallet if provided with WithReuseInputWalletForDeepSpam option will be used for spam instead fresh faucet outputs.
func WithScenarioInputWalletForDeepSpam ¶
func WithScenarioInputWalletForDeepSpam(wallet *Wallet) ScenarioOption
WithScenarioInputWalletForDeepSpam reuse set to true, outputs from this wallet will be used for deep spamming, allows for controllable building of UTXO deep structures. Accepts only RestrictedReuse wallet type.
func WithScenarioReuseOutputWallet ¶
func WithScenarioReuseOutputWallet(wallet *Wallet) ScenarioOption
WithScenarioReuseOutputWallet the outputs from the spam will be saved into this wallet, accepted types of wallet: Reuse, RestrictedReuse.
type Wallet ¶
Wallet is the definition of a wallet.
func NewWallet ¶
func NewWallet(wType ...WalletType) *Wallet
NewWallet creates a wallet of a given type.
func (*Wallet) AddReuseAddress ¶
AddReuseAddress adds address to the reuse ready outputs' addresses pool for a Reuse wallet.
func (*Wallet) AddUnspentOutput ¶
AddUnspentOutput adds an unspentOutput of a given wallet.
func (*Wallet) AddrIndexMap ¶
AddrIndexMap returns the index for the address specified.
func (*Wallet) Address ¶
func (w *Wallet) Address() *iotago.Ed25519Address
Address returns a new and unused address of a given wallet.
func (*Wallet) AddressOnIndex ¶
func (w *Wallet) AddressOnIndex(index uint64) *iotago.Ed25519Address
AddressOnIndex returns a new and unused address of a given wallet.
func (*Wallet) AddressSigner ¶
func (w *Wallet) AddressSigner(addr *iotago.Ed25519Address) iotago.AddressSigner
Sign signs the tx essence.
func (*Wallet) GetReuseAddress ¶
GetReuseAddress get random address from reuse addresses reuseOutputsAddresses pool. Address is removed from the pool after selecting.
func (*Wallet) GetUnspentOutput ¶
GetUnspentOutput returns an unspent output on the oldest address ordered by index.
func (*Wallet) IndexAddrMap ¶
IndexAddrMap returns the address for the index specified.
func (*Wallet) UnspentOutput ¶
UnspentOutput returns the unspent output on the address.
func (*Wallet) UnspentOutputBalance ¶
UnspentOutputBalance returns the balance on the unspent output sitting on the address specified.
func (*Wallet) UnspentOutputs ¶
UnspentOutputs returns all unspent outputs on the wallet.
func (*Wallet) UnspentOutputsLeft ¶
UnspentOutputsLeft returns how many unused outputs are available in wallet.
func (*Wallet) UnspentOutputsLength ¶
UnspentOutputsLength returns the number of unspent outputs on the wallet.
type WalletStatus ¶
type WalletStatus int8
type WalletType ¶
type WalletType int8
WalletType is the type of the wallet.
const ( Other WalletType = iota // Fresh is used for automatic Faucet Requests, outputs are returned one by one. Fresh // Reuse stores resulting outputs of double spends or transactions issued by the evilWallet, // outputs from this wallet are reused in spamming scenario with flag reuse set to true and no RestrictedReuse wallet provided. // Reusing spammed outputs allows for creation of deeper UTXO DAG structure. Reuse // RestrictedReuse it is a reuse wallet, that will be available only to spamming scenarios that // will provide RestrictedWallet for the reuse spamming. RestrictedReuse )
type Wallets ¶
type Wallets struct {
// contains filtered or unexported fields
}
Wallets is a container of wallets.
func NewWallets ¶
func NewWallets() *Wallets
NewWallets creates and returns a new Wallets container.
func (*Wallets) GetNextWallet ¶
func (w *Wallets) GetNextWallet(walletType WalletType, minOutputsLeft int) (*Wallet, error)
GetNextWallet get next non-empty wallet based on provided type.
func (*Wallets) GetUnspentOutput ¶
GetUnspentOutput gets first found unspent output for a given walletType.
func (*Wallets) IsFaucetWalletAvailable ¶
IsFaucetWalletAvailable checks if there is any faucet wallet left.
func (*Wallets) NewWallet ¶
func (w *Wallets) NewWallet(walletType WalletType) *Wallet
NewWallet adds a new wallet to Wallets and returns the created wallet.
func (*Wallets) SetWalletReady ¶
SetWalletReady makes wallet ready to use, Fresh wallet is added to freshWallets queue.
func (*Wallets) UnspentOutputsLeft ¶
func (w *Wallets) UnspentOutputsLeft(walletType WalletType) int