Skip to main content

Transaction Logs & Events

Transactional audit system with TransactionLogService, custom events, and TxRecord.Builder.

TransactionLogService

Singleton service for recording transactions to daily JSON + MySQL.

TxType

Enum with all supported transaction types:

TxRecord.Builder

Fields extra and metadata are Map<String, Object> and serialize freely to JSON.

Listening to Events

Vault fires TransactionEvent events through the EventBus channel.

TransactionEvent

Register in Plugin

Specific Event Types

Example: Tax on Transfer

History Queries (TransactionLogService)

Consistency

  • The TransactionEvent is before persistence. Canceling prevents writing to the log.
  • tx.record() is asynchronous, non-blocking.
  • Daily JSON is written to plugins/Vault/logs/yyyy-MM-dd.json.
  • MySQL stores in the vault_transactions table (if use_mysql: true).