Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions TestWallet.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

use Blockchain\Core\Cryptography\KeyPair;
use Blockchain\Core\Cryptography\Mnemonic;

require_once __DIR__ . '/vendor/autoload.php';

$mnemonic = Mnemonic::generate();

// Create key pair from mnemonic
$keyPair = KeyPair::fromMnemonic($mnemonic, '');

// All tests
echo 'address: ' . $keyPair->getAddress()."\n";
echo 'public_key: ' . $keyPair->getPublicKey()."\n";
echo 'private_key: ' . $keyPair->getPrivateKey()."\n";
echo 'mnemonic: ' . $mnemonic."\n";


echo "\n\nSanity Check: ";
$mnemonic = "profit business cause evoke onion speed bean economy nephew edit balcony trophy";
$keyPair = KeyPair::fromMnemonic($mnemonic, '');
$address = $keyPair->getAddress();
echo 'address: ' . $address."\n";
echo 'public_key: ' . $keyPair->getPublicKey() . "\n";
echo 'private_key: ' . $keyPair->getPrivateKey() . "\n";
echo 'mnemonic: ' . $mnemonic . "\n";
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@
"ext-mbstring": "*",
"ext-openssl": "*",
"ext-pdo": "*",
"ext-gmp": "*",
"ext-bcmath": "*",
"guzzlehttp/guzzle": "^7.5",
"kornrunner/secp256k1": "^0.3.0",
"kornrunner/keccak": "^1.1",
"monolog/monolog": "^3.0",
"stephenhill/base58": "^1.1",
Expand Down
Loading