package ergotool

Ordering
  1. Alphabetic
Visibility
  1. Public
  2. All

Type Members

  1. case class AddressCmd(toolConf: ErgoToolConfig, name: String, network: NetworkType, mnemonic: String, mnemonicPass: Array[Char]) extends Cmd with Product with Serializable

    Given mnemonic, mnemonicPass and network the command computes the address of the given network type.

    Given mnemonic, mnemonicPass and network the command computes the address of the given network type.

    The command do the following:
    1) it uses (mnemonic, password) pair to generate master secret key (unambiguously for each such pair)
    2) it extracts public key (pk) which corresponds to the generated secret key
    3) it construct pay-to-public-key address for pk (see org.ergoplatform.P2PKAddress)
    4) it prints the text representation (Base58 string) of P2PKAddress bytes.

    toolConf

    configuration parameters to be used for operation

    name

    command name

    network

    NetworkType of the target network for which the address should be generated

    mnemonic

    secret phrase which is used to generate (private, public) key pair, of which public key is used to generate the Address

    mnemonicPass

    password which is used to additionally protect mnemonic

    See also

    AddressCmd$ descriptor of the address command

  2. case class AppContext(commandLineArgs: Seq[String], console: Console, cmdOptions: Map[String, String], cmdArgs: Seq[String], toolConf: ErgoToolConfig, clientFactory: (AppContext) ⇒ ErgoClient) extends Product with Serializable

    Application execution context.

    Application execution context. Contains all the data necessary to parse and execute command.

  3. case class CheckAddressCmd(toolConf: ErgoToolConfig, name: String, network: NetworkType, mnemonic: String, mnemonicPass: Array[Char], address: Address) extends Cmd with Product with Serializable

    Given network, mnemonic, mnemonicPass and address checks that the address belongs to the given network and corresponds to the given mnemonic and mnemonic password.

    Given network, mnemonic, mnemonicPass and address checks that the address belongs to the given network and corresponds to the given mnemonic and mnemonic password.

    Steps:
    1) The network, mnemonic and mnemonicPass parameters are used to compute new address (see AddressCmd)
    2) if computed address equals to the given address then print Ok otherwise print Error

    network

    network type

    mnemonic

    mnemonic phrase

    mnemonicPass

    mnemonic password

    address

    address to check

  4. abstract class Cmd extends AnyRef

    Base class for all commands which can be executed by ErgoTool.

    Base class for all commands which can be executed by ErgoTool. Inherit this class to implement a new command.

    See also

    RunWithErgoClient if your command need to communicate with blockchain.

  5. abstract class CmdDescriptor extends AnyRef

    Base class for all Cmd descriptors (usually companion objects)

  6. case class CmdException(message: String, cmd: Cmd, cause: Throwable = null) extends RuntimeException with Product with Serializable

    Exception thrown by executing Cmd.run, wrapping the cause if needed.

  7. case class CmdOption(name: String, description: String, isFlag: Boolean = false) extends Product with Serializable

    Represents ErgoTool option description.

    Represents ErgoTool option description.

    Options can be used in command line to specify parameters to be used by the command during its operation. The command line passed to ErgoTool is split into parts (args) by whitespaces, so that option name and value are represented by two consecutive parts.

    In the command line an option is given using the following syntax --optionName optionValue, where the option name should be prefixed with -- in the command line, and option value is given by the next part of the command line.

    If a CmdOption instance has CmdOption.isFlag set to true then such option doesn't have optionValue part and the option is interpreted as Boolean value (true if it is present, false otherwise)

    name

    The name of this option excluding prefix -- (should not contain whitespaces) (Examples: conf for ConfigOption and dry-run for DryRunOption)

    description

    is a user readable description of the option

    isFlag

    is set to true if the option is a flag option which doesn't have optionValue part (e.g. --ni or --dry-run)

  8. case class CmdParameter(name: String, tpe: ErgoType[_]) extends Product with Serializable
  9. case class CreateStorageCmd(toolConf: ErgoToolConfig, name: String, mnemonic: Mnemonic, storagePass: Array[Char], storageDir: String, storageFileName: String) extends Cmd with Product with Serializable

    Create a new json file with encrypted content storing a secret key.

    Create a new json file with encrypted content storing a secret key.

    The format of secret file corresponds to org.ergoplatform.wallet.secrets.EncryptedSecret. By default it uses the following cipher parameters {"prf":"HmacSHA256","c":128000,"dkLen":256} which information is openly stored in the storage file in order to be able to decipher it (see org.ergoplatform.wallet.settings.EncryptionSettings).

    Command steps:
    1) request the user to enter a mnemonic phrase (or read it from input stream)
    2) request the user to enter a mnemonic password twice
    3) request the user to enter a storage encryption password twice (storagePass
    4) use the (mnemonic, mnemonicPass) pair instance to generate secret seed (see Mnemonic.toSeed)
    5) use storagePass to encrypt seed with AES using "AES/GCM/NoPadding" javax.crypto.Cipher
    6) save encrypted seed (along with additional data necessary for decryption) in the given file (storageFileName) of the given directory (storageDir).
    7) print the path to the created file to the console output

    mnemonic

    instance of Mnemonic holding both mnemonic phrase and mnemonic password.

    storagePass

    password used to encrypt the file and which is necessary to access and decipher the file.

    storageDir

    directory (relative to the current) where to put storage file (default is "storage")

    storageFileName

    name of the storage file (default is "secret.json")

  10. case class ErgoToolException(message: String, cause: Throwable = null) extends RuntimeException with Product with Serializable

    Exception thrown by ErgoTool application before or after command execution.

    Exception thrown by ErgoTool application before or after command execution.

    See also

    CmdException which should be thrown by commands during execution

  11. case class ExtractStorageCmd(toolConf: ErgoToolConfig, name: String, storageFile: String, storagePass: Array[Char], prop: String, network: NetworkType) extends Cmd with Product with Serializable

    Extracts secret data from encrypted storage file (e.g.

    Extracts secret data from encrypted storage file (e.g. created by CreateStorageCmd).

    Steps:
    1) request storage password (storagePass)
    2) load encrypted data from storageFile into SecretStorage instance
    3) unlock the instance using storagePass and retrieve secret data from storage
    4) depending on the parameter prop:

    • "address" => get master key address for the given network (see BIP-32)
    • "masterKey" => serialize org.ergoplatform.wallet.secrets.ExtendedSecretKey into bytes
      and encode as base16
    • "secretKey" => get bytes of the secret key and encode as base16
    • "publicKey" => get bytes of the public key and encode as base16

    5) print obtained secret string to the console output

    Note, a storage file doesn't contain network type information, this the same storage can be used to obtain address both from mainnet and from testnet.

    storageFile

    path to encrypted storage file

    storagePass

    encryption password necessary to access storage file content

    prop

    name of the secret data stored in the file (e.g. PropAddress)

    network

    network type

  12. case class HelpCmd(toolConf: ErgoToolConfig, name: String, askedCmd: String) extends Cmd with Product with Serializable

    Prints usage help for the given command name.

    Prints usage help for the given command name.

    askedCmd

    command name which usage help should be printed

    Exceptions thrown

    CmdException if askedCmd is not valid command name

    See also

    HelpCmd$ descriptor of the help command

  13. case class ListAddressBoxesCmd(toolConf: ErgoToolConfig, name: String, address: String, limit: Int) extends Cmd with RunWithErgoClient with Product with Serializable

    Lists unspent outputs (aka boxes or coins) belonging to the given address.

    Lists unspent outputs (aka boxes or coins) belonging to the given address.

    address

    string encoding of the address

    limit

    limit the size of the list (optional, default is 10)

  14. case class MnemonicCmd(toolConf: ErgoToolConfig, name: String) extends Cmd with Product with Serializable

    Generates a new mnemonic phrase using english words and default cryptographic strength parameters (number of random bits, which is 160 by default).

    Generates a new mnemonic phrase using english words and default cryptographic strength parameters (number of random bits, which is 160 by default). The command doesn't have parameters.

    Prints the generated mnemonic to the console output.

    See also

    Mnemonic

  15. trait RunWithErgoClient extends Cmd

    This trait can be used to implement commands which need to communicate with Ergo blockchain.

    This trait can be used to implement commands which need to communicate with Ergo blockchain. The default Cmd.run method is implemented and the new method with additional ErgoClient parameter is declared, which is called from the default implementation. To implement new command mix-in this train and implement RunWithErgoClient.runWithClient method.

  16. case class SendCmd(toolConf: ErgoToolConfig, name: String, storageFile: File, storagePass: Array[Char], recipient: Address, amountToSend: Long) extends Cmd with RunWithErgoClient with Product with Serializable

    Creates and sends a new transaction to transfer Ergs from one address to another.

    Creates and sends a new transaction to transfer Ergs from one address to another.

    Steps:
    1) request storage password from the user
    2) read storage file, unlock using password and get secret
    3) get master public key and compute sender's address
    4) load available coins belonging to the sender's address
    5) select coins to cover amountToSend, compute transaction fee and amount of change
    6) create and sign (using secret key) transaction
    7) if no --dry-run option is specified, send the transaction to the network
    otherwise skip sending
    8) serialize transaction to Json and print to the console

    storageFile

    storage with secret key of the sender

    storagePass

    password to access sender secret key in the storage

    recipient

    address of the recepient of the transfer

    amountToSend

    amount of NanoErg to transfer to recipient

  17. case class UsageException(message: String, cmdDescOpt: Option[CmdDescriptor]) extends RuntimeException with Product with Serializable

    Exception thrown by ErgoTool application when incorrect usage is detected.

    Exception thrown by ErgoTool application when incorrect usage is detected.

    message

    error message

    cmdDescOpt

    optional descriptor of the command which was incorrectly used

