Homework 1: Trace a Transaction Through All Phases
← Back to Transactors: Understanding the Lifecycle of a Transaction
Objective
Use logging and debugging to trace a transaction through all four processing phases and document the state changes at each step.
Prerequisites
A compiled rippled build (debug mode recommended)
A running rippled instance in standalone mode
Familiarity with rippled logging configuration
Tasks
Part 1: Enable Trace Logging
Configure your rippled to enable trace-level logging for the transaction subsystem:
{
"log_level": "trace",
"log_channels": {
"Transactor": "trace",
"View": "trace"
}
}Or use the command-line:
Then in another terminal:
Part 2: Create Test Accounts
Generate two test accounts using the
wallet_proposeRPC:
Fund both accounts using the genesis account in standalone mode.
Record:
Account 1 address and sequence number
Account 2 address
Initial balances for both accounts
Part 3: Submit a CheckCreate Transaction
Create and sign a CheckCreate transaction:
Submit the transaction using the
submitRPC.
Part 4: Analyze the Logs
Review the logs and identify entries for each phase:
Preflight Phase:
What checks were logged?
What was the result?
Preclaim Phase:
What ledger entries were read?
What checks were performed?
What was the result?
doApply Phase:
What ledger entries were created?
What directories were modified?
What owner counts changed?
Finalization:
What was the final result code?
What metadata was recorded?
Part 5: Document State Changes
Create a before/after comparison table:
Account1 AccountRoot
Balance
?
?
Account1 AccountRoot
OwnerCount
?
?
Account1 AccountRoot
Sequence
?
?
Check
(new)
N/A
?
Account1 OwnerDir
Entries
?
?
Account2 OwnerDir
Entries
?
?
Part 6: Verify with RPC
Use RPC commands to verify your analysis:
Deliverables
Log excerpts: Key log entries from each phase (with annotations)
State change table: Completed before/after comparison
Transaction metadata: The
metafield from thetxresponseAnalysis: Brief explanation of what happened in each phase
Bonus Challenge
Repeat the exercise with a transaction that fails:
Create a CheckCreate to a non-existent account
Trace through the phases
Document where and why it failed
Compare the logs to the successful case
Questions for Reflection
At what point does the sequence number get consumed?
At what point does the fee get deducted?
If doApply fails with
tecINSUFFICIENT_RESERVE, what happens to the fee?Why is the Check added to both account directories?
Last updated

