Bip44Wallet
This wallet uses a single piece of random data, deriving new private keys and addresses using the technique described in BIP-0032 with key derivation paths specified by BIP-043 and BIP-044. In essence, key derivation is: m/
Constructors
Load an existing wallet
Load an existing wallet
Create a new wallet with a random secret
Create a new wallet given secret words
Properties
Get a set of every address in this wallet
Control whether saving the wallet to underlying storage is automatic (true, default), or initiated by API calls Wallet performance could improve if automaticFlush is false and the wallet is saved rarely. However state may be lost!
This wallet finds its coins on this blockchain
After startup, chainstate should always be set. It connects this wallet to a particular location in the blockchain
Give this wallet access to the historical price (epoch seconds) of its token in the provided fiat currency code
when was this wallet last saved
No addresses have be calculated beyond this index
transactions that this wallet has generated that have not yet been confirmed
Thread that handles keeping wallet synced
This variable captures HD derivation paths that should be monitored and spent but never offered as new payment destinations
Wallet secret seed
Returns the current position of this wallet in the blockchain by block time. Since a fork may have occurred, this information does not unambiguously locate the wallet, but it is valuable for UI.
Returns the current position of this wallet in the blockchain by block hash. Since a fork may have occurred, this information does not unambiguously locate the wallet, but it is valuable for UI.
Returns the current position of this wallet in the blockchain by block height. Since a fork may have occurred, this information does not unambiguously locate the wallet, but it is valuable for UI.
rebroadcast historical unconfirmed transactions every hour (and when we first start up)
rebroadcast wallet transaction every minute
balance of currently unconfirmed tx (that apply to this wallet) -- confirmed balance is in the chainstate object.
Addresses that have already been generated and are in the bloom filter, but are not yet used. Public for display/debugging purposes only. DO NOT USE ADDRESSES OUT OF ORDER!
Functions
Abort this transaction, whose inputs were reserved by "prepareSend". Update the wallet to release all inputs reserved by this transaction
Add this blockchain and start syncing it. (or call @ref addBlockchain do do both). You should determine either earliestHeight or earliestDate, possibly via Rostrum, or you may be in for a very long sync operation.
Return all configured identity domains
This function will split the wallet's native coin so that there are numUtxos of amt satoshis. If the wallet already has some UTXOs that fit the requirements, they count. So its possible that no transactions will be created
This function will split the wallet's Tokens so that there are numUtxos of amt satoshis. If the wallet already has some UTXOs that fit the requirements, they count. So its possible that no transactions will be created
Free up any UTXOs that have been allocated for pending transactions to be used again. This means that they might be double spent if that old reservation is still in progress.
Forget about all unconfirmed transactions in the wallet. It the transactions are in the network and are confirmed they will be added to the wallet at that point. This API is used to clear out tx that will never confirm for some reason. This API causes the wallet to forget about the inputs that weren't confirmed. "Rediscover" can get those back
Forget about certain transactions in the wallet. If the transactions are in the network and are later confirmed they will be added to the wallet then. This API is used to clear out tx that will never confirm for some reason. This API causes the wallet to forget about the inputs that weren't confirmed. "Rediscover" can get those back
track this transaction and periodically resubmit until it has been committed.
Get a repeatable destination, generally used for identity purposes. Given 2 different seeds, this API should at a minimum be statistically unlikely to produce the same address The seed may be public data (a domain name, for example) so wallet security must not depend on it being a secret.
If you provide the complete transaction history prior to the passed point, OR you provide the additional transactions from where this wallet currently is to the passed point, then you can call this function to jump the wallet forward. If you do not provide the complete transaction history, the wallet may attempt to spend already spent coins (if you miss a spend) or not have the complete balance (if you miss a receive). In the receive case, these funds are not "lost" since they are on the blockchain. They are simply inaccessible by this instance of the wallet. If you did a correct recovery, they would appear.
Get the desired fee (in satoshis) for a transaction of the provided size
In case someone sends coins to one of your identities, the wallet should be able to spend them It is not recommended to send coins to identities, as that makes the payments identifiable, and also a subsequent payment may mix other incoming payments with identity payments. So the identity address is never provided as a payment address. However, someone may use it as such.
If you clear the "receiving" addresses map, you need to fill them back up with derived class injected destinations using this function
Find inputs in this wallet to use in a new transaction. This does NOT mark them as used, so cannot be called repeatedly until consumeInputs is called Pass a filter to select a subset of the available UTXOs. This passed function should return the amount "filled" by this input in units of the minAmt parameter. Return 0 to not use this input. Typically what is returned is satoshis, but if you wanted N inputs (irrespective of the amount in them) you could pass N for minAmt, and return 1 in your function. Or you could filter by tokens and return the token amount rather than the satoshi amount...
Find inputs in this wallet to use in a new transaction. This does NOT mark them as used, so cannot be called repeatedly until consumeInputs is called
Bip44 addresses are indexed. This function addresses indexed from 0 to the passed parameter into the list of monitored addresses
This function does not actually store or track the address in the wallet. It simply produces one. It is intended to be used so derived (specialized) wallet classes can provide addresses to a base wallet that saves and tracks addresses.
Get the current address to receive funds. Different wallets may support different payment destination types. This API returns whatever is the "default" type for this wallet. This allows generic algorithms to be created that can be applied to many different wallet types. When this API returns, the destination is ready for use (monitoring is installed in remote nodes, IF any remote nodes exist). This API may pre-generate destinations. This address will be returned until activity is detected on-chain, or until markAddressUsed is called
Gets a new address: convenience function that is functionally similar to @newDestination but mirrors the bitcoin-cli command
Get a new address to receive funds. This will return and "retire" the current address. Different wallets may support different payment destination types. This API returns whatever is the "default" type for this wallet. This allows generic algorithms to be created that can be applied to many different wallet types. When this API returns, the destination is ready for use (monitoring is installed in remote nodes, IF any remote nodes exist). This API may pre-generate destinations.
Wallet implementations may allow access to addresses generated from specific private keys or nonstandard HD derivation paths. The wallet will never offer these destinations as current payment targets. It will only spend them (and show their balance).
wallet history by transaction
all UTXOs that this wallet is capable of spending (and how to spend them) READ ONLY
Place receive addresses into this wallet. These addresses will NOT be given out in @ref getnewaddress queries, but this wallet will monitor these addresses and can spend from them (you must provide the secret as part of PayDestination). Note that if the provided addresses are not derived from the wallet's recovery key, they won't be able to be recovered. Therefore using this API is discouraged for "normal" wallets! Instead "sweep" the coins into an address derived from the wallet's recovery key.
Insert a record into the unspentByAddress structure
returns the balance change for this wallet
Returns whether this address has been provided to the GUI (it may or may not have actually been used by someone)
Load wallet transaction state from the database
Return identity domain data if this domain has previously been used
Return identity domain data if this domain has previously been used
Indicate that an address has been used (maybe it really has, or maybe not, but the point is that its reserved). If we start to run low, we'll also make more
Get the minimum relayable fee (in satoshis) for a transaction of the provided size
Get a new address to receive funds. Different wallets may support different payment destination types. This API returns whatever is the "default" type for this wallet. This allows generic algorithms to be created that can be applied to many different wallet types. When this API returns, the destination is ready for use (monitoring is installed in remote nodes, IF any remote nodes exist). This API may pre-generate destinations.
Tell the wallet that now is a good time to top-up a cache of unused destinations
Creates an unsigned transaction that sends to a list of outputs. This function will select input coins from the wallet to fill the passed quantity and sign the transaction, but will not relay the transaction to the network.
This function re-checks all tx marked unconfirmed in this wallet to see if they are actually unconfirmed. It uses an electrumx server to do so, so may be unavailable if electrumx is not supported or no servers are available.
Search a variety of derivation paths for unspent utxos and add them into this wallet if discovered. These utxos are not swept, so may be forgotten if you recreate this wallet from a recovery key.
Forget all transaction and blockchain state, and the redo the search for wallet transactions.
Forget all transaction and blockchain state, regenerate the first N addresses
Remove identity domain data
Remove identity domain data
clear a change handler that will get called whenever this wallet's state changes
Retire destination removes a PayDestination from the list of destinations we scan for payments. A typical use is for change addresses, since we know that that address will only be used once.
Save wallet transaction state to the database
Post this transaction and update the wallet based on any inputs spent. Typically the provided tx came from calling prepareSend
Send funds to multiple destinations. This function will select input coins from the wallet to fill the passed quantity
Send funds to this destination. This function will select input coins from the wallet to fill the passed quantity
Send tokens to a destination. This is a convenience function to send to one destination. Use send(vararg outputs:iTxOutput...) to send multiple token types at once.
Send funds to multiple destinations (native coin only). This function will select input coins from the wallet to fill the passed quantity
Install a change handler that will get called whenever this wallet's state changes
Sign (using blockchain compatible SHA256 and Schnorr) the provided data with the provided address (this wallet must have the private key for that address), or pass null to use the common identity.
Sign (using blockchain compatible Schnorr) the provided data with the provided address (this wallet must have the private key for that address), or pass null to use the common identity.
Start syncing against the blockchain provided with @ref usesChain, which MUST be called first. (or call @ref addBlockchain do do both). You should determine either earliestHeight or earliestDate, possibly via Rostrum, or you may be in for a very long sync operation.
Report various wallet statistics, see WalletStatistics
Calculate a suggested fee for this transaction
Return whether this wallet is synced with its underlying blockchain. If it is not synced, properties like balance and balanceUnconfirmed express some previous state. In the unsynced case, this API will wait for it to do so, but no more than the provided time in milliseconds. If a height is provided, this API returns true if the wallet is synced up to or beyond this height If a height is not provided (or is -1), this API assumes you mean up to "now". This is special cased with an extra check that the blockchain's tip timestamp is within an hour of now. Of course, since blocks can be discovered at any time, and connected nodes can be slow at processing blocks one cannot ever absolutely know whether the wallet is really synced up to "now", so this function is more accurately described as "nearly synced" for any "now" call.
Return whether this wallet is synced with its underlying blockchain. If it is not synced, properties like balance and balanceUnconfirmed express some previous state. In the unsynced case, this API will wait for it to do so, but no more than the provided time in milliseconds. If a height is provided, this API returns true if the wallet is synced up to or beyond this height If a height is not provided (or is -1), this API assumes you mean up to "now". This is special cased with an extra check that the blockchain's tip timestamp is within an hour of now. Of course, since blocks can be discovered at any time, and connected nodes can be slow at processing blocks one cannot ever absolutely know whether the wallet is really synced up to "now", so this function is more accurately described as "nearly synced" for any "now" call.
This function finds inputs needed to supply funds (token or native) for this transaction, generates change outputs, completes partially-defined output scripts, and signs inputs. All of these functions are enabled/disabled by the "flags" parameter. @paramminConfirms Only fund with coins that have at least this many confirmations @paraminputAmount If non-null, assume existing inputs supply this number of satoshis (do not look up these inputs) @paramflags See TxCompletionFlags If change outputs are required, add them. If mint baton passing outputs are possible then add them if equalizeAuthorities=true If useAuthorities = true, pull in authorities if needed (and available) to handle (mint/melt) operations If fund = true, add native crypto inputs to pay for the transaction @paramadjustableOutput Pass an output index if the fee should be deducted from this output. Otherwise the fee must be taken from extra input @paramdestinationAddress Use this address whenever the completer needs to inject an address into a script or create an additional output. This is typically used for wallets in single-address mode. @throwsWalletException,WalletNotEnoughBalanceException
Checks the transaction's final fee. Throws an exception and aborts the transaction if the fee is too big.
Add or update identity domain data
Add or update identity domain data
verify (using blockchain compatible SHA256 and Schnorr) the provided data with the provided address (this wallet must have the private key for that address), or pass null to use the common identity. Use libnexa.verifySignedHashSchnorr or libnexa.verifySignedDataSchnorr if you need to verify a non-wallet signature with a public key.
verify (using blockchain compatible SHA256 and Schnorr) the provided data with the provided address (this wallet must have the private key for that address), or pass null to use the common identity. Use libnexa.verifySignedHashSchnorr or libnexa.verifySignedDataSchnorr if you need to verify a non-wallet signature with a public key. You may call verifySigForData instead as a shortcut if you have the data "preimage" not the hash and want to automatically use the standard cryptographic hash for this blockchain.