Value Members

  1. object AddressCmd extends CmdDescriptor with Serializable

    Descriptor and parser of the address command.

  2. object CheckAddressCmd extends CmdDescriptor with Serializable
  3. object CmdLineParser
  4. object CmdOption extends Serializable
  5. object ConfigOption extends CmdOption

    String option to specify path to a configuration file.

    String option to specify path to a configuration file. The path is relative to current working directory. The file has json content corresponding to ErgoToolConfig class.

  6. object CreateStorageCmd extends CmdDescriptor with Serializable
  7. object DryRunOption extends CmdOption

    Flag option to prevent the command to perform actual operation and instead forces it to report planned actions.

    Flag option to prevent the command to perform actual operation and instead forces it to report planned actions. It is useful for commands which perform some real world effects such as sending a transaction to the blockchain (see SendCmd).

    The reported output of a command under this option depends on the command implementation. The commands that do real world changes are required to respect this option and guarantee that no-change execution when this option is included in command line.

  8. object ErgoTool

    ErgoTool implementation, contains main entry point of the console application.

    ErgoTool implementation, contains main entry point of the console application.

    See also

    instructions in README to generate native executable

  9. object ExtractStorageCmd extends CmdDescriptor with Serializable
  10. object HelpCmd extends CmdDescriptor with Serializable

    Descriptor and parser of the help command.

  11. object ListAddressBoxesCmd extends CmdDescriptor with Serializable
  12. object MnemonicCmd extends CmdDescriptor with Serializable
  13. object PrintJsonOption extends CmdOption

    Flag option to force commands to print objects as formatted json instead of rows in table.

    Flag option to force commands to print objects as formatted json instead of rows in table.

    The reported output of a command under this option depends on the command implementation.

  14. object SendCmd extends CmdDescriptor with Serializable

Ungrouped