1) Block explorer is not a valid benchmark. You want to be able to produce a distributed transaction that updates both Bitcoin wallet and some external database as a single transaction that either goes to completion in both databases or gets rolled back in both databases.
That's incorrect, and is actually a problematic design if you force that dependency.
What you need are actually 3 databases, which can be completely independent from each other:
- a blockchain DB (same as explorer DB), that can be restricted/filtered to only tx that concern you for size considerations
- a key DB (which will hold your key pool, xpriv, etc.)
- a wallet helper DB to hold metadata (address labels, payments extra info, accounts...)
The first two DB are only related by a filtering optimization, so no cross-DB transactions are ever necessary, and all the heavy lifting happens in the blockchain DB. When creating a new key, you always write it to the Key DB first, and it can only end up in the blockchain DB after having been confirmed. New unconfirmed tx are persisted in the wallet helper (with metadata and for eventual re-broadcasting), then go straight to the mempool for broadcasting. This could also help clean up the annoyances with new unconfirmed tx in the current bitcoin core code.
It would also isolate wallet management from key and tx creation/signing, the blockchain & key DB would be part of the core, but wallet helper could/should be considered as not being "core", but something alternative wallets could replace or do differently.
Key DB is really critical in terms of security, wallet helper much less so (if it leaks, you would leak some private info, but no funds), having it separate also means it will be simpler to move it to dedicated, standardized hardware.
2) Append-only files don't mean having to read and parse the whole file every time. For a popular example check out the PDF format that is designed to be read from the end, including appending new page indexes to the end.
But then you need some validation and recovery as what you appended could be partial or corrupted if a crash or power issue happened while you were writing it. Basically you would be re-inventing the ACID properties of a DB. Plenty of pitfalls there, especially with a cross-platform target, plenty of testing required.
You want to avoid NIHS and Yet-Another-Attempt-At-A-Crash-Proof-File-Format.
The 3 layers are: (a) blockchain storage including confirmed transactions (b) wallet keys&addresses storage (c) mempool a.k.a. unconfirmed transactions storage.
Yes, and currently (a) & (b) range from pretty bad to awful in terms of performance and accessibility of data.
(c) is a technical internal layer, I would not consider it as something alongside a & b, as it is transient and can be discarded.