Skip to content

Commit fca16d9

Browse files
committed
readme
1 parent 1f99e7e commit fca16d9

File tree

1 file changed

+78
-0
lines changed

1 file changed

+78
-0
lines changed

README.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
## PHP Bitcoin Blockchain Parser
2+
3+
A PHP implementation of Bitcoin blockchain database parser.
4+
5+
Features:
6+
7+
- Parse unordered block data
8+
- Parse orderered block data
9+
- Parse block index
10+
- Parse chain state (UTXO database)
11+
12+
### Requirements
13+
14+
- PHP >= 7.1
15+
- Bitcoin Core >= 0.15.1
16+
- leveldb >= 1.20
17+
- php-leveldb >= 0.2.1
18+
19+
### Installation
20+
21+
```
22+
composer require andkom/php-bitcoin-blockchain
23+
```
24+
25+
### Examples
26+
27+
```php
28+
$blockchainReader = new BlockchainReader('/path/to/bitcoin');
29+
30+
// read ordered blocks
31+
foreach ($blockchainReader->readBlocks() as $block) {
32+
}
33+
34+
// read unordered blocks
35+
foreach ($blockchainReader->readBlocksUnordered() as $block) {
36+
}
37+
38+
// read UTXO
39+
foreach ($blockchainReader->getChainState()->read() as $utxo) {
40+
}
41+
```
42+
43+
See more examples in the examples dir.
44+
45+
### LevelDB installation
46+
47+
Ubuntu/Debian:
48+
49+
```bash
50+
# apt-get install libleveldb-dev
51+
# pecl install leveldb-0.2.1
52+
```
53+
54+
Mac OS:
55+
56+
```bash
57+
# brew install leveldb
58+
# pecl install leveldb-0.2.1
59+
```
60+
61+
Or compile from source:
62+
63+
```bash
64+
git clone https://github.com/google/leveldb.git
65+
cd leveldb
66+
mkdir -p build && cd build
67+
cmake -DCMAKE_BUILD_TYPE=Release .. && cmake --build .
68+
make install
69+
cd ../../
70+
git clone https://github.com/reeze/php-leveldb.git
71+
cd php-leveldb
72+
phpize
73+
./configure --with-leveldb
74+
make
75+
make install
76+
```
77+
78+
Make sure you've enabled leveldb.so extension in your php.ini.

0 commit comments

Comments
 (0)