You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
BlockchainService.verifyBlockchainTransaction (src/blockchain/blockchain.service.ts:595) — the endpoint that tells clients whether a transaction is confirmed on-chain — calls simulateTransactionVerification (line 626) whenever the transaction is not already cached. The simulation fabricates everything:
blockNumber: Math.floor(Math.random()*1000000),from: '0x'+crypto.randomBytes(20).toString('hex'),to: '0x'+crypto.randomBytes(20).toString('hex'),value: '1000000000000000000',// 1 ETH in weistatus: 'success',confirmations: Math.floor(Math.random()*10)+1,
The comment above it says: // In a real implementation, query the blockchain RPC / For now, simulate verification. getBlockchainStats has the same shape of stub — averageGasUsed: '0', // Would be calculated from actual on-chain data (line 738).
Clients are told transactions are verified when nothing was checked. Any caller of verifyBlockchainTransaction receives verified: true with random block/confirmations for a hash that was never looked up — a transaction the API claims is confirmed may not exist on-chain at all.
The fabricated from/to are random addresses unrelated to the actual transaction, so downstream displays of sender/receiver are fiction.
Why this is architecturally hard
This is a real RPC integration, not a toggle. The service already has an RPC provider list (rpcProviders at line 70) and a real eth_blockNumber call path (line 165); the fix is wiring verification to the provider and handling confirmation counts, which is a genuine provider-integration task.
Failure semantics must be defined. When the RPC is unreachable or the hash is unknown, the API must distinguish "not found", "pending", and "provider error" — returning verified: true from a fallback is not an option.
The cache (Fix: Improve Code Documentation and Comments #48 #61) and the real path interact. Cached transactions bypass simulation today; the migration must keep the cache consistent with real verification results.
Acceptance criteria
verifyBlockchainTransaction returns data obtained from the RPC provider (or the existing real RPC path), never from simulateTransactionVerification.
Unknown, pending, and confirmed hashes produce distinct, truthful results; no fabricated verified: true.
getBlockchainStats reports real gas/on-chain values or omits them.
Tests cover confirmed, pending, and unknown-hash cases with a stubbed provider.
Out of scope
The placeholder-URL config default (tracked separately); the transaction-cache durability migration (#61).
Getting started
src/blockchain/blockchain.service.ts:595-642 — the verify path and simulation
src/blockchain/blockchain.service.ts:160-215 — the existing real RPC call path
Commands: npm test, npx tsc --noEmit.
Good first files to read: src/blockchain/blockchain.service.ts (verify + RPC paths).
Blockchain verification returns simulated data: verifyBlockchainTransaction fabricates block numbers and addresses
Labels / Complexity: bug · High Complexity — High
Problem
BlockchainService.verifyBlockchainTransaction(src/blockchain/blockchain.service.ts:595) — the endpoint that tells clients whether a transaction is confirmed on-chain — callssimulateTransactionVerification(line 626) whenever the transaction is not already cached. The simulation fabricates everything:The comment above it says:
// In a real implementation, query the blockchain RPC / For now, simulate verification.getBlockchainStatshas the same shape of stub —averageGasUsed: '0', // Would be calculated from actual on-chain data(line 738).verifyBlockchainTransactionreceivesverified: truewith random block/confirmations for a hash that was never looked up — a transaction the API claims is confirmed may not exist on-chain at all.from/toare random addresses unrelated to the actual transaction, so downstream displays of sender/receiver are fiction.Why this is architecturally hard
rpcProvidersat line 70) and a realeth_blockNumbercall path (line 165); the fix is wiring verification to the provider and handling confirmation counts, which is a genuine provider-integration task.verified: truefrom a fallback is not an option.Acceptance criteria
verifyBlockchainTransactionreturns data obtained from the RPC provider (or the existing real RPC path), never fromsimulateTransactionVerification.verified: true.getBlockchainStatsreports real gas/on-chain values or omits them.Out of scope
The placeholder-URL config default (tracked separately); the transaction-cache durability migration (#61).
Getting started
src/blockchain/blockchain.service.ts:595-642— the verify path and simulationsrc/blockchain/blockchain.service.ts:160-215— the existing real RPC call pathCommands:
npm test,npx tsc --noEmit.Good first files to read:
src/blockchain/blockchain.service.ts(verify + RPC paths).