Commit 764641f1 authored by kenshin-samourai's avatar kenshin-samourai
Browse files

update db schema

parent 898e7ee2
......@@ -6,9 +6,9 @@ The index is stored at a single RocksDB database using the following schema:
Allows efficiently finding all funding transactions for a specific address:
| Code | Script Hash Prefix | Funding TxID Prefix | |
| ------ | -------------------- | --------------------- | - |
| `b'O'` | `SHA256(script)[:8]` | `txid[:8]` | |
| Code | Script Hash Prefix | Funding TxID Prefix | Funding Output Index | |
| ------ | -------------------- | --------------------- | --------------------- | - |
| `b'O'` | `SHA256(script)[:8]` | `txid[:8]` | `uint16` | |
## Transaction inputs' index
......@@ -23,9 +23,15 @@ Allows efficiently finding spending transaction of a specific output:
In order to save storage space, we store the full transaction IDs once, and use their 8-byte prefixes for the indexes above.
| Code | Transaction ID | | Confirmed height |
| ------ | ----------------- | - | ------------------ |
| `b'T'` | `txid` (32 bytes) | | `uint32` |
| Code | Transaction ID | |
| ------ | ----------------- | - |
| `b'T'` | `txid` (32 bytes) | |
## Blocks
Stores the hashes and headers of blocks.
Note that this mapping allows us to use `getrawtransaction` RPC to retrieve actual transaction data from without `-txindex` enabled
(by explicitly specifying the [blockhash](https://github.com/bitcoin/bitcoin/commit/497d0e014cc79d46531d570e74e4aeae72db602d)).
| Code | Block hash | | Block header |
| ------ | ----------------- | - | --------------------- |
| `b'B'` | `hash` (32 bytes) | | 80 bytes |
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment