Events
This page lists every event the wallet coordinator emits in libspiffy 6.0.0: its fields, when it is emitted, and whether it is a reply to a request. Events are defined in lib/src/actors/coordinator_messages.dart and exported by package:libspiffy/coordinator.dart. The requests that cause them are on Commands and Queries.
Reading events
Section titled “Reading events”All events extend CoordinatorEvent, which has two members:
walletId(String?): the wallet the event is about, or null when it is not about one wallet.eventTimestamp(DateTime): when the event was made. Since 5.0.0 it is taken when the event is constructed.
You can read events three ways:
libspiffy.coordinator.ask(request)completes with one request’s reply. See Commands.libspiffy.coordinator.on<E>({walletId})is aStream<E>of the events of one type, of one wallet when you givewalletId. Use it for what happens without a request: a balance change, a confirmation, an incoming channel request.libspiffy.coordinatorEventsis the whole stream (a broadcastStream<CoordinatorEvent>?, null before the system is initialized). Replies are published on it too.
// Sketch: assumes an initialized LibSpiffyActorSystem named `libspiffy`.import 'package:libspiffy/coordinator.dart';
void follow() { libspiffy.coordinator .on<BalanceUpdatedEvent>(walletId: 'alice') .listen((e) => print('alice: ${e.totalBalance} sats spendable'));
libspiffy.coordinatorEvents?.listen((event) { switch (event) { case TransactionConfirmedEvent e: print('${e.txid} mined at ${e.blockHeight}'); case ErrorEvent e: print('${e.source} (${e.walletId}): ${e.message}'); default: break; } });}Events emitted before anything listens (for example UnfinishedChannelsFoundEvent at startup) are held and delivered to the first listener, up to 256 of them; beyond that the oldest are dropped with a warning. After the first listener, a broadcast stream delivers only what happens while you listen, so subscribe as soon as the system is initialized.
Each event is announced once. When the projections apply events again at start (after the app was stopped, or from a restored backup), the coordinator announces none of them again; see Recovery after a restart. BalanceUpdatedEvent is the exception: it is announced when the balance differs from the last one announced since the start.
Replies
Section titled “Replies”A reply is an event that extends CoordinatorReply, a subclass of CoordinatorEvent. Each request names its reply type, and the coordinator answers each request with exactly one reply, on success and on failure. A reply adds two members:
requestId(String?): therequestIdof the request it answers. It is null when no request caused the event: the same types are also emitted for what nobody asked, such as a payment that waited for its block header, a peer’s batch of headers, or a channel the counterparty opened.failure(String?): why the request failed, or null when it succeeded.ask()throwsCoordinatorFailurecarrying the reply whenfailureis not null.
For most replies failure is error (or a fixed message) when success is false. Some replies never report a failure themselves, and a failure to answer them arrives as an ErrorEvent naming the request: BalanceResponse, TransactionsResponse, DeferredPaymentsResponse, HeaderSyncStatusResponse, ChannelOpenedEvent, ChannelPaymentEvent, ChannelClosedEvent and ChannelRejectedEvent.
A reclaim the wallet starts itself when a payment’s deadline passes is reported with a DeferredPaymentReclaimedEvent whose requestId is deadline-<txid>.
Error codes
Section titled “Error codes”Since 5.10.0 a reply also has errorCode (SpiffyErrorCode?): why the request failed, as a code your app can put in its own words, or null when it succeeded or the failure has no code. The English error stays, for logs. CoordinatorFailure.spiffyCode reads the code of the reply that failed. SpiffyErrorCode is exported by package:libspiffy/libspiffy.dart.
The replies that set it are ImportCompleteEvent, PaymentReadyEvent, UTXOSplitCompleteEvent, CoinsLockedEvent, CoinsUnlockedEvent, UnlockFeeQuotedEvent, and the five deferred-payment replies.
SpiffyErrorCode |
Meaning |
|---|---|
insufficientFunds |
The wallet’s spendable coins do not cover the amount and its fee. |
addressInvalid |
The text to pay is not an address. |
addressMainnet |
The address to pay is a mainnet address and the wallet is not on mainnet. |
addressTestnet |
The address to pay is a testnet address and the wallet is on mainnet. |
feeRateUnavailable |
ARC’s policy fee rate could not be read, so nothing was built. |
coinsInUse |
The coins chosen are reserved by another payment. |
chainServiceUnreachable |
A blockchain data source or the network could not be reached. |
notInitialized |
The wallet or the actor system has not started. |
timedOut |
An actor or a service did not answer in time. |
cancelled |
The user cancelled it. |
noSuchPayment |
Since 5.17.0. The wallet has no record of the deferred payment named, for example because its wallet was deleted. Asking again will not change that: stop following the payment. |
A code crosses isolates by its name; SpiffyErrorCode.byName reads it back and returns null for a name your version does not know. SpiffyErrorCode.of(error) gives the code of a thrown error. Where libspiffy threw a StateError or ArgumentError before, it now throws SpiffyStateError or SpiffyArgumentError, which carry a code and still match on StateError and on ArgumentError. If your app has an exhaustive switch over SpiffyErrorCode, add a case for each code a new version adds.
All events
Section titled “All events”| Event | Reply to | Also emitted without a request |
|---|---|---|
WalletCreatedEvent |
CreateWalletCommand |
|
WalletDeletedEvent |
DeleteWalletCommand |
|
WalletRenamedEvent |
RenameWalletCommand |
|
ImportCompleteEvent |
ImportWalletCommand |
|
ImportProgressEvent |
not a reply | while an import runs |
ImportUTXOConfirmedEvent |
not a reply | while an import runs |
ImportTransactionConfirmedEvent |
not a reply | while an import runs |
WalletStatusEvent |
not a reply | when the coordinator shuts down |
BalanceUpdatedEvent |
not a reply | when a wallet’s balance changes |
TransactionRecordedEvent |
RecordOutgoingCommand |
|
TransactionConfirmedEvent |
not a reply | when a proof confirms a transaction |
TransactionConfirmationRevertedEvent |
not a reply | when a confirmation is taken back |
TransactionImportedEvent |
ImportTransactionCommand |
yes |
SPVValidationResultEvent |
not a reply | when SPV validation of an import has a verdict |
AddressGeneratedEvent |
GenerateAddressCommand |
|
WatchAddressRegisteredEvent |
RegisterWatchAddressCommand |
|
UTXOsReleasedEvent |
ReleaseUTXOsCommand |
|
InvoiceCreatedEvent |
CreateInvoiceCommand |
|
InvoicePaidEvent |
not a reply | when an invoice is paid |
PaymentReadyEvent |
PayInvoiceCommand |
|
PaymentAcceptedEvent |
not a reply | when ARC accepts a received payment still in flight |
BEEFValidationResultEvent |
ValidateBEEFCommand |
yes |
BEEFSettledEvent |
SettleBEEFCommand |
|
BroadcastFailureEvent |
not a reply | when an ARC broadcast fails |
ProvisioningCompleteEvent |
ProvisionFundingCommand |
|
TimestampCompleteEvent |
TimestampCommand |
|
UTXOSplitStartedEvent |
not a reply | when a split starts |
UTXOSplitCompleteEvent |
SplitUTXOsCommand |
|
ForeignSpendsCheckedEvent |
CheckForeignSpendsCommand |
|
DeferredPaymentBroadcastEvent |
BroadcastDeferredPaymentCommand |
|
DeferredPaymentStatusEvent |
CheckDeferredPaymentStatusCommand |
|
DeferredPaymentCancelledEvent |
CancelDeferredPaymentCommand |
|
DeferredPaymentReclaimedEvent |
ReclaimDeferredPaymentCommand |
at a payment’s deadline |
DeferredPaymentCompletedEvent |
CompleteDeferredPaymentCommand |
|
CoinsLockedEvent |
LockCoinsCommand |
|
CoinsUnlockedEvent |
UnlockCoinsCommand |
|
UnlockFeeQuotedEvent |
QuoteUnlockFeeCommand |
|
ChannelRequestReceivedEvent |
not a reply | when a peer asks to open a channel |
ChannelOpenedEvent |
OpenChannelCommand |
yes |
ChannelAcceptedEvent |
AcceptChannelCommand |
|
ChannelRejectedEvent |
RejectChannelCommand |
|
ChannelPaymentPendingEvent |
not a reply | when a client’s payment is signed and sent |
ChannelPaymentEvent |
ChannelPayCommand |
yes |
ChannelClosedEvent |
CloseChannelCommand |
yes |
ChannelExpiredEvent |
ExpireChannelCommand |
|
ChannelRefundClaimedEvent |
ClaimChannelRefundCommand |
|
ChannelFundingRetriedEvent |
RetryChannelFundingCommand |
|
ChannelOpenResentEvent |
ResendChannelOpenCommand |
|
UnfinishedChannelsFoundEvent |
not a reply | once at startup |
ChannelPeerAwayEvent |
not a reply | when a channel’s peer cannot be reached |
P2PMessageToSendEvent |
not a reply | when a peer must be sent a message |
AncestorProofRequestedEvent |
RequestAncestorProofCommand |
|
AncestorProofResponseEvent |
not a reply | when a peer’s proof response is processed |
AncestorProofRequestReceivedEvent |
not a reply | when a peer asks for a proof |
AnchorPublicKeyEvent |
IssueAnchorKeyCommand |
|
AnchorSignedEvent |
SignWithAnchorKeyCommand |
|
Brc100KeyOperationEvent |
Brc100KeyOperationCommand |
|
Type42DestinationEvent |
DeriveType42DestinationCommand |
|
Type42AddressesRecordedEvent |
RecordType42AddressesCommand |
|
Type42DestinationsRecordedEvent |
RecordType42DestinationsCommand |
|
MessageSignedEvent |
SignMessageCommand |
|
TransactionBroadcastEvent |
BroadcastTransactionCommand |
|
BlockHeadersStoredEvent |
StoreHeadersCommand |
for peers’ batches |
HeaderSyncStatusEvent |
not a reply | when header sync catches up or falls behind |
BalanceResponse |
GetBalanceQuery |
|
TransactionsResponse |
GetTransactionsQuery |
|
TransactionDetailResponse |
GetTransactionDetailQuery |
|
TransactionExportedEvent |
ExportTransactionQuery |
|
DeferredPaymentsResponse |
GetDeferredPaymentsQuery |
|
HeaderSyncStatusResponse |
GetHeaderSyncStatusQuery |
|
ErrorEvent |
not a reply; names the request that caused it | yes |
Wallets and import
Section titled “Wallets and import”WalletCreatedEvent
Section titled “WalletCreatedEvent”Reply to CreateWalletCommand. On success it is emitted once the read model holds the wallet. failure: error when success is false.
| Field | Type |
|---|---|
walletId |
String |
requestId |
String? |
rootAddress |
String? |
success |
bool |
error |
String? |
WalletDeletedEvent
Section titled “WalletDeletedEvent”Reply to DeleteWalletCommand, once the deletion is journaled and the read model no longer holds the wallet. failure: error when success is false, including a refusal by the wallet.
| Field | Type |
|---|---|
walletId |
String |
requestId |
String? |
success |
bool |
error |
String? |
WalletRenamedEvent
Section titled “WalletRenamedEvent”Since 5.5.0. Reply to RenameWalletCommand, sent once the wallet row holds name. failure: error when success is false.
| Field | Type |
|---|---|
walletId |
String |
requestId |
String? |
name |
String |
success |
bool |
error |
String? |
ImportCompleteEvent
Section titled “ImportCompleteEvent”Reply to ImportWalletCommand, when the import ends. transactionCount is what this run recorded, transactionsSkipped what the wallet already held, and transactionsFailed what could not be fetched or proven. unminedPayments (since 5.16.0) counts payments to a named-address scan’s addresses that are still in the mempool and that the wallet checked and took as on the way. A successful import with transactionsFailed above zero is incomplete: send ImportWalletCommand again with resume: true. failure: error when success is false, for example an import with no key or no blockchain data source.
| Field | Type |
|---|---|
walletId |
String |
requestId |
String? |
success |
bool |
error |
String? |
errorCode |
SpiffyErrorCode? |
addressCount |
int |
transactionCount |
int |
transactionsSkipped |
int |
transactionsFailed |
int |
unminedPayments |
int |
ImportProgressEvent
Section titled “ImportProgressEvent”Emitted repeatedly while ImportWalletCommand runs. progress is the fraction done, from 0.0 to 1.0. step (since 5.10.0) is what the import is doing, for your app to put in its own words: an ImportStep (exported by package:libspiffy/libspiffy.dart), one of opening, discovering, fetching, recording, finalizing and done. phase and the English message stay, for logs.
| Field | Type |
|---|---|
walletId |
String |
phase |
String |
step |
ImportStep |
progress |
double |
message |
String |
addressesFound |
int |
totalAddresses |
int |
transactionsProcessed |
int |
totalTransactions |
int |
ImportUTXOConfirmedEvent
Section titled “ImportUTXOConfirmedEvent”Emitted during an import when the wallet aggregate records an imported UTXO.
| Field | Type |
|---|---|
walletId |
String |
txid |
String |
vout |
int |
success |
bool |
error |
String? |
ImportTransactionConfirmedEvent
Section titled “ImportTransactionConfirmedEvent”Emitted during an import when the wallet aggregate records an imported transaction.
| Field | Type |
|---|---|
walletId |
String |
txid |
String |
success |
bool |
error |
String? |
WalletStatusEvent
Section titled “WalletStatusEvent”Emitted when the coordinator shuts down (status shutdown).
| Field | Type |
|---|---|
walletId |
String? |
status |
String |
message |
String |
Balances and transactions
Section titled “Balances and transactions”BalanceUpdatedEvent
Section titled “BalanceUpdatedEvent”Emitted when the read model applies an event that changes a wallet’s balance, and only when a number differs from the last one announced for that wallet. The numbers are computed by the same code as BalanceResponse. totalBalance is confirmedBalance + unconfirmedBalance; pendingBalance, watchOnlyBalance, reservedBalance and lockedBalance are not part of it.
| Field | Type |
|---|---|
walletId |
String |
confirmedBalance |
BigInt |
unconfirmedBalance |
BigInt |
totalBalance |
BigInt |
pendingBalance |
BigInt |
watchOnlyBalance |
BigInt |
reservedBalance |
BigInt |
lockedBalance |
BigInt |
TransactionRecordedEvent
Section titled “TransactionRecordedEvent”Reply to RecordOutgoingCommand, once the transaction is journaled and the read model holds it. amountSatoshis is null when the wallet had recorded the transaction already. failure: error when success is false.
| Field | Type |
|---|---|
walletId |
String |
requestId |
String? |
txid |
String |
amountSatoshis |
BigInt? |
success |
bool |
error |
String? |
TransactionConfirmedEvent
Section titled “TransactionConfirmedEvent”Emitted when a merkle proof places the transaction in a block whose header is on the local active chain. It carries no confirmation count: compute tip height - blockHeight + 1 if you need a depth.
| Field | Type |
|---|---|
walletId |
String |
txid |
String |
blockHeight |
int |
TransactionConfirmationRevertedEvent
Section titled “TransactionConfirmationRevertedEvent”Emitted when a confirmation is taken back: the block left the active chain in a reorg, or the header at the proof’s height contradicts the proof. The transaction is unconfirmed again until a fresh proof arrives, and TransactionConfirmedEvent is then emitted again.
| Field | Type |
|---|---|
walletId |
String |
txid |
String |
blockHeight |
int? |
blockHash |
String? |
reason |
String |
TransactionImportedEvent
Section titled “TransactionImportedEvent”Reply to ImportTransactionCommand, once the read model holds the transaction. Also emitted, with a null requestId, for transactions received that nobody requested, such as a proven foreign spender or a peer’s proof response. totalValueReceived is a decimal string of satoshis. failure: error when success is false, for example a BEEF without the proof of its last transaction.
| Field | Type |
|---|---|
walletId |
String |
requestId |
String? |
transactionId |
String |
success |
bool |
utxosCreated |
int? |
totalValueReceived |
String? |
error |
String? |
SPVValidationResultEvent
Section titled “SPVValidationResultEvent”Emitted for an imported transaction once SPV validation has a verdict (not for a payment received with ValidateBEEFCommand, which gets BEEFValidationResultEvent).
| Field | Type |
|---|---|
walletId |
String? |
txid |
String |
isValid |
bool |
validationError |
String? |
spendableUTXOs |
List<Map<String, dynamic>> |
spentUTXOs |
List<Map<String, dynamic>> |
unreadableOutputs |
List<Map<String, dynamic>> |
Addresses and UTXOs
Section titled “Addresses and UTXOs”AddressGeneratedEvent
Section titled “AddressGeneratedEvent”Reply to GenerateAddressCommand, once the read model holds the address. chain is AddressChain.receive, .change or .delegated. publicKeyHex is set only when the command asked for it. failure: error when success is false.
| Field | Type |
|---|---|
walletId |
String |
requestId |
String? |
success |
bool |
address |
String? |
derivationIndex |
int? |
chain |
AddressChain? |
publicKeyHex |
String? |
error |
String? |
WatchAddressRegisteredEvent
Section titled “WatchAddressRegisteredEvent”Reply to RegisterWatchAddressCommand. failure: error when success is false.
| Field | Type |
|---|---|
walletId |
String |
requestId |
String? |
address |
String |
success |
bool |
error |
String? |
UTXOsReleasedEvent
Section titled “UTXOsReleasedEvent”Reply to ReleaseUTXOsCommand, once the read model shows the release. releasedUtxoKeys is empty when the reservation held none (already released, or expired). failure: error when success is false.
| Field | Type |
|---|---|
walletId |
String |
requestId |
String? |
reservationId |
String |
releasedUtxoKeys |
List<String> |
success |
bool |
error |
String? |
Invoices and payments
Section titled “Invoices and payments”InvoiceCreatedEvent
Section titled “InvoiceCreatedEvent”Reply to CreateInvoiceCommand. issuedAddresses lists the addresses the wallet issued, each with its address, chain and derivationIndex; an address you supplied in an output is not among them. failure: error when success is false.
| Field | Type |
|---|---|
walletId |
String |
requestId |
String? |
invoiceId |
String |
addresses |
List<String> |
amount |
BigInt |
outputs |
List<InvoiceOutputSpec>? |
issuedAddresses |
List<IssuedAddress> |
description |
String? |
expiresAt |
DateTime? |
success |
bool |
error |
String? |
InvoicePaidEvent
Section titled “InvoicePaidEvent”Emitted when the invoice read model records a payment of the invoice.
| Field | Type |
|---|---|
walletId |
String |
invoiceId |
String |
txid |
String |
amountReceived |
BigInt |
PaymentReadyEvent
Section titled “PaymentReadyEvent”Reply to PayInvoiceCommand. beefBytes is the payment to hand to the recipient; it has not been broadcast. witnessTxid and witnessBeefBytes are set only for a payment with a paired witness transaction. failure: error when success is false.
| Field | Type |
|---|---|
walletId |
String? |
requestId |
String? |
invoiceId |
String |
beefBytes |
Uint8List |
txid |
String |
amountPaid |
BigInt |
changeAmount |
BigInt |
ancestorCount |
int |
success |
bool |
error |
String? |
errorCode |
SpiffyErrorCode? |
witnessTxid |
String? |
witnessBeefBytes |
Uint8List? |
PaymentAcceptedEvent
Section titled “PaymentAcceptedEvent”Since 5.13.0. Not a reply. A payment this wallet received has validated, the read model holds it, and ARC accepted its submission but is still taking it to the network (networkStatus, for example Arcade’s RECEIVED). It comes before the same payment’s BEEFValidationResultEvent, which still follows with the status the network reached. A payee can answer its payer at this event and tell it the outcome at the reply. Nothing is decided here: the invoice is marked paid only when the network holds the payment. A payment whose first ARC answer is already final (seen, mined or refused) gets no such event.
| Field | Type |
|---|---|
walletId |
String |
invoiceId |
String? |
txid |
String |
networkStatus |
String |
requestId |
String? |
requestId is the ValidateBEEFCommand’s, when known. Follow it with coordinator.on<PaymentAcceptedEvent>(walletId: ...).
BEEFValidationResultEvent
Section titled “BEEFValidationResultEvent”Reply to ValidateBEEFCommand, after the payment is validated, recorded and, if it carries no proof of its own, submitted to ARC. valid means it is recorded and queryable; broadcasted means ARC accepted it, with ARC’s status in networkStatus. With awaitingHeader: true the reply is not a verdict: a second event follows when the block header arrives, also after a restart. failure: error when valid is false.
| Field | Type |
|---|---|
walletId |
String? |
requestId |
String? |
invoiceId |
String? |
txid |
String? |
valid |
bool |
error |
String? |
broadcasted |
bool |
networkStatus |
String? |
broadcastError |
String? |
awaitingHeader |
bool |
spendableUTXOs |
List<Map<String, dynamic>>? |
unreadableOutputs |
List<Map<String, dynamic>> |
BEEFSettledEvent
Section titled “BEEFSettledEvent”Reply to SettleBEEFCommand. failedTxids and failureErrors have the same length and order. failure: error when success is false.
| Field | Type |
|---|---|
walletId |
String? |
requestId |
String? |
txid |
String |
success |
bool |
error |
String? |
submittedCount |
int |
skippedCount |
int |
failedCount |
int |
failedTxids |
List<String> |
failureErrors |
List<String> |
BroadcastFailureEvent
Section titled “BroadcastFailureEvent”Emitted when an ARC broadcast fails outside a SettleBEEFCommand. The coordinator sets willRetry to true: the broadcast is handed to the durable retry queue.
| Field | Type |
|---|---|
walletId |
String? |
txid |
String |
error |
String |
willRetry |
bool |
ProvisioningCompleteEvent
Section titled “ProvisioningCompleteEvent”Reply to ProvisionFundingCommand. failure: error when success is false.
| Field | Type |
|---|---|
walletId |
String? |
requestId |
String? |
transactionCount |
int |
earmarkCount |
int |
success |
bool |
error |
String? |
TimestampCompleteEvent
Section titled “TimestampCompleteEvent”Reply to TimestampCommand, after ARC answers the broadcast. transactionId is the transaction carrying the hashes. failure: error when success is false.
| Field | Type |
|---|---|
walletId |
String? |
requestId |
String? |
archiveId |
String |
transactionId |
String? |
success |
bool |
error |
String? |
UTXOSplitStartedEvent
Section titled “UTXOSplitStartedEvent”Emitted when a SplitUTXOsCommand can start: the UTXOs are chosen and the first split transaction is about to be built. Not emitted when the split cannot start; the reply then reports the error.
| Field | Type |
|---|---|
walletId |
String |
utxoCount |
int |
targetOutputsPerUtxo |
int |
UTXOSplitCompleteEvent
Section titled “UTXOSplitCompleteEvent”Reply to SplitUTXOsCommand. transactionCount is the number of split transactions ARC accepted or queued (the length of txids); newUtxoCount is the outputs they create. splits has one SplitTransactionOutcome per source UTXO, in order. failure: error when success is false.
| Field | Type |
|---|---|
walletId |
String |
requestId |
String? |
transactionCount |
int |
newUtxoCount |
int |
totalFeePaid |
BigInt |
success |
bool |
error |
String? |
errorCode |
SpiffyErrorCode? |
txids |
List<String> |
splits |
List<SplitTransactionOutcome> |
SplitTransactionOutcome has txid (String?, null when no transaction was built), sourceUtxoKey (String), status (SplitTransactionStatus), networkStatus (String?), error (String?), feePaid (BigInt?) and isSuccess (true for accepted and queued). SplitTransactionStatus is one of accepted, queued, contested, rejected, notBroadcast, unanswered, notRecorded and notBuilt.
ForeignSpendsCheckedEvent
Section titled “ForeignSpendsCheckedEvent”Reply to CheckForeignSpendsCommand, once the read model shows what was recorded. spends lists the outputs another transaction spent; unchecked maps each output whose check failed to the reason. failure: error when success is false.
| Field | Type |
|---|---|
walletId |
String |
requestId |
String? |
success |
bool |
checked |
List<String> |
spends |
List<ForeignSpend> |
unchecked |
Map<String, String> |
error |
String? |
Deferred payments
Section titled “Deferred payments”Since 5.17.0 every deferred-payment reply carries errorCode, set to SpiffyErrorCode.noSuchPayment when the wallet has no record of the payment, for example because its wallet was deleted. Stop following such a payment. The field tables below include it.
DeferredPaymentBroadcastEvent
Section titled “DeferredPaymentBroadcastEvent”Reply to BroadcastDeferredPaymentCommand. success means the network holds the transaction (SEEN_ON_NETWORK or MINED). source is arc or dataSource. confirmed means a MINED answer’s proof matched the local headers. competingTxids is set for a DOUBLE_SPEND_ATTEMPTED answer. failure: error when success is false.
| Field | Type |
|---|---|
walletId |
String |
txid |
String |
requestId |
String? |
success |
bool |
networkStatus |
String? |
source |
String? |
confirmed |
bool |
willRetry |
bool |
error |
String? |
errorCode |
SpiffyErrorCode? |
competingTxids |
List<String> |
DeferredPaymentStatusEvent
Section titled “DeferredPaymentStatusEvent”Reply to CheckDeferredPaymentStatusCommand. success means a source answered. proofStatus is verified, headerUnknown, rootMismatch, malformed, or null without a proof. failure: error when success is false.
| Field | Type |
|---|---|
walletId |
String |
txid |
String |
requestId |
String? |
success |
bool |
networkStatus |
String? |
source |
String? |
blockHeight |
int? |
proofStatus |
String? |
confirmed |
bool |
error |
String? |
errorCode |
SpiffyErrorCode? |
competingTxids |
List<String> |
DeferredPaymentCancelledEvent
Section titled “DeferredPaymentCancelledEvent”Reply to CancelDeferredPaymentCommand. networkStatus is what the network check before the cancellation answered; releasedUtxoKeys are the inputs released. failure: error when success is false.
| Field | Type |
|---|---|
walletId |
String |
txid |
String |
requestId |
String? |
success |
bool |
networkStatus |
String? |
releasedUtxoKeys |
List<String> |
error |
String? |
errorCode |
SpiffyErrorCode? |
DeferredPaymentReclaimedEvent
Section titled “DeferredPaymentReclaimedEvent”Reply to ReclaimDeferredPaymentCommand. Also emitted, with requestId deadline-<txid>, for a reclaim the wallet starts itself when a payment’s deadline passes. success means the self-spend is journaled and the network holds it. Otherwise the payment stays outstanding and resolves as reclaimed if the network reports the self-spend later. failure: error when success is false.
| Field | Type |
|---|---|
walletId |
String |
txid |
String |
reclaimTxid |
String? |
requestId |
String? |
success |
bool |
reclaimedUtxoKeys |
List<String> |
reclaimedSatoshis |
BigInt? |
fee |
BigInt? |
toAddress |
String? |
networkStatus |
String? |
source |
String? |
competingTxids |
List<String> |
error |
String? |
errorCode |
SpiffyErrorCode? |
DeferredPaymentCompletedEvent
Section titled “DeferredPaymentCompletedEvent”Reply to CompleteDeferredPaymentCommand. On success the completed transaction completedTxid is recorded and holds the half-signed payment’s inputs. failure: error when success is false.
| Field | Type |
|---|---|
walletId |
String |
txid |
String |
completedTxid |
String? |
requestId |
String? |
success |
bool |
error |
String? |
errorCode |
SpiffyErrorCode? |
Locked coins
Section titled “Locked coins”CoinsLockedEvent
Section titled “CoinsLockedEvent”Since 5.11.0. Reply to LockCoinsCommand, after ARC answers the broadcast. transactionId is set once the lock transaction was built, even when its broadcast failed. ownerAddress is the wallet address the coin is locked to. failure: error when success is false.
| Field | Type |
|---|---|
walletId |
String? |
requestId |
String? |
transactionId |
String? |
ownerAddress |
String? |
lockHeight |
int |
amount |
BigInt |
success |
bool |
error |
String? |
errorCode |
SpiffyErrorCode? |
CoinsUnlockedEvent
Section titled “CoinsUnlockedEvent”Since 5.11.0. Reply to UnlockCoinsCommand, after ARC answers the broadcast. transactionId is set once the unlock was built, even when its broadcast failed. amount is what came back to the wallet: the coin less the fee. failure: error when success is false.
| Field | Type |
|---|---|
walletId |
String? |
requestId |
String? |
utxoKey |
String |
transactionId |
String? |
amount |
BigInt? |
success |
bool |
error |
String? |
errorCode |
SpiffyErrorCode? |
UnlockFeeQuotedEvent
Section titled “UnlockFeeQuotedEvent”Since 5.12.0. Reply to QuoteUnlockFeeCommand. fee is the fee of one unlock in satoshis at ARC’s policy rate, or null when the rate could not be read (errorCode feeRateUnavailable). walletId is always null. failure: error when success is false.
| Field | Type |
|---|---|
requestId |
String? |
lockingScriptLength |
int |
fee |
BigInt? |
success |
bool |
error |
String? |
errorCode |
SpiffyErrorCode? |
Channels
Section titled “Channels”ChannelRequestReceivedEvent
Section titled “ChannelRequestReceivedEvent”Emitted when a peer asks to open a channel with you. Answer with AcceptChannelCommand or RejectChannelCommand.
| Field | Type |
|---|---|
channelId |
String |
clientPeerId |
String |
clientPubKey |
String |
clientAddress |
String |
fundingAmountSats |
int |
lockTimeUnix |
int |
context |
String? |
walletId is always null.
ChannelOpenedEvent
Section titled “ChannelOpenedEvent”Reply to OpenChannelCommand, once the server has opened the channel and its channel_opened arrived. Also emitted, with a null requestId, when a channel this node serves opens, and on a client whose open request already failed with stillSent true when the server opens the channel later. failure is always null: a failed open is an ErrorEvent naming the request.
| Field | Type |
|---|---|
walletId |
String |
requestId |
String? |
channelId |
String |
fundingTxId |
String? |
fundingAmountSats |
int |
ChannelAcceptedEvent
Section titled “ChannelAcceptedEvent”Reply to AcceptChannelCommand, once the acceptance is journaled and channel_accept is handed to your transport. The channel opens when the client funds it (ChannelOpenedEvent). failure: error when success is false.
| Field | Type |
|---|---|
walletId |
String |
requestId |
String? |
channelId |
String |
success |
bool |
error |
String? |
ChannelRejectedEvent
Section titled “ChannelRejectedEvent”Reply to RejectChannelCommand. clientTold is true when a request from the client was held and channel_reject was handed to your transport. failure is always null.
| Field | Type |
|---|---|
requestId |
String? |
channelId |
String |
clientTold |
bool |
walletId is always null.
ChannelPaymentEvent
Section titled “ChannelPaymentEvent”Reply to ChannelPayCommand, once the server acknowledges the payment (payment_ack), or once a settlement that pays it closes the channel. Also emitted, with a null requestId, for a payment received on a channel this node serves, and on a client for a payment acknowledged after its request already failed with stillSent true. failure is always null: a refused or unacknowledged payment is an ErrorEvent naming the request.
| Field | Type |
|---|---|
walletId |
String? |
requestId |
String? |
channelId |
String |
amountSats |
int |
sequence |
int |
clientBalance |
int |
serverBalance |
int |
ChannelPaymentPendingEvent
Section titled “ChannelPaymentPendingEvent”Emitted on the client when a payment is signed and payment_update is sent, before the server acknowledges it. The ChannelPayCommand is answered later, by a ChannelPaymentEvent or an ErrorEvent.
| Field | Type |
|---|---|
walletId |
String? |
channelId |
String |
amountSats |
int |
sequence |
int |
clientBalance |
int |
serverBalance |
int |
ChannelClosedEvent
Section titled “ChannelClosedEvent”Reply to CloseChannelCommand. Also emitted, with a null requestId, for a channel closed by the counterparty or by a server’s settlement timer. finalClientBalance and finalServerBalance are what the settlement pays each side; on a client whose latest payment the server never received, the server gets less than that payment gave it. Both are null when the event answers a close of a channel that was already closed. failure is always null: a failed close is an ErrorEvent naming the request.
| Field | Type |
|---|---|
walletId |
String? |
requestId |
String? |
channelId |
String |
reason |
String? |
settlementTxId |
String? |
finalClientBalance |
int? |
finalServerBalance |
int? |
ChannelExpiredEvent
Section titled “ChannelExpiredEvent”Reply to ExpireChannelCommand, once the expiry is journaled. failure: error when success is false.
| Field | Type |
|---|---|
walletId |
String? |
requestId |
String? |
channelId |
String |
success |
bool |
error |
String? |
ChannelRefundClaimedEvent
Section titled “ChannelRefundClaimedEvent”Reply to ClaimChannelRefundCommand, on success and failure. refundTxId is null when the claim failed before a refund was read from the channel’s state. failure: error when success is false.
| Field | Type |
|---|---|
walletId |
String? |
requestId |
String? |
channelId |
String |
refundTxId |
String? |
success |
bool |
error |
String? |
ChannelFundingRetriedEvent
Section titled “ChannelFundingRetriedEvent”Reply to RetryChannelFundingCommand, on success and failure. On success channel_open is sent, and ChannelOpenedEvent follows once the server opens the channel. failure: error when success is false.
| Field | Type |
|---|---|
walletId |
String? |
requestId |
String? |
channelId |
String |
fundingTxId |
String? |
success |
bool |
error |
String? |
ChannelOpenResentEvent
Section titled “ChannelOpenResentEvent”Reply to ResendChannelOpenCommand, on success and failure. toPeerId names the peer channel_open was re-sent to; it goes on being resent until the server’s channel_opened. failure: error when success is false.
| Field | Type |
|---|---|
walletId |
String? |
requestId |
String? |
channelId |
String |
toPeerId |
String? |
fundingTxId |
String? |
success |
bool |
error |
String? |
UnfinishedChannelsFoundEvent
Section titled “UnfinishedChannelsFoundEvent”Emitted once at startup for each wallet with channels that started opening and never reached open. The event only reports; a client channel whose funding was sent resends its channel_open by itself. Not emitted when there is nothing to report.
| Field | Type |
|---|---|
walletId |
String? |
channels |
List<UnfinishedChannel> |
UnfinishedChannel has channelId (String), state (String, opening or funding), counterpartyPeerId (String?), fundingAmountSats (BigInt) and lockTimeUnix (int). Carry on with RetryChannelFundingCommand or ResendChannelOpenCommand, or take the funding inputs back with CancelDeferredPaymentCommand.
ChannelPeerAwayEvent
Section titled “ChannelPeerAwayEvent”Emitted on a client when a channel’s peer cannot be reached: the resends of its messages backed off to ChannelTiming.resendAtMost and the last send failed. The messages are kept and no longer resent. Tell the coordinator ChannelPeerReachable when the peer is back; a channel message from the peer resumes them too.
| Field | Type |
|---|---|
walletId |
String? |
channelId |
String |
peerId |
String |
Peer-to-peer messages and proofs
Section titled “Peer-to-peer messages and proofs”P2PMessageToSendEvent
Section titled “P2PMessageToSendEvent”Emitted when the library has a message for a peer. Your app sends payload to toPeerId on its own transport, and tells the coordinator P2PSendFailed when it cannot. The channel protocol uses the messageTypes channel_request, channel_accept, channel_reject, refund_sign_request, refund_signed, channel_open, channel_opened, payment_update, payment_ack, channel_close, channel_closed and channel_error; the merkle-proof protocol uses proof_request and proof_response.
| Field | Type |
|---|---|
toPeerId |
String |
messageType |
String |
payload |
Map<String, dynamic> |
walletId is always null.
AncestorProofRequestedEvent
Section titled “AncestorProofRequestedEvent”Reply to RequestAncestorProofCommand. success only says the request went out to toPeerId; the answer arrives later as AncestorProofResponseEvent. success is false, with toPeerId null, when nobody can be asked: the transaction is not stored or has no counterparty marker. failure: error when success is false.
| Field | Type |
|---|---|
walletId |
String |
txid |
String |
toPeerId |
String? |
ancestorTxids |
List<String> |
requestId |
String? |
success |
bool |
error |
String? |
AncestorProofResponseEvent
Section titled “AncestorProofResponseEvent”Emitted when a peer’s proof_response has been through the ordinary receive path. success is true only when the BEEF verified and the fresh proof was stored. requestId is the id the proof request named on the wire, when it named one. This is not a CoordinatorReply.
| Field | Type |
|---|---|
walletId |
String? |
txid |
String |
fromPeerId |
String |
requestId |
String? |
success |
bool |
error |
String? |
AncestorProofRequestReceivedEvent
Section titled “AncestorProofRequestReceivedEvent”Emitted on the responder when a peer sends a proof_request. answered is false when the request was refused; reason says why, for your logs only. requestId is the id the request named on the wire. This is not a CoordinatorReply.
| Field | Type |
|---|---|
fromPeerId |
String |
txid |
String |
requestId |
String? |
answered |
bool |
reason |
String? |
walletId is always null.
Keys and BRC-100
Section titled “Keys and BRC-100”AnchorPublicKeyEvent
Section titled “AnchorPublicKeyEvent”Reply to IssueAnchorKeyCommand. publicKey is compressed hex. failure: error when success is false, for example for an xpub or WIF wallet, which has no anchor key.
| Field | Type |
|---|---|
walletId |
String |
requestId |
String? |
publicKey |
String? |
success |
bool |
error |
String? |
AnchorSignedEvent
Section titled “AnchorSignedEvent”Reply to SignWithAnchorKeyCommand. signatureDer is a hex DER signature of SHA-256 of the message (deterministic, RFC 6979, low S). failure: error when success is false.
| Field | Type |
|---|---|
walletId |
String |
requestId |
String? |
publicKey |
String? |
signatureDer |
String? |
success |
bool |
error |
String? |
Brc100KeyOperationEvent
Section titled “Brc100KeyOperationEvent”Reply to Brc100KeyOperationCommand. failure: error when success is false.
| Field | Type |
|---|---|
walletId |
String |
requestId |
String? |
result |
Brc100KeyResult? |
success |
bool |
error |
String? |
Type42DestinationEvent
Section titled “Type42DestinationEvent”Reply to DeriveType42DestinationCommand. destination.address is what the payer pays; destination.derivation is the hand-off the payee imports the payment with. destination.tweak is the tweak t, 32 bytes of lower-case hex: the destination’s key is A + t·G, so whoever holds the anchor public key A and t can check a payment reached it without either private key. It discloses this one destination and nothing else, and is null on a destination journaled before 5.4.0. failure: error when success is false.
| Field | Type |
|---|---|
walletId |
String |
requestId |
String? |
destination |
Type42Destination? |
success |
bool |
error |
String? |
Type42AddressesRecordedEvent
Section titled “Type42AddressesRecordedEvent”Since 5.5.0. Reply to RecordType42AddressesCommand: the address of each key, in the command’s order, sent once the read model holds them all. failure: error when success is false, for example for a derivation from an anchor the wallet never issued.
| Field | Type |
|---|---|
walletId |
String |
requestId |
String? |
addresses |
List<String> |
success |
bool |
error |
String? |
Type42DestinationsRecordedEvent
Section titled “Type42DestinationsRecordedEvent”Since 5.9.0. Reply to RecordType42DestinationsCommand. addresses is the address of each derivation whose payer key is the wallet’s own, in the command’s order; skipped counts the others. payerKeysUsed is how many payer keys the wallet has used now, the index of the next. failure: error when success is false.
| Field | Type |
|---|---|
walletId |
String |
requestId |
String? |
addresses |
List<String> |
skipped |
int |
payerKeysUsed |
int |
success |
bool |
error |
String? |
MessageSignedEvent
Section titled “MessageSignedEvent”Since 5.14.0. Reply to SignMessageCommand. signature is the Bitcoin Signed Message signature (compact, base64), as dartsv’s Message.sign makes it and Message.verifyFromAddress checks it, by the key publicKey. failure: error when success is false.
| Field | Type |
|---|---|
walletId |
String |
requestId |
String? |
publicKey |
String? |
signature |
String? |
success |
bool |
error |
String? |
TransactionBroadcastEvent
Section titled “TransactionBroadcastEvent”Since 5.5.0. Reply to BroadcastTransactionCommand: ARC’s answer for txid. networkStatus is ARC’s status when it gave one, and willRetry says a failed broadcast was queued for another submission. failure: error when success is false.
| Field | Type |
|---|---|
walletId |
String |
requestId |
String? |
txid |
String |
success |
bool |
networkStatus |
String? |
willRetry |
bool |
error |
String? |
Block headers
Section titled “Block headers”BlockHeadersStoredEvent
Section titled “BlockHeadersStoredEvent”Reply to StoreHeadersCommand (source from the command); every StoreHeadersCommand is answered. Also emitted, with a null requestId and source p2p (the constant BlockHeadersStoredEvent.peerSource), for each batch a peer sent that stored or rejected a header. success is false when a header was rejected; error says why the first one was. The initial CDN download reports progress through LibSpiffyActorSystem.initialize(onHeaderSyncProgress:) instead. failure: error when success is false.
| Field | Type |
|---|---|
requestId |
String? |
headersStored |
int |
startHeight |
int |
endHeight |
int |
success |
bool |
error |
String? |
source |
String |
walletId is always null.
HeaderSyncStatusEvent
Section titled “HeaderSyncStatusEvent”Emitted when header sync catches up with its peers or falls behind them (when HeaderSyncStatus.synced changes).
| Field | Type |
|---|---|
status |
HeaderSyncStatus |
HeaderSyncStatus has height (the active chain’s tip), networkHeight (the higher of height and the heights peers reported when they connected; 0 while none did), synced (the last peer answer held fewer than 2,000 headers) and peerCount.
Query responses
Section titled “Query responses”These answer the queries on Queries. Each is a CoordinatorReply carrying the query’s requestId.
BalanceResponse
Section titled “BalanceResponse”Reply to GetBalanceQuery. failure is always null: a failure to answer is an ErrorEvent with source getBalance.
| Field | Type |
|---|---|
walletId |
String |
requestId |
String? |
confirmedBalance |
BigInt |
unconfirmedBalance |
BigInt |
totalBalance |
BigInt |
pendingBalance |
BigInt |
watchOnlyBalance |
BigInt |
reservedBalance |
BigInt |
lockedBalance |
BigInt |
TransactionsResponse
Section titled “TransactionsResponse”Reply to GetTransactionsQuery. failure is always null: a failure to answer is an ErrorEvent with source getTransactions.
| Field | Type |
|---|---|
walletId |
String |
requestId |
String? |
transactions |
List<BitcoinTransaction> |
TransactionDetailResponse
Section titled “TransactionDetailResponse”Reply to GetTransactionDetailQuery. found is false when the wallet has no such transaction. failure: error.
| Field | Type |
|---|---|
walletId |
String |
requestId |
String? |
transaction |
BitcoinTransaction? |
found |
bool |
error |
String? |
TransactionExportedEvent
Section titled “TransactionExportedEvent”Reply to ExportTransactionQuery. failure: error when success is false.
| Field | Type |
|---|---|
walletId |
String |
txid |
String |
requestId |
String? |
success |
bool |
beef |
List<int>? |
delegatedIndices |
List<int> |
type42Derivations |
List<Type42Derivation> |
error |
String? |
DeferredPaymentsResponse
Section titled “DeferredPaymentsResponse”Reply to GetDeferredPaymentsQuery. failure is always null: a failure to answer is an ErrorEvent with source getDeferredPayments.
| Field | Type |
|---|---|
walletId |
String |
requestId |
String? |
payments |
List<DeferredPaymentDetail> |
nextCursor |
String? |
HeaderSyncStatusResponse
Section titled “HeaderSyncStatusResponse”Reply to GetHeaderSyncStatusQuery. failure is always null.
| Field | Type |
|---|---|
requestId |
String? |
status |
HeaderSyncStatus |
walletId is always null.
Errors
Section titled “Errors”ErrorEvent
Section titled “ErrorEvent”Emitted for a failure that has no reply of its own to report it in. When a request caused it, requestId names that request and ask() throws CoordinatorFailure with this event; otherwise requestId is null. ErrorEvent is not a CoordinatorReply.
| Field | Type |
|---|---|
walletId |
String? |
source |
String |
message |
String |
stackTrace |
String? |
requestId |
String? |
stillSent |
bool |
stillSent is true when what failed is still being sent, so it may yet land: a channel payment the server has not acknowledged within ChannelTiming.confirmWithin, a channel_error refusing an open whose channel_open is still resent, or a channel_opened the client failed to record while its channel_open is still resent. A later event that answers no request reports it landing. CoordinatorFailure.stillSent reads it. It is false for a final failure.
source names what failed. The values in 6.0.0 are getBalance, getTransactions, getTransactionDetail and getDeferredPayments (a query that could not be answered), ChannelP2PAdapter (a channel request failed, or a peer rejected or errored a channel during an open), WalletCoordinatorActor (a channel command on a coordinator built without channel events, or an unexpected exception while handling a message), and WalletManagerActor and BitcoinWalletAggregate (the wallet gave up on a message that has no reply of its own).