github.com/btcsuite/btcd@v0.24.0/database/README.md (about) 1 database 2 ======== 3 4 [![Build Status](https://github.com/btcsuite/btcd/workflows/Build%20and%20Test/badge.svg)](https://github.com/btcsuite/btcd/actions) 5 [![ISC License](http://img.shields.io/badge/license-ISC-blue.svg)](http://copyfree.org) 6 [![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg)](https://pkg.go.dev/github.com/btcsuite/btcd/database) 7 8 Package database provides a block and metadata storage database. 9 10 Please note that this package is intended to enable btcd to support different 11 database backends and is not something that a client can directly access as only 12 one entity can have the database open at a time (for most database backends), 13 and that entity will be btcd. 14 15 When a client wants programmatic access to the data provided by btcd, they'll 16 likely want to use the [rpcclient](https://github.com/btcsuite/btcd/tree/master/rpcclient) 17 package which makes use of the [JSON-RPC API](https://github.com/btcsuite/btcd/tree/master/docs/json_rpc_api.md). 18 19 However, this package could be extremely useful for any applications requiring 20 Bitcoin block storage capabilities. 21 22 The default backend, ffldb, has a strong focus on speed, efficiency, and 23 robustness. It makes use of leveldb for the metadata, flat files for block 24 storage, and strict checksums in key areas to ensure data integrity. 25 26 ## Feature Overview 27 28 - Key/value metadata store 29 - Bitcoin block storage 30 - Efficient retrieval of block headers and regions (transactions, scripts, etc) 31 - Read-only and read-write transactions with both manual and managed modes 32 - Nested buckets 33 - Iteration support including cursors with seek capability 34 - Supports registration of backend databases 35 - Comprehensive test coverage 36 37 ## Installation and Updating 38 39 ```bash 40 $ go get -u github.com/btcsuite/btcd/database 41 ``` 42 43 ## Examples 44 45 * [Basic Usage Example](https://pkg.go.dev/github.com/btcsuite/btcd/database#example-package--BasicUsage) 46 Demonstrates creating a new database and using a managed read-write 47 transaction to store and retrieve metadata. 48 49 * [Block Storage and Retrieval Example](https://pkg.go.dev/github.com/btcsuite/btcd/database#example-package--BlockStorageAndRetrieval) 50 Demonstrates creating a new database, using a managed read-write transaction 51 to store a block, and then using a managed read-only transaction to fetch the 52 block. 53 54 ## License 55 56 Package database is licensed under the [copyfree](http://copyfree.org) ISC 57 License.