Package monero.wallet

Interface MoneroWallet

    • Method Detail

      • addListener

        void addListener​(MoneroWalletListenerI listener)
        Register a listener to receive wallet notifications.
        Parameters:
        listener - is the listener to receive wallet notifications
      • removeListener

        void removeListener​(MoneroWalletListenerI listener)
        Unregister a listener to receive wallet notifications.
        Parameters:
        listener - is the listener to unregister
      • getListeners

        java.util.Set<MoneroWalletListenerI> getListeners()
        Get the listeners registered with the wallet.
        Returns:
        the registered listeners
      • isViewOnly

        boolean isViewOnly()
        Indicates if the wallet is view-only, meaning it does not have the private spend key and can therefore only observe incoming outputs.
        Returns:
        {bool} true if the wallet is view-only, false otherwise
      • setDaemonConnection

        void setDaemonConnection​(java.lang.String uri)
        Set the wallet's daemon connection.
        Parameters:
        uri - is the uri of the daemon for the wallet to use
      • setDaemonConnection

        void setDaemonConnection​(java.lang.String uri,
                                 java.lang.String username,
                                 java.lang.String password)
        Set the wallet's daemon connection.
        Parameters:
        uri - is the daemon's URI
        username - is the username to authenticate with the daemon (optional)
        password - is the password to authenticate with the daemon (optional)
      • setDaemonConnection

        void setDaemonConnection​(MoneroRpcConnection daemonConnection)
        Set the wallet's daemon connection
        Parameters:
        daemonConnection - manages daemon connection information
      • getDaemonConnection

        MoneroRpcConnection getDaemonConnection()
        Get the wallet's daemon connection.
        Returns:
        the wallet's daemon connection
      • isConnectedToDaemon

        boolean isConnectedToDaemon()
        Indicates if the wallet is connected a daemon.
        Returns:
        true if the wallet is connected to a daemon, false otherwise
      • getVersion

        MoneroVersion getVersion()
        Returns the wallet version.
        Returns:
        the wallet version
      • getPath

        java.lang.String getPath()
        Get the wallet's path.
        Returns:
        the path the wallet can be opened with
      • getMnemonic

        java.lang.String getMnemonic()
        Get the wallet's mnemonic phrase.
        Returns:
        the wallet's mnemonic phrase
      • getMnemonicLanguage

        java.lang.String getMnemonicLanguage()
        Get the language of the wallet's mnemonic phrase.
        Returns:
        the language of the wallet's mnemonic phrase
      • getPrivateViewKey

        java.lang.String getPrivateViewKey()
        Get the wallet's private view key.
        Returns:
        the wallet's private view key
      • getPrivateSpendKey

        java.lang.String getPrivateSpendKey()
        Get the wallet's private spend key.
        Returns:
        the wallet's private spend key
      • getPublicViewKey

        java.lang.String getPublicViewKey()
        Get the wallet's public view key.
        Returns:
        the wallet's public view key
      • getPublicSpendKey

        java.lang.String getPublicSpendKey()
        Get the wallet's public spend key.
        Returns:
        the wallet's public spend key
      • getPrimaryAddress

        java.lang.String getPrimaryAddress()
        Get the wallet's primary address.
        Returns:
        the wallet's primary address
      • getAddress

        java.lang.String getAddress​(int accountIdx,
                                    int subaddressIdx)
        Get the address of a specific subaddress.
        Parameters:
        accountIdx - specifies the account index of the address's subaddress
        subaddressIdx - specifies the subaddress index within the account
        Returns:
        the receive address of the specified subaddress
      • getAddressIndex

        MoneroSubaddress getAddressIndex​(java.lang.String address)
        Get the account and subaddress index of the given address.
        Parameters:
        address - is the address to get the account and subaddress index from
        Returns:
        the account and subaddress indices
      • getIntegratedAddress

        MoneroIntegratedAddress getIntegratedAddress()
        Get an integrated address based on this wallet's primary address and a randomly generated payment ID.
        Returns:
        the integrated address
      • getIntegratedAddress

        MoneroIntegratedAddress getIntegratedAddress​(java.lang.String standardAddress,
                                                     java.lang.String paymentId)
        Get an integrated address based on the given standard address and payment ID. Uses the wallet's primary address if an address is not given. Generates a random payment ID if a payment ID is not given.
        Parameters:
        standardAddress - is the standard address to generate the integrated address from (wallet's primary address if null)
        paymentId - is the payment ID to generate an integrated address from (randomly generated if null)
        Returns:
        the integrated address
      • decodeIntegratedAddress

        MoneroIntegratedAddress decodeIntegratedAddress​(java.lang.String integratedAddress)
        Decode an integrated address to get its standard address and payment id.
        Parameters:
        integratedAddress - is an integrated address to decode
        Returns:
        the decoded integrated address including standard address and payment id
      • getHeight

        long getHeight()
        Get the block height that the wallet is synced to.
        Returns:
        the block height that the wallet is synced to
      • getDaemonHeight

        long getDaemonHeight()
        Get the blockchain's height.
        Returns:
        the blockchain's height
      • getHeightByDate

        long getHeightByDate​(int year,
                             int month,
                             int day)
        Get the blockchain's height by date as a conservative estimate for scanning.
        Parameters:
        year - year of the height to get
        month - month of the height to get as a number between 1 and 12
        day - day of the height to get as a number between 1 and 31
        Returns:
        the blockchain's approximate height at the given date
      • sync

        MoneroSyncResult sync()
        Synchronize the wallet with the daemon as a one-time synchronous process.
        Returns:
        the sync result
      • sync

        MoneroSyncResult sync​(MoneroWalletListenerI listener)
        Synchronize the wallet with the daemon as a one-time synchronous process.
        Parameters:
        listener - listener to receive notifications during synchronization
        Returns:
        the sync result
      • sync

        MoneroSyncResult sync​(java.lang.Long startHeight)
        Synchronize the wallet with the daemon as a one-time synchronous process.
        Parameters:
        startHeight - is the start height to sync from (defaults to the last synced block)
        Returns:
        the sync result
      • sync

        MoneroSyncResult sync​(java.lang.Long startHeight,
                              MoneroWalletListenerI listener)
        Synchronize the wallet with the daemon as a one-time synchronous process.
        Parameters:
        startHeight - is the start height to sync from (defaults to the last synced block)
        listener - listener to receive notifications during synchronization
        Returns:
        the sync result
      • startSyncing

        void startSyncing()
        Start background synchronizing.
      • startSyncing

        void startSyncing​(java.lang.Long syncPeriodInMs)
        Start background synchronizing with a maximum period between syncs.
        Parameters:
        syncPeriodInMs - maximum period between syncs in milliseconds
      • stopSyncing

        void stopSyncing()
        Stop synchronizing the wallet with the daemon.
      • rescanSpent

        void rescanSpent()
        Rescan the blockchain for spent outputs. Note: this can only be called with a trusted daemon. Example use case: peer multisig hex is import when connected to an untrusted daemon, so the wallet will not rescan spent outputs. Then the wallet connects to a trusted daemon. This method should be manually invoked to rescan outputs.
      • rescanBlockchain

        void rescanBlockchain()
        Rescan the blockchain from scratch, losing any information which cannot be recovered from the blockchain itself. WARNING: This method discards local wallet data like destination addresses, tx secret keys, tx notes, etc.
      • getBalance

        java.math.BigInteger getBalance()
        Get the wallet's balance.
        Returns:
        the wallet's balance
      • getBalance

        java.math.BigInteger getBalance​(java.lang.Integer accountIdx)
        Get an account's balance.
        Parameters:
        accountIdx - index of the account to get the balance of (default all accounts if null)
        Returns:
        the requested balance
      • getBalance

        java.math.BigInteger getBalance​(java.lang.Integer accountIdx,
                                        java.lang.Integer subaddressIdx)
        Get a subaddress's balance.
        Parameters:
        accountIdx - index of the account to get the balance of (default all accounts if null)
        subaddressIdx - index of the subaddress to get the balance of (default all subaddresses if null)
        Returns:
        the requested balance
      • getUnlockedBalance

        java.math.BigInteger getUnlockedBalance()
        Get the wallet's unlocked balance.
        Returns:
        the wallet's unlocked balance
      • getUnlockedBalance

        java.math.BigInteger getUnlockedBalance​(java.lang.Integer accountIdx)
        Get an account's unlocked balance.
        Parameters:
        accountIdx - index of the account to get the unlocked balance of (default all accounts if null)
        Returns:
        the requested unlocked balance
      • getUnlockedBalance

        java.math.BigInteger getUnlockedBalance​(java.lang.Integer accountIdx,
                                                java.lang.Integer subaddressIdx)
        Get a subaddress's unlocked balance.
        Parameters:
        accountIdx - index of the subaddress to get the unlocked balance of (default all accounts if null)
        subaddressIdx - index of the subaddress to get the unlocked balance of (default all subaddresses if null)
        Returns:
        the requested unlocked balance
      • getAccounts

        java.util.List<MoneroAccount> getAccounts()
        Get all accounts.
        Returns:
        all accounts
      • getAccounts

        java.util.List<MoneroAccount> getAccounts​(boolean includeSubaddresses)
        Get all accounts.
        Parameters:
        includeSubaddresses - specifies if subaddresses should be included
        Returns:
        all accounts
      • getAccounts

        java.util.List<MoneroAccount> getAccounts​(java.lang.String tag)
        Get accounts with a given tag.
        Parameters:
        tag - is the tag for filtering accounts, all accounts if null
        Returns:
        all accounts with the given tag
      • getAccounts

        java.util.List<MoneroAccount> getAccounts​(boolean includeSubaddresses,
                                                  java.lang.String tag)
        Get accounts with a given tag.
        Parameters:
        includeSubaddresses - specifies if subaddresses should be included
        tag - is the tag for filtering accounts, all accounts if null
        Returns:
        all accounts with the given tag
      • getAccount

        MoneroAccount getAccount​(int accountIdx)
        Get an account without subaddress information.
        Parameters:
        accountIdx - specifies the account to get
        Returns:
        the retrieved account
      • getAccount

        MoneroAccount getAccount​(int accountIdx,
                                 boolean includeSubaddresses)
        Get an account.
        Parameters:
        accountIdx - specifies the account to get
        includeSubaddresses - specifies if subaddresses should be included
        Returns:
        the retrieved account
      • createAccount

        MoneroAccount createAccount()
        Create a new account.
        Returns:
        the created account
      • createAccount

        MoneroAccount createAccount​(java.lang.String label)
        Create a new account with a label for the first subaddress.
        Parameters:
        label - specifies the label for account's first subaddress (optional)
        Returns:
        the created account
      • getSubaddresses

        java.util.List<MoneroSubaddress> getSubaddresses​(int accountIdx)
        Get all subaddresses in an account.
        Parameters:
        accountIdx - specifies the account to get subaddresses within
        Returns:
        the retrieved subaddresses
      • getSubaddresses

        java.util.List<MoneroSubaddress> getSubaddresses​(int accountIdx,
                                                         java.util.List<java.lang.Integer> subaddressIndices)
        Get subaddresses in an account.
        Parameters:
        accountIdx - specifies the account to get subaddresses within
        subaddressIndices - are specific subaddresses to get (optional)
        Returns:
        the retrieved subaddresses
      • getSubaddress

        MoneroSubaddress getSubaddress​(int accountIdx,
                                       int subaddressIdx)
        Get a subaddress.
        Parameters:
        accountIdx - specifies the index of the subaddress's account
        subaddressIdx - specifies index of the subaddress within the account
        Returns:
        the retrieved subaddress
      • createSubaddress

        MoneroSubaddress createSubaddress​(int accountIdx)
        Create a subaddress within an account and without a label.
        Parameters:
        accountIdx - specifies the index of the account to create the subaddress within
        Returns:
        the created subaddress
      • createSubaddress

        MoneroSubaddress createSubaddress​(int accountIdx,
                                          java.lang.String label)
        Create a subaddress within an account.
        Parameters:
        accountIdx - specifies the index of the account to create the subaddress within
        label - specifies the the label for the subaddress (optional)
        Returns:
        the created subaddress
      • getTx

        MoneroTxWallet getTx​(java.lang.String txHash)
        Get a wallet transaction by hash.
        Parameters:
        txHash - is the hash of a transaction to get
        Returns:
        the identified transactions
      • getTxs

        java.util.List<MoneroTxWallet> getTxs()
        Get all wallet transactions. Wallet transactions contain one or more transfers that are either incoming or outgoing to the wallet.
        Returns:
        all wallet transactions
      • getTxs

        java.util.List<MoneroTxWallet> getTxs​(java.lang.String... txHashes)
        Get wallet transactions by hash.
        Parameters:
        txHashes - are hashes of transactions to get
        Returns:
        the identified transactions
      • getTxs

        java.util.List<MoneroTxWallet> getTxs​(java.util.List<java.lang.String> txHashes)
        Get wallet transactions by hash.
        Parameters:
        txHashes - are hashes of transactions to get
        Returns:
        the identified transactions
      • getTxs

        java.util.List<MoneroTxWallet> getTxs​(java.util.List<java.lang.String> txHashes,
                                              java.util.Collection<java.lang.String> missingTxHashes)
        Get wallet transactions by hash and collect missing tx hashes.
        Parameters:
        txHashes - are hashes of transactions to get
        missingTxHashes - is populated with requested but missing tx hashes
        Returns:
        the found transactions
      • getTxs

        java.util.List<MoneroTxWallet> getTxs​(MoneroTxQuery query)

        Get wallet transactions that meet the criteria defined in a query object.

        Transactions must meet every criteria defined in the query in order to be returned. All criteria are optional and no filtering is applied when not defined.

        All supported query criteria:
           isConfirmed - path of the wallet to open
           password - password of the wallet to open
           networkType - network type of the wallet to open (one of MoneroNetworkType.MAINNET|TESTNET|STAGENET)
           serverUri - uri of the wallet's daemon (optional)
           serverUsername - username to authenticate with the daemon (optional)
           serverPassword - password to authenticate with the daemon (optional)
           server - MoneroRpcConnection providing server configuration (optional)
           isConfirmed - get txs that are confirmed or not (optional)
           inTxPool - get txs that are in the tx pool or not (optional)
           isRelayed - get txs that are relayed or not (optional)
           isFailed - get txs that are failed or not (optional)
           isMinerTx - get miner txs or not (optional)
           hash - get a tx with the hash (optional)
           hashes - get txs with the hashes (optional)
           paymentId - get transactions with the payment id (optional)
           paymentIds - get transactions with the payment ids (optional)
           hasPaymentId - get transactions with a payment id or not (optional)
           minHeight - get txs with height greater than or equal to the given height (optional)
           maxHeight - get txs with height less than or equal to the given height (optional)
           isOutgoing - get txs with an outgoing transfer or not (optional)
           isIncoming - get txs with an incoming transfer or not (optional)
           transferQuery - get txs that have a transfer that meets this query (optional)
           includeOutputs - specifies that tx outputs should be returned with tx results (optional)

        Parameters:
        query - specifies properties of the transactions to get
        Returns:
        wallet transactions that meet the query
      • getTxs

        java.util.List<MoneroTxWallet> getTxs​(MoneroTxQuery query,
                                              java.util.Collection<java.lang.String> missingTxHashes)

        Get wallet transactions that meet the criteria defined in a query object.

        Transactions must meet every criteria defined in the query in order to be returned. All criteria are optional and no filtering is applied when not defined.

        If querying transactions by hash, unfound or unmet transaction hashes are added to the provided collection.

        All supported query criteria:
           isConfirmed - path of the wallet to open
           password - password of the wallet to open
           networkType - network type of the wallet to open (one of MoneroNetworkType.MAINNET|TESTNET|STAGENET)
           serverUri - uri of the wallet's daemon (optional)
           serverUsername - username to authenticate with the daemon (optional)
           serverPassword - password to authenticate with the daemon (optional)
           server - MoneroRpcConnection providing server configuration (optional)
           isConfirmed - get txs that are confirmed or not (optional)
           inTxPool - get txs that are in the tx pool or not (optional)
           isRelayed - get txs that are relayed or not (optional)
           isFailed - get txs that are failed or not (optional)
           isMinerTx - get miner txs or not (optional)
           hash - get a tx with the hash (optional)
           hashes - get txs with the hashes (optional)
           paymentId - get transactions with the payment id (optional)
           paymentIds - get transactions with the payment ids (optional)
           hasPaymentId - get transactions with a payment id or not (optional)
           minHeight - get txs with height greater than or equal to the given height (optional)
           maxHeight - get txs with height less than or equal to the given height (optional)
           isOutgoing - get txs with an outgoing transfer or not (optional)
           isIncoming - get txs with an incoming transfer or not (optional)
           transferQuery - get txs that have a transfer that meets this query (optional)
           includeOutputs - specifies that tx outputs should be returned with tx results (optional)

        Parameters:
        query - specifies properties of the transactions to get
        missingTxHashes - populated with hashes of unfound or unmet transactions that were queried by hash (throws error if null and queried transaction hashes are unfound or unmet)
        Returns:
        wallet transactions that meet the query
      • getTransfers

        java.util.List<MoneroTransfer> getTransfers()
        Get all incoming and outgoing transfers to and from this wallet. An outgoing transfer represents a total amount sent from one or more subaddresses within an account to individual destination addresses, each with their own amount. An incoming transfer represents a total amount received into a subaddress within an account. Transfers belong to transactions which are stored on the blockchain.
        Returns:
        all wallet transfers
      • getTransfers

        java.util.List<MoneroTransfer> getTransfers​(int accountIdx)
        Get incoming and outgoing transfers to and from an account. An outgoing transfer represents a total amount sent from one or more subaddresses within an account to individual destination addresses, each with their own amount. An incoming transfer represents a total amount received into a subaddress within an account. Transfers belong to transactions which are stored on the blockchain.
        Parameters:
        accountIdx - is the index of the account to get transfers from
        Returns:
        transfers to/from the account
      • getTransfers

        java.util.List<MoneroTransfer> getTransfers​(int accountIdx,
                                                    int subaddressIdx)
        Get incoming and outgoing transfers to and from a subaddress. An outgoing transfer represents a total amount sent from one or more subaddresses within an account to individual destination addresses, each with their own amount. An incoming transfer represents a total amount received into a subaddress within an account. Transfers belong to transactions which are stored on the blockchain.
        Parameters:
        accountIdx - is the index of the account to get transfers from
        subaddressIdx - is the index of the subaddress to get transfers from
        Returns:
        transfers to/from the subaddress
      • getTransfers

        java.util.List<MoneroTransfer> getTransfers​(MoneroTransferQuery query)

        Get tranfsers that meet the criteria defined in a query object.

        Transfers must meet every criteria defined in the query in order to be returned. All criteria are optional and no filtering is applied when not defined.

        All supported query criteria:
           isOutgoing - get transfers that are outgoing or not (optional)
           isIncoming - get transfers that are incoming or not (optional)
           address - wallet's address that a transfer either originated from (if outgoing) or is destined for (if incoming) (optional)
           accountIndex - get transfers that either originated from (if outgoing) or are destined for (if incoming) a specific account index (optional)
           subaddressIndex - get transfers that either originated from (if outgoing) or are destined for (if incoming) a specific subaddress index (optional)
           subaddressIndices - get transfers that either originated from (if outgoing) or are destined for (if incoming) specific subaddress indices (optional)
           amount - amount being transferred (optional)
           destinations - individual destinations of an outgoing transfer, which is local wallet data and NOT recoverable from the blockchain (optional)
           hasDestinations - get transfers that have destinations or not (optional)
           txQuery - get transfers whose transaction meets this query (optional)
        Parameters:
        query - specifies attributes of transfers to get
        Returns:
        wallet transfers that meet the query
      • getIncomingTransfers

        java.util.List<MoneroIncomingTransfer> getIncomingTransfers()
        Get all of the wallet's incoming transfers.
        Returns:
        the wallet's incoming transfers
      • getIncomingTransfers

        java.util.List<MoneroIncomingTransfer> getIncomingTransfers​(MoneroTransferQuery query)

        Get incoming transfers that meet a query.

        All supported query criteria:
           address - get incoming transfers to a specific address in the wallet (optional)
           accountIndex - get incoming transfers to a specific account index (optional)
           subaddressIndex - get incoming transfers to a specific subaddress index (optional)
           subaddressIndices - get transfers destined for specific subaddress indices (optional)
           amount - amount being transferred (optional)
           txQuery - get transfers whose transaction meets this query (optional)

        Parameters:
        query - specifies which incoming transfers to get
        Returns:
        incoming transfers that meet the query
      • getOutgoingTransfers

        java.util.List<MoneroOutgoingTransfer> getOutgoingTransfers()
        Get all of the wallet's outgoing transfers.
        Returns:
        the wallet's outgoing transfers
      • getOutgoingTransfers

        java.util.List<MoneroOutgoingTransfer> getOutgoingTransfers​(MoneroTransferQuery query)

        Get outgoing transfers that meet a query.

        All supported query criteria:
           address - get outgoing transfers from a specific address in the wallet (optional)
           accountIndex - get outgoing transfers from a specific account index (optional)
           subaddressIndex - get outgoing transfers from a specific subaddress index (optional)
           subaddressIndices - get outgoing transfers from specific subaddress indices (optional)
           amount - amount being transferred (optional)
           destinations - individual destinations of an outgoing transfer, which is local wallet data and NOT recoverable from the blockchain (optional)
           hasDestinations - get transfers that have destinations or not (optional)
           txQuery - get transfers whose transaction meets this query (optional)

        Parameters:
        query - specifies which outgoing transfers to get
        Returns:
        outgoing transfers that meet the query
      • getOutputs

        java.util.List<MoneroOutputWallet> getOutputs()
        Get outputs created from previous transactions that belong to the wallet (i.e. that the wallet can spend one time). Outputs are part of transactions which are stored in blocks on the blockchain.
        Returns:
        all wallet outputs
      • getOutputs

        java.util.List<MoneroOutputWallet> getOutputs​(MoneroOutputQuery query)

        Get outputs which meet the criteria defined in a query object.

        Outputs must meet every criteria defined in the query in order to be returned. All criteria are optional and no filtering is applied when not defined.

        All supported query criteria:
           accountIndex - get outputs associated with a specific account index (optional)
           subaddressIndex - get outputs associated with a specific subaddress index (optional)
           subaddressIndices - get outputs associated with specific subaddress indices (optional)
           amount - get outputs with a specific amount (optional)
           minAmount - get outputs greater than or equal to a minimum amount (optional)
           maxAmount - get outputs less than or equal to a maximum amount (optional)
           isSpent - get outputs that are spent or not (optional)
           keyImage - get outputs that match the fields defined in the given key image (optional)
           txQuery - get outputs whose transaction meets this filter (optional)

        Parameters:
        query - specifies attributes of outputs to get
        Returns:
        the queried outputs
      • exportOutputs

        java.lang.String exportOutputs()
        Export outputs since the last export.
        Returns:
        outputs since the last export in hex format
      • exportOutputs

        java.lang.String exportOutputs​(boolean all)
        Export outputs in hex format.
        Parameters:
        all - exports all outputs if true, else exports the outputs since the last export
        Returns:
        outputs in hex format
      • importOutputs

        int importOutputs​(java.lang.String outputsHex)
        Import outputs in hex format.
        Parameters:
        outputsHex - are outputs in hex format
        Returns:
        the number of outputs imported
      • exportKeyImages

        java.util.List<MoneroKeyImage> exportKeyImages()
        Export key images since the last export.
        Returns:
        signed key images since the last export
      • exportKeyImages

        java.util.List<MoneroKeyImage> exportKeyImages​(boolean all)
        Export signed key images.
        Parameters:
        all - exports all key images if true, else exports the key images since the last export
        Returns:
        signed key images
      • importKeyImages

        MoneroKeyImageImportResult importKeyImages​(java.util.List<MoneroKeyImage> keyImages)
        Import signed key images and verify their spent status.
        Parameters:
        keyImages - are key images to import and verify (requires hex and signature)
        Returns:
        results of the import
      • getNewKeyImagesFromLastImport

        java.util.List<MoneroKeyImage> getNewKeyImagesFromLastImport()
        Get new key images from the last imported outputs.
        Returns:
        the key images from the last imported outputs
      • freezeOutput

        void freezeOutput​(java.lang.String keyImage)
        Freeze an output.
        Parameters:
        keyImage - key image of the output to freeze
      • thawOutput

        void thawOutput​(java.lang.String keyImage)
        Thaw a frozen output.
        Parameters:
        keyImage - key image of the output to thaw
      • isOutputFrozen

        boolean isOutputFrozen​(java.lang.String keyImage)
        Check if an output is frozen.
        Parameters:
        keyImage - key image of the output to check if frozen
        Returns:
        true if the output is frozen, false otherwise
      • createTx

        MoneroTxWallet createTx​(MoneroTxConfig config)
        Create a transaction to transfer funds from this wallet.

        All supported configuration:
           address - single destination address (required unless `destinations` provided)
           amount - single destination amount (required unless `destinations` provided)
           accountIndex - source account index to transfer funds from (required)
           subaddressIndex - source subaddress index to transfer funds from (optional)
           subaddressIndices - source subaddress indices to transfer funds from (optional)
           relay - relay the transaction to peers to commit to the blockchain (default false)
           priority - transaction priority (default MoneroTxPriority.NORMAL)
           destinations - addresses and amounts in a multi-destination tx (required unless `address` and `amount` provided)
           paymentId - transaction payment ID (optional)
           unlockHeight - minimum height for the transaction to unlock (default 0)

        Parameters:
        config - configures the transaction to create
        Returns:
        the created transaction
      • createTxs

        java.util.List<MoneroTxWallet> createTxs​(MoneroTxConfig config)
        Create one or more transactions to transfer funds from this wallet.

        All supported configuration:
           address - single destination address (required unless `destinations` provided)
           amount - single destination amount (required unless `destinations` provided)
           accountIndex - source account index to transfer funds from (required)
           subaddressIndex - source subaddress index to transfer funds from (optional)
           subaddressIndices - source subaddress indices to transfer funds from (optional)
           relay - relay the transactions to peers to commit to the blockchain (default false)
           priority - transaction priority (default MoneroTxPriority.NORMAL)
           destinations - addresses and amounts in a multi-destination tx (required unless `address` and `amount` provided)
           paymentId - transaction payment ID (optional)
           unlockHeight - minimum height for the transactions to unlock (default 0)
           canSplit - allow funds to be transferred using multiple transactions (default true)

        Parameters:
        config - configures the transactions to create
        Returns:
        the created transactions
      • sweepOutput

        MoneroTxWallet sweepOutput​(MoneroTxConfig config)
        Sweep an output with a given key image.

        All supported configuration:
           address - single destination address (required)
           keyImage - key image to sweep (required)
           relay - relay the transaction to peers to commit to the blockchain (default false)
           unlockHeight - minimum height for the transaction to unlock (default 0)
           priority - transaction priority (default MoneroTxPriority.NORMAL)

        Parameters:
        config - configures the sweep transaction
        Returns:
        the created transaction
      • sweepUnlocked

        java.util.List<MoneroTxWallet> sweepUnlocked​(MoneroTxConfig config)
        Sweep all unlocked funds according to the given config.

        All supported configuration:
           address - single destination address (required)
           accountIndex - source account index to sweep from (optional, defaults to all accounts)
           subaddressIndex - source subaddress index to sweep from (optional, defaults to all subaddresses)
           subaddressIndices - source subaddress indices to sweep from (optional)
           relay - relay the transactions to peers to commit to the blockchain (default false)
           priority - transaction priority (default MoneroTxPriority.NORMAL)
           unlockHeight - minimum height for the transactions to unlock (default 0)
           sweepEachSubaddress - sweep each subaddress individually if true (default false)

        Parameters:
        config - is the sweep configuration
        Returns:
        the created transactions
      • sweepDust

        java.util.List<MoneroTxWallet> sweepDust​(boolean relay)
        Sweep all unmixable dust outputs back to the wallet to make them easier to spend and mix. NOTE: Dust only exists pre RCT, so this method will throw "no dust to sweep" on new wallets.
        Parameters:
        relay - specifies if the resulting transaction should be relayed (defaults to false i.e. not relayed)
        Returns:
        the created transactions
      • relayTx

        java.lang.String relayTx​(java.lang.String txMetadata)
        Relay a previously created transaction.
        Parameters:
        txMetadata - is transaction metadata previously created without relaying
        Returns:
        the hash of the relayed tx
      • relayTx

        java.lang.String relayTx​(MoneroTxWallet tx)
        Relay a previously created transaction.
        Parameters:
        tx - is the transaction to relay
        Returns:
        the hash of the relayed tx
      • relayTxs

        java.util.List<java.lang.String> relayTxs​(java.util.Collection<java.lang.String> txMetadatas)
        Relay previously created transactions.
        Parameters:
        txMetadatas - are transaction metadata previously created without relaying
        Returns:
        the hashes of the relayed txs
      • relayTxs

        java.util.List<java.lang.String> relayTxs​(java.util.List<MoneroTxWallet> txs)
        Relay previously created transactions.
        Parameters:
        txs - are the transactions to relay
        Returns:
        the hashes of the relayed txs
      • describeUnsignedTxSet

        MoneroTxSet describeUnsignedTxSet​(java.lang.String unsignedTxHex)
        Describe a tx set from unsigned tx hex.
        Parameters:
        unsignedTxHex - unsigned tx hex
        Returns:
        the tx set containing structured transactions
      • describeMultisigTxSet

        MoneroTxSet describeMultisigTxSet​(java.lang.String multisigTxHex)
        Describe a tx set from multisig tx hex.
        Parameters:
        multisigTxHex - multisig tx hex
        Returns:
        the tx set containing structured transactions
      • describeTxSet

        MoneroTxSet describeTxSet​(MoneroTxSet txSet)
        Describe a tx set containing unsigned or multisig tx hex to a new tx set containing structured transactions.
        Parameters:
        txSet - is a tx set containing unsigned or multisig tx hex
        Returns:
        the tx set containing structured transactions
      • signTxs

        java.lang.String signTxs​(java.lang.String unsignedTxHex)
        Sign unsigned transactions from a view-only wallet.
        Parameters:
        unsignedTxHex - is unsigned transaction hex from when the transactions were created
        Returns:
        the signed transaction hex
      • submitTxs

        java.util.List<java.lang.String> submitTxs​(java.lang.String signedTxHex)
        Submit signed transactions from a view-only wallet.
        Parameters:
        signedTxHex - is signed transaction hex from signTxs()
        Returns:
        the resulting transaction hashes
      • signMessage

        java.lang.String signMessage​(java.lang.String message)
        Sign a message.
        Parameters:
        message - is the message to sign
        Returns:
        the signature
      • signMessage

        java.lang.String signMessage​(java.lang.String message,
                                     MoneroMessageSignatureType signatureType,
                                     int accountIdx,
                                     int subaddressIdx)
        Sign a message.
        Parameters:
        message - the message to sign
        signatureType - sign with spend key or view key
        accountIdx - the account index of the message signature (default 0)
        subaddressIdx - the subaddress index of the message signature (default 0)
        Returns:
        the signature
      • verifyMessage

        MoneroMessageSignatureResult verifyMessage​(java.lang.String message,
                                                   java.lang.String address,
                                                   java.lang.String signature)
        Verify a signature on a message.
        Parameters:
        message - is the signed message
        address - is the signing address
        signature - is the signature
        Returns:
        the message signature verification result
      • getTxKey

        java.lang.String getTxKey​(java.lang.String txHash)
        Get a transaction's secret key from its hash.
        Parameters:
        txHash - is the transaction's hash
        Returns:
        is the transaction's secret key
      • checkTxKey

        MoneroCheckTx checkTxKey​(java.lang.String txHash,
                                 java.lang.String txKey,
                                 java.lang.String address)
        Check a transaction in the blockchain with its secret key.
        Parameters:
        txHash - specifies the transaction to check
        txKey - is the transaction's secret key
        address - is the destination public address of the transaction
        Returns:
        the result of the check
      • getTxProof

        java.lang.String getTxProof​(java.lang.String txHash,
                                    java.lang.String address)
        Get a transaction signature to prove it.
        Parameters:
        txHash - specifies the transaction to prove
        address - is the destination public address of the transaction
        Returns:
        the transaction signature
      • getTxProof

        java.lang.String getTxProof​(java.lang.String txHash,
                                    java.lang.String address,
                                    java.lang.String message)
        Get a transaction signature to prove it.
        Parameters:
        txHash - specifies the transaction to prove
        address - is the destination public address of the transaction
        message - is a message to include with the signature to further authenticate the proof (optional)
        Returns:
        the transaction signature
      • checkTxProof

        MoneroCheckTx checkTxProof​(java.lang.String txHash,
                                   java.lang.String address,
                                   java.lang.String message,
                                   java.lang.String signature)
        Prove a transaction by checking its signature.
        Parameters:
        txHash - specifies the transaction to prove
        address - is the destination public address of the transaction
        message - is a message included with the signature to further authenticate the proof (optional)
        signature - is the transaction signature to confirm
        Returns:
        the result of the check
      • getSpendProof

        java.lang.String getSpendProof​(java.lang.String txHash)
        Generate a signature to prove a spend. Unlike proving a transaction, it does not require the destination public address.
        Parameters:
        txHash - specifies the transaction to prove
        Returns:
        the transaction signature
      • getSpendProof

        java.lang.String getSpendProof​(java.lang.String txHash,
                                       java.lang.String message)
        Generate a signature to prove a spend. Unlike proving a transaction, it does not require the destination public address.
        Parameters:
        txHash - specifies the transaction to prove
        message - is a message to include with the signature to further authenticate the proof (optional)
        Returns:
        the transaction signature
      • checkSpendProof

        boolean checkSpendProof​(java.lang.String txHash,
                                java.lang.String message,
                                java.lang.String signature)
        Prove a spend using a signature. Unlike proving a transaction, it does not require the destination public address.
        Parameters:
        txHash - specifies the transaction to prove
        message - is a message included with the signature to further authenticate the proof (optional)
        signature - is the transaction signature to confirm
        Returns:
        true if the signature is good, false otherwise
      • getReserveProofWallet

        java.lang.String getReserveProofWallet​(java.lang.String message)
        Generate a signature to prove the entire balance of the wallet.
        Parameters:
        message - is a message included with the signature to further authenticate the proof (optional)
        Returns:
        the reserve proof signature
      • getReserveProofAccount

        java.lang.String getReserveProofAccount​(int accountIdx,
                                                java.math.BigInteger amount,
                                                java.lang.String message)
        Generate a signature to prove an available amount in an account.
        Parameters:
        accountIdx - specifies the account to prove ownership of the amount
        amount - is the minimum amount to prove as available in the account
        message - is a message to include with the signature to further authenticate the proof (optional)
        Returns:
        the reserve proof signature
      • checkReserveProof

        MoneroCheckReserve checkReserveProof​(java.lang.String address,
                                             java.lang.String message,
                                             java.lang.String signature)
        Proves a wallet has a disposable reserve using a signature.
        Parameters:
        address - is the public wallet address
        message - is a message included with the signature to further authenticate the proof (optional)
        signature - is the reserve proof signature to check
        Returns:
        the result of checking the signature proof
      • getTxNote

        java.lang.String getTxNote​(java.lang.String txHash)
        Get a transaction note.
        Parameters:
        txHash - specifies the transaction to get the note of
        Returns:
        the tx note
      • getTxNotes

        java.util.List<java.lang.String> getTxNotes​(java.util.List<java.lang.String> txHashes)
        Get notes for multiple transactions.
        Parameters:
        txHashes - identify the transactions to get notes for
        Returns:
        notes for the transactions
      • setTxNote

        void setTxNote​(java.lang.String txHash,
                       java.lang.String note)
        Set a note for a specific transaction.
        Parameters:
        txHash - specifies the transaction
        note - specifies the note
      • setTxNotes

        void setTxNotes​(java.util.List<java.lang.String> txHashes,
                        java.util.List<java.lang.String> notes)
        Set notes for multiple transactions.
        Parameters:
        txHashes - specify the transactions to set notes for
        notes - are the notes to set for the transactions
      • getAddressBookEntries

        java.util.List<MoneroAddressBookEntry> getAddressBookEntries()
        Get all address book entries.
        Returns:
        the address book entries
      • getAddressBookEntries

        java.util.List<MoneroAddressBookEntry> getAddressBookEntries​(java.util.List<java.lang.Integer> entryIndices)
        Get address book entries.
        Parameters:
        entryIndices - are indices of the entries to get (optional)
        Returns:
        the address book entries
      • addAddressBookEntry

        int addAddressBookEntry​(java.lang.String address,
                                java.lang.String description)
        Add an address book entry.
        Parameters:
        address - is the entry address
        description - is the entry description (optional)
        Returns:
        the index of the added entry
      • editAddressBookEntry

        void editAddressBookEntry​(int index,
                                  boolean setAddress,
                                  java.lang.String address,
                                  boolean setDescription,
                                  java.lang.String description)
        Edit an address book entry.
        Parameters:
        index - is the index of the address book entry to edit
        setAddress - specifies if the address should be updated
        address - is the updated address
        setDescription - specifies if the description should be updated
        description - is the updated description
      • deleteAddressBookEntry

        void deleteAddressBookEntry​(int entryIdx)
        Delete an address book entry.
        Parameters:
        entryIdx - is the index of the entry to delete
      • tagAccounts

        void tagAccounts​(java.lang.String tag,
                         java.util.Collection<java.lang.Integer> accountIndices)
        Tag accounts.
        Parameters:
        tag - is the tag to apply to the specified accounts
        accountIndices - are the indices of the accounts to tag
      • untagAccounts

        void untagAccounts​(java.util.Collection<java.lang.Integer> accountIndices)
        Untag acconts.
        Parameters:
        accountIndices - are the indices of the accounts to untag
      • getAccountTags

        java.util.List<MoneroAccountTag> getAccountTags()
        Return all account tags.
        Returns:
        the wallet's account tags
      • setAccountTagLabel

        void setAccountTagLabel​(java.lang.String tag,
                                java.lang.String label)
        Sets a human-readable description for a tag.
        Parameters:
        tag - is the tag to set a description for
        label - is the label to set for the tag
      • getPaymentUri

        java.lang.String getPaymentUri​(MoneroTxConfig config)
        Creates a payment URI from a send configuration.
        Parameters:
        config - specifies configuration for a potential tx
        Returns:
        the payment uri
      • parsePaymentUri

        MoneroTxConfig parsePaymentUri​(java.lang.String uri)
        Parses a payment URI to a transaction configuration.
        Parameters:
        uri - is the payment uri to parse
        Returns:
        the send configuration parsed from the uri
      • getAttribute

        java.lang.String getAttribute​(java.lang.String key)
        Get an attribute.
        Parameters:
        key - is the attribute to get the value of
        Returns:
        the attribute's value
      • setAttribute

        void setAttribute​(java.lang.String key,
                          java.lang.String val)
        Set an arbitrary attribute.
        Parameters:
        key - is the attribute key
        val - is the attribute value
      • startMining

        void startMining​(java.lang.Long numThreads,
                         java.lang.Boolean backgroundMining,
                         java.lang.Boolean ignoreBattery)
        Start mining.
        Parameters:
        numThreads - is the number of threads created for mining (optional)
        backgroundMining - specifies if mining should occur in the background (optional)
        ignoreBattery - specifies if the battery should be ignored for mining (optional)
      • stopMining

        void stopMining()
        Stop mining.
      • isMultisigImportNeeded

        boolean isMultisigImportNeeded()
        Indicates if importing multisig data is needed for returning a correct balance.
        Returns:
        true if importing multisig data is needed for returning a correct balance, false otherwise
      • isMultisig

        boolean isMultisig()
        Indicates if this wallet is a multisig wallet.
        Returns:
        true if this is a multisig wallet, false otherwise
      • getMultisigInfo

        MoneroMultisigInfo getMultisigInfo()
        Get multisig info about this wallet.
        Returns:
        multisig info about this wallet
      • prepareMultisig

        java.lang.String prepareMultisig()
        Get multisig info as hex to share with participants to begin creating a multisig wallet.
        Returns:
        this wallet's multisig hex to share with participants
      • makeMultisig

        java.lang.String makeMultisig​(java.util.List<java.lang.String> multisigHexes,
                                      int threshold,
                                      java.lang.String password)
        Make this wallet multisig by importing multisig hex from participants.
        Parameters:
        multisigHexes - are multisig hex from each participant
        threshold - is the number of signatures needed to sign transfers
        password - is the wallet password
        Returns:
        this wallet's multisig hex to share with participants
      • exchangeMultisigKeys

        MoneroMultisigInitResult exchangeMultisigKeys​(java.util.List<java.lang.String> multisigHexes,
                                                      java.lang.String password)
        Exchange multisig hex with participants in a M/N multisig wallet. This process must be repeated with participants exactly N-M times.
        Parameters:
        multisigHexes - are multisig hex from each participant
        password - is the wallet's password // TODO monero-project: redundant? wallet is created with password
        Returns:
        the result which has the multisig's address xor this wallet's multisig hex to share with participants iff not done
      • exportMultisigHex

        java.lang.String exportMultisigHex()
        Export this wallet's multisig info as hex for other participants.
        Returns:
        this wallet's multisig info as hex for other participants
      • importMultisigHex

        int importMultisigHex​(java.lang.String... multisigHexes)
        Import multisig info as hex from other participants.
        Parameters:
        multisigHexes - are multisig hex from each participant
        Returns:
        the number of outputs signed with the given multisig hex
      • importMultisigHex

        int importMultisigHex​(java.util.List<java.lang.String> multisigHexes)
        Import multisig info as hex from other participants.
        Parameters:
        multisigHexes - are multisig hex from each participant
        Returns:
        the number of outputs signed with the given multisig hex
      • signMultisigTxHex

        MoneroMultisigSignResult signMultisigTxHex​(java.lang.String multisigTxHex)
        Sign multisig transactions from a multisig wallet.
        Parameters:
        multisigTxHex - represents unsigned multisig transactions as hex
        Returns:
        the result of signing the multisig transactions
      • submitMultisigTxHex

        java.util.List<java.lang.String> submitMultisigTxHex​(java.lang.String signedMultisigTxHex)
        Submit signed multisig transactions from a multisig wallet.
        Parameters:
        signedMultisigTxHex - is signed multisig hex returned from signMultisigTxHex()
        Returns:
        the resulting transaction hashes
      • changePassword

        void changePassword​(java.lang.String oldPassword,
                            java.lang.String newPassword)
        Change the wallet password.
        Parameters:
        oldPassword - is the wallet's old password
        newPassword - is the wallet's new password
      • save

        void save()
        Save the wallet at its current path.
      • close

        void close()
        Close the wallet (does not save).
      • close

        void close​(boolean save)
        Optionally save then close the wallet.
        Parameters:
        save - specifies if the wallet should be saved before being closed (default false)
      • isClosed

        boolean isClosed()
        Indicates if this wallet is closed or not.
        Returns:
        true if the wallet is closed, false otherwise