Documentation ¶
Index ¶
- Constants
- func RateSetterSleep(clt Client, useRateSetter bool) error
- func SplitBalanceEqually(splitNumber int, balance uint64) []uint64
- type AliasManager
- func (a *AliasManager) AddInputAlias(input devnetvm.Input, aliasName string)
- func (a *AliasManager) AddInputAliases(inputs []*Output, aliases []string) error
- func (a *AliasManager) AddOutputAlias(output devnetvm.Output, aliasName string)
- func (a *AliasManager) AddOutputAliases(outputs []devnetvm.Output, aliases []string) error
- func (a *AliasManager) ClearAliases(aliases ScenarioAlias)
- func (a *AliasManager) ClearAllAliases()
- func (a *AliasManager) GetInput(aliasName string) (devnetvm.Input, bool)
- func (a *AliasManager) GetOutput(aliasName string) devnetvm.Output
- type Client
- type ConflictSlice
- type Connector
- type EvilBatch
- func ConflictSetCircle(size int) EvilBatch
- func DoubleSpendBatch(spentNum 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) AddReuseOutputsToThePool(outputs devnetvm.Outputs)
- func (e *EvilWallet) AwaitInputsSolidity(inputs devnetvm.Inputs, clt Client) (allSolid bool)
- func (e *EvilWallet) ClearAliases(aliases ScenarioAlias)
- func (e *EvilWallet) ClearAllAliases()
- func (e *EvilWallet) Connector() Connector
- func (e *EvilWallet) CreateTransaction(options ...Option) (tx *devnetvm.Transaction, err error)
- func (e *EvilWallet) GetClients(num int) []Client
- func (e *EvilWallet) NewWallet(wType ...WalletType) *Wallet
- func (e *EvilWallet) NumOfClient() int
- func (e *EvilWallet) PrepareCustomConflicts(conflictsMaps []ConflictSlice) (conflictBatch [][]*devnetvm.Transaction, err error)
- func (e *EvilWallet) PrepareCustomConflictsSpam(scenario *EvilScenario) (txs [][]*devnetvm.Transaction, allAliases ScenarioAlias, err error)
- func (e *EvilWallet) RemoveClient(clientUrl string)
- func (e *EvilWallet) RequestFreshBigFaucetWallet() (err error)
- func (e *EvilWallet) RequestFreshBigFaucetWallets(numberOfWallets int)
- func (e *EvilWallet) RequestFreshFaucetWallet() (err error)
- func (e *EvilWallet) RequestFundsFromFaucet(options ...FaucetRequestOption) (err error, initWallet *Wallet)
- func (e *EvilWallet) SendCustomConflicts(conflictsMaps []ConflictSlice) (err error)
- func (e *EvilWallet) SetTxOutputsSolid(outputs devnetvm.Outputs, clientID string)
- func (e *EvilWallet) UnspentOutputsLeft(walletType WalletType) int
- type FaucetRequestOption
- type FaucetRequestOptions
- type Option
- func WithInputs(inputs interface{}) Option
- func WithIssuer(issuer *Wallet) Option
- func WithIssuingTime(issuingTime time.Time) Option
- func WithOutput(output *OutputOption) Option
- func WithOutputBatchAliases(outputAliases map[string]types.Empty) Option
- func WithOutputWallet(wallet *Wallet) Option
- func WithOutputs(outputs []*OutputOption) Option
- func WithReuseOutputs() Option
- type Options
- type Output
- type OutputManager
- func (o *OutputManager) AddOutput(w *Wallet, output devnetvm.Output) *Output
- func (o *OutputManager) AwaitOutputToBeAccepted(outputID utxo.OutputID, waitFor time.Duration) (accepted bool)
- func (o *OutputManager) AwaitOutputToBeSolid(outID string, clt Client, waitFor time.Duration) error
- func (o *OutputManager) AwaitOutputsToBeSolid(outputs []string, clt Client, maxGoroutines int) (allSolid bool)
- func (o *OutputManager) AwaitTransactionToBeAccepted(txID string, waitFor time.Duration) error
- func (o *OutputManager) AwaitTransactionsConfirmation(txIDs []string, maxGoroutines int)
- func (o *OutputManager) AwaitWalletOutputsToBeConfirmed(wallet *Wallet)
- func (o *OutputManager) CreateOutputFromAddress(w *Wallet, addr address.Address, balance *devnetvm.ColoredBalances) *Output
- func (o *OutputManager) GetOutput(outputID utxo.OutputID) (output *Output)
- func (o *OutputManager) IssuerSolidOutIDMap(issuer, outputID string) (isSolid bool)
- func (o *OutputManager) OutputIDAddrMap(outputID string) (addr string)
- func (o *OutputManager) OutputIDWalletMap(outputID string) *Wallet
- func (o *OutputManager) RequestOutputsByAddress(address string) (outputIDs []utxo.OutputID)
- func (o *OutputManager) RequestOutputsByTxID(txID string) (outputIDs []utxo.OutputID)
- func (o *OutputManager) SetOutputIDSolidForIssuer(outputID string, issuer string)
- func (o *OutputManager) Track(outputIDs []utxo.OutputID) (allConfirmed bool)
- type OutputOption
- type Outputs
- type ScenarioAlias
- type ScenarioOption
- type ServersStatus
- type Wallet
- func (w *Wallet) AddReuseAddress(addr string)
- func (w *Wallet) AddUnspentOutput(addr devnetvm.Address, addrIdx uint64, outputID utxo.OutputID, ...) *Output
- func (w *Wallet) AddrIndexMap(outIndex string) uint64
- func (w *Wallet) Address() address.Address
- func (w *Wallet) GetReuseAddress() string
- func (w *Wallet) GetUnspentOutput() *Output
- func (w *Wallet) IndexAddrMap(outIndex uint64) string
- func (w *Wallet) IsEmpty() (empty bool)
- func (w *Wallet) Sign(addr devnetvm.Address, txEssence *devnetvm.TransactionEssence) *devnetvm.ED25519Signature
- func (w *Wallet) Type() WalletType
- func (w *Wallet) UnspentOutput(addr string) *Output
- func (w *Wallet) UnspentOutputBalance(addr string) *devnetvm.ColoredBalances
- func (w *Wallet) UnspentOutputs() (outputs map[string]*Output)
- func (w *Wallet) UnspentOutputsLeft() (left int)
- func (w *Wallet) UnspentOutputsLength() int
- func (w *Wallet) UpdateUnspentOutputID(addr string, outputID utxo.OutputID) error
- type WalletStatus
- type WalletType
- type Wallets
- func (w *Wallets) GetNextWallet(walletType WalletType, minOutputsLeft int) (*Wallet, error)
- func (w *Wallets) GetUnspentOutput(wallet *Wallet) *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
- type WebClient
- func (c *WebClient) BroadcastFaucetRequest(address string) (err error)
- func (c *WebClient) GetAddressUnspentOutputs(address string) (outputIDs []utxo.OutputID, err error)
- func (c *WebClient) GetOutput(outputID utxo.OutputID) devnetvm.Output
- func (c *WebClient) GetOutputConfirmationState(outputID utxo.OutputID) confirmation.State
- func (c *WebClient) GetOutputSolidity(outID string) (solid bool, err error)
- func (c *WebClient) GetRateSetterEstimate() (estimate time.Duration, err error)
- func (c *WebClient) GetTransaction(txID string) (resp *jsonmodels.Transaction, err error)
- func (c *WebClient) GetTransactionConfirmationState(txID string) confirmation.State
- func (c *WebClient) GetTransactionOutputs(txID string) (outputs devnetvm.Outputs, err error)
- func (c *WebClient) GetUnspentOutputForAddress(addr devnetvm.Address) *jsonmodels.WalletOutput
- func (c *WebClient) PostData(data []byte) (blkID string, err error)
- func (c *WebClient) PostTransaction(tx *devnetvm.Transaction) (txID utxo.TransactionID, err error)
- func (c *WebClient) SleepRateSetterEstimate() (err error)
- func (c *WebClient) Url() string
- type WebClients
- func (c *WebClients) AddClient(url string, setters ...client.Option)
- func (c *WebClients) Clients(...bool) []Client
- func (c *WebClients) GetClient() Client
- func (c *WebClients) GetClients(numOfClt int) []Client
- func (c *WebClients) PledgeID() *identity.ID
- func (c *WebClients) RemoveClient(url string)
- func (c *WebClients) ServerStatus(cltIdx int) (status *wallet.ServerStatus, err error)
- func (c *WebClients) ServersStatuses() ServersStatus
- func (c *WebClients) SetPledgeID(id *identity.ID)
Constants ¶
const ( // FaucetRequestSplitNumber defines the number of outputs to split from a faucet request. FaucetRequestSplitNumber = 100 WaitForTxSolid = 150 * time.Second )
Variables ¶
This section is empty.
Functions ¶
func RateSetterSleep ¶ added in v0.9.1
RateSetterSleep sleeps for the given rate.
func SplitBalanceEqually ¶
SplitBalanceEqually splits the balance equally between `splitNumber` outputs.
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 devnetvm.Input, aliasName string)
AddInputAlias adds an input alias.
func (*AliasManager) AddInputAliases ¶
func (a *AliasManager) AddInputAliases(inputs []*Output, aliases []string) error
AddInputAliases batch adds the inputs their respective aliases.
func (*AliasManager) AddOutputAlias ¶
func (a *AliasManager) AddOutputAlias(output devnetvm.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 []devnetvm.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 Client ¶
type Client interface { // Url returns a client API url. Url() (cltID string) // GetRateSetterEstimate returns a rate setter estimate. GetRateSetterEstimate() (estimate time.Duration, err error) // SleepRateSetterEstimate sleeps for rate setter estimate. SleepRateSetterEstimate() (err error) // PostTransaction sends a transaction to the Tangle via a given client. PostTransaction(tx *devnetvm.Transaction) (utxo.TransactionID, error) // PostData sends the given data (payload) by creating a block in the backend. PostData(data []byte) (blkID string, err error) // GetUnspentOutputForAddress gets the first unspent outputs of a given address. GetUnspentOutputForAddress(addr devnetvm.Address) *jsonmodels.WalletOutput // GetAddressUnspentOutputs gets the unspent outputs of an address. GetAddressUnspentOutputs(address string) (outputIDs []utxo.OutputID, err error) // GetTransactionConfirmationState returns the ConfirmationState of a given transaction ID. GetTransactionConfirmationState(txID string) confirmation.State // GetOutput gets the output of a given outputID. GetOutput(outputID utxo.OutputID) devnetvm.Output // GetOutputConfirmationState gets the first unspent outputs of a given address. GetOutputConfirmationState(outputID utxo.OutputID) confirmation.State // BroadcastFaucetRequest requests funds from the faucet and returns the faucet request block ID. BroadcastFaucetRequest(address string) error // GetTransactionOutputs returns the outputs the transaction created. GetTransactionOutputs(txID string) (outputs devnetvm.Outputs, err error) // GetTransaction gets the transaction. GetTransaction(txID string) (resp *jsonmodels.Transaction, err error) // GetOutputSolidity checks if the transaction is solid. GetOutputSolidity(outID string) (solid bool, err error) }
type ConflictSlice ¶
type ConflictSlice [][]Option
ConflictSlice represents a set of conflict transactions.
type Connector ¶
type Connector interface { // ServersStatuses retrieves the connected server status for each client. ServersStatuses() ServersStatus // ServerStatus retrieves the connected server status. ServerStatus(cltIdx int) (status *wallet.ServerStatus, err error) // Clients returns list of all clients. Clients(...bool) []Client // GetClients returns the numOfClt client instances that were used the longest time ago. GetClients(numOfClt int) []Client // AddClient adds client to WebClients based on provided GoShimmerAPI url. AddClient(url string, setters ...client.Option) // RemoveClient removes client with the provided url from the WebClients. RemoveClient(url string) // GetClient returns the client instance that was used the longest time ago. GetClient() Client // PledgeID returns the node ID that the mana will be pledging to. PledgeID() *identity.ID }
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 DoubleSpendBatch ¶
DoubleSpendBatch returns an EvilBatch that is a spentNum spend.
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 // 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 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(clientsUrls ...string) *EvilWallet
NewEvilWallet creates an EvilWallet instance.
func (*EvilWallet) AddClient ¶
func (e *EvilWallet) AddClient(clientUrl string)
func (*EvilWallet) AddReuseOutputsToThePool ¶
func (e *EvilWallet) AddReuseOutputsToThePool(outputs devnetvm.Outputs)
AddReuseOutputsToThePool adds all addresses corresponding to provided outputs to the reuse pool.
func (*EvilWallet) AwaitInputsSolidity ¶
func (e *EvilWallet) AwaitInputsSolidity(inputs devnetvm.Inputs, clt Client) (allSolid bool)
AwaitInputsSolidity waits for all inputs to be solid for client clt.
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() Connector
Connector give access to the EvilWallet connector.
func (*EvilWallet) CreateTransaction ¶
func (e *EvilWallet) CreateTransaction(options ...Option) (tx *devnetvm.Transaction, err 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) GetClients ¶
func (e *EvilWallet) GetClients(num int) []Client
GetClients returns the given number of clients.
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) PrepareCustomConflicts ¶
func (e *EvilWallet) PrepareCustomConflicts(conflictsMaps []ConflictSlice) (conflictBatch [][]*devnetvm.Transaction, err error)
func (*EvilWallet) PrepareCustomConflictsSpam ¶
func (e *EvilWallet) PrepareCustomConflictsSpam(scenario *EvilScenario) (txs [][]*devnetvm.Transaction, allAliases ScenarioAlias, err error)
func (*EvilWallet) RemoveClient ¶
func (e *EvilWallet) RemoveClient(clientUrl string)
func (*EvilWallet) RequestFreshBigFaucetWallet ¶
func (e *EvilWallet) RequestFreshBigFaucetWallet() (err error)
RequestFreshBigFaucetWallet creates a new wallet and fills the wallet with 10000 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 10000 outputs.
func (*EvilWallet) RequestFreshFaucetWallet ¶
func (e *EvilWallet) RequestFreshFaucetWallet() (err 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) (err error, initWallet *Wallet)
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) SendCustomConflicts ¶
func (e *EvilWallet) SendCustomConflicts(conflictsMaps []ConflictSlice) (err error)
SendCustomConflicts sends transactions with the given conflictsMaps.
func (*EvilWallet) SetTxOutputsSolid ¶
func (e *EvilWallet) SetTxOutputsSolid(outputs devnetvm.Outputs, 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 WithInputs ¶
func WithInputs(inputs interface{}) Option
WithInputs returns an Option that is used to provide the Inputs of the Transaction.
func WithIssuer ¶
WithIssuer returns a BlockOption that is used to define the inputWallet of the Block.
func WithIssuingTime ¶
WithIssuingTime returns a BlockOption that is used to set issuing time of the Block.
func WithOutput ¶
func WithOutput(output *OutputOption) Option
WithOutput returns an Option that is used to define a non-colored Output for the Transaction in 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(outputs []*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 Output ¶
type Output struct { // *wallet.Output OutputID utxo.OutputID Address devnetvm.Address Index uint64 Balance *devnetvm.ColoredBalances }
Output contains details of an output ID.
type OutputManager ¶
OutputManager keeps track of the output statuses.
func NewOutputManager ¶
func NewOutputManager(connector Connector, wallets *Wallets) *OutputManager
NewOutputManager creates an OutputManager instance.
func (*OutputManager) AddOutput ¶
func (o *OutputManager) AddOutput(w *Wallet, output devnetvm.Output) *Output
AddOutput adds existing output from wallet w to the OutputManager.
func (*OutputManager) AwaitOutputToBeAccepted ¶ added in v0.9.2
func (o *OutputManager) AwaitOutputToBeAccepted(outputID utxo.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 ¶
AwaitOutputToBeSolid awaits for solidification of a single output by provided clt.
func (*OutputManager) AwaitOutputsToBeSolid ¶
func (o *OutputManager) AwaitOutputsToBeSolid(outputs []string, clt Client, maxGoroutines int) (allSolid bool)
AwaitOutputsToBeSolid awaits for all provided outputs are solid for a provided client.
func (*OutputManager) AwaitTransactionToBeAccepted ¶ added in v0.9.2
func (o *OutputManager) AwaitTransactionToBeAccepted(txID string, waitFor time.Duration) error
AwaitTransactionToBeAccepted awaits for acceptance of a single transaction.
func (*OutputManager) AwaitTransactionsConfirmation ¶
func (o *OutputManager) AwaitTransactionsConfirmation(txIDs []string, maxGoroutines int)
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) CreateOutputFromAddress ¶
func (o *OutputManager) CreateOutputFromAddress(w *Wallet, addr address.Address, balance *devnetvm.ColoredBalances) *Output
CreateOutputFromAddress creates output, retrieves outputID, and adds it to the wallet. Provided address should be generated from provided wallet. Considers only first output found on address.
func (*OutputManager) GetOutput ¶
func (o *OutputManager) GetOutput(outputID utxo.OutputID) (output *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, outputID string) (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) RequestOutputsByAddress ¶
func (o *OutputManager) RequestOutputsByAddress(address string) (outputIDs []utxo.OutputID)
RequestOutputsByAddress finds the unspent outputs of a given address and updates the provided output status map.
func (*OutputManager) RequestOutputsByTxID ¶
func (o *OutputManager) RequestOutputsByTxID(txID string) (outputIDs []utxo.OutputID)
RequestOutputsByTxID adds the outputs of a given transaction to the output status map.
func (*OutputManager) SetOutputIDSolidForIssuer ¶
func (o *OutputManager) SetOutputIDSolidForIssuer(outputID string, 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 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 ServersStatus ¶
type ServersStatus []*wallet.ServerStatus
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 ¶
func (w *Wallet) AddUnspentOutput(addr devnetvm.Address, addrIdx uint64, outputID utxo.OutputID, balance *devnetvm.ColoredBalances) *Output
AddUnspentOutput adds an unspentOutput of a given wallet.
func (*Wallet) AddrIndexMap ¶
AddrIndexMap returns the index for the address specified.
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) Sign ¶
func (w *Wallet) Sign(addr devnetvm.Address, txEssence *devnetvm.TransactionEssence) *devnetvm.ED25519Signature
Sign signs the tx essence.
func (*Wallet) UnspentOutput ¶
UnspentOutput returns the unspent output on the address.
func (*Wallet) UnspentOutputBalance ¶
func (w *Wallet) UnspentOutputBalance(addr string) *devnetvm.ColoredBalances
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
type WebClient ¶
type WebClient struct {
// contains filtered or unexported fields
}
WebClient contains a GoShimmer web API to interact with a node.
func NewWebClient ¶
NewWebClient creates Connector from provided GoShimmerAPI urls.
func (*WebClient) BroadcastFaucetRequest ¶ added in v0.9.1
BroadcastFaucetRequest requests funds from the faucet and returns the faucet request block ID.
func (*WebClient) GetAddressUnspentOutputs ¶
func (*WebClient) GetOutputConfirmationState ¶ added in v0.9.2
func (c *WebClient) GetOutputConfirmationState(outputID utxo.OutputID) confirmation.State
GetOutputConfirmationState gets the first unspent outputs of a given address.
func (*WebClient) GetOutputSolidity ¶
func (*WebClient) GetRateSetterEstimate ¶ added in v0.9.1
GetRateSetterEstimate returns a rate setter estimate.
func (*WebClient) GetTransaction ¶
func (c *WebClient) GetTransaction(txID string) (resp *jsonmodels.Transaction, err error)
GetTransaction gets the transaction.
func (*WebClient) GetTransactionConfirmationState ¶ added in v0.9.2
func (c *WebClient) GetTransactionConfirmationState(txID string) confirmation.State
GetTransactionConfirmationState returns the ConfirmationState of a given transaction ID.
func (*WebClient) GetTransactionOutputs ¶
GetTransactionOutputs returns the outputs the transaction created.
func (*WebClient) GetUnspentOutputForAddress ¶
func (c *WebClient) GetUnspentOutputForAddress(addr devnetvm.Address) *jsonmodels.WalletOutput
GetUnspentOutputForAddress gets the first unspent outputs of a given address.
func (*WebClient) PostData ¶
PostData sends the given data (payload) by creating a block in the backend.
func (*WebClient) PostTransaction ¶
func (c *WebClient) PostTransaction(tx *devnetvm.Transaction) (txID utxo.TransactionID, err error)
PostTransaction sends a transaction to the Tangle via a given client.
func (*WebClient) SleepRateSetterEstimate ¶ added in v0.9.1
SleepRateSetterEstimate returns a rate setter estimate.
type WebClients ¶
type WebClients struct {
// contains filtered or unexported fields
}
WebClients is responsible for handling connections via GoShimmerAPI.
func NewWebClients ¶
func NewWebClients(urls []string, setters ...client.Option) *WebClients
NewWebClients creates Connector from provided GoShimmerAPI urls.
func (*WebClients) AddClient ¶
func (c *WebClients) AddClient(url string, setters ...client.Option)
AddClient adds client to WebClients based on provided GoShimmerAPI url.
func (*WebClients) Clients ¶
func (c *WebClients) Clients(...bool) []Client
Clients returns list of all clients.
func (*WebClients) GetClient ¶
func (c *WebClients) GetClient() Client
GetClient returns the client instance that was used the longest time ago.
func (*WebClients) GetClients ¶
func (c *WebClients) GetClients(numOfClt int) []Client
GetClients returns the numOfClt client instances that were used the longest time ago.
func (*WebClients) PledgeID ¶
func (c *WebClients) PledgeID() *identity.ID
PledgeID returns the node ID that the mana will be pledging to.
func (*WebClients) RemoveClient ¶
func (c *WebClients) RemoveClient(url string)
RemoveClient removes client with the provided url from the WebClients.
func (*WebClients) ServerStatus ¶
func (c *WebClients) ServerStatus(cltIdx int) (status *wallet.ServerStatus, err error)
ServerStatus retrieves the connected server status.
func (*WebClients) ServersStatuses ¶
func (c *WebClients) ServersStatuses() ServersStatus
ServersStatuses retrieves the connected server status for each client.
func (*WebClients) SetPledgeID ¶
func (c *WebClients) SetPledgeID(id *identity.ID)
SetPledgeID sets the node ID that the mana will be pledging to.