Skip to content

Commit af2456b

Browse files
committed
add files
1 parent 90e4503 commit af2456b

21 files changed

+1562
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.idea

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2018 Andrei K.
3+
Copyright (c) 2018 Andrei Komarov.
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
## PHP Bitcoin Wallet
2+
3+
A simple PHP library for reading Bitcoin wallet.dat file.
4+
5+
### Installation
6+
7+
```bash
8+
composer require andkom/php-bitcoin-wallet
9+
```
10+
11+
### Usage
12+
13+
```PHP
14+
<?php
15+
16+
use AndKom\PhpBitcoinWallet\Wallet;
17+
18+
// create wallet instance
19+
$wallet = new Wallet();
20+
$wallet->read("/path/to/wallet.dat");
21+
22+
// check if wallet is encrypted
23+
if ($wallet->isEncrypted()) {
24+
25+
// get wallet master key
26+
echo $wallet->getMasterKey()->getEncryptedKey();
27+
28+
// decrypt wallet
29+
$wallet->decrypt("password");
30+
}
31+
32+
// print stored keys
33+
foreach ($wallet->getKeys() as $key) {
34+
echo $key->getPrivateKey()->toWif() . " => " . $key->getPublicKey()->getAddress()->getAddress() . "\n";
35+
}
36+
```

composer.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"name": "andkom/php-bitcoin-wallet",
3+
"description": "A simple PHP library for reading Bitcoin wallet.dat file.",
4+
"type": "library",
5+
"keywords": [
6+
"bitcoin",
7+
"wallet",
8+
"wallet.dat"
9+
],
10+
"license": "MIT",
11+
"authors": [
12+
{
13+
"name": "Andrei Komarov"
14+
}
15+
],
16+
"require": {
17+
"php": "^7.0",
18+
"bitwasp/bitcoin": "^0.0.30",
19+
"andkom/php-berkeley-db": "^1.0"
20+
},
21+
"require-dev": {
22+
"phpunit/phpunit": ">=5.0"
23+
},
24+
"autoload": {
25+
"psr-4": {
26+
"AndKom\\PhpBitcoinWallet\\": "src/"
27+
}
28+
},
29+
"autoload-dev": {
30+
"psr-4": {
31+
"AndKom\\PhpBitcoinWallet\\Tests\\": "tests/"
32+
}
33+
}
34+
}

phpunit.xml.dist

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit bootstrap="vendor/autoload.php"
3+
colors="true"
4+
verbose="true">
5+
<testsuites>
6+
<testsuite name="Unit">
7+
<directory suffix="Test.php">./tests/</directory>
8+
</testsuite>
9+
</testsuites>
10+
<filter>
11+
<whitelist processUncoveredFilesFromWhitelist="true">
12+
<directory suffix=".php">./src</directory>
13+
</whitelist>
14+
</filter>
15+
</phpunit>

0 commit comments

Comments
 (0)