コード例 #1
0
ファイル: toshi.test.php プロジェクト: dan-da/hd-wallet-addrs
 protected function test1()
 {
     // wallet unknown.
     // obtained from https://blockchain.info/xpub/xpub6CUGRUonZSQ4TWtTMmzXdrXDtypWKiKrhko4egpiMZbpiaQL2jkwSB1icqYh2cfDfVxdx4df189oLKnC5fSwqPfgyP3hooxujYzAu3fDVmz
     $xpub = 'xpub6CUGRUonZSQ4TWtTMmzXdrXDtypWKiKrhko4egpiMZbpiaQL2jkwSB1icqYh2cfDfVxdx4df189oLKnC5fSwqPfgyP3hooxujYzAu3fDVmz';
     $args = "-g --api=toshi --gap-limit=2  --xpub={$xpub}";
     $data = hdwalletaddrscmd::runjson($args);
     $col = 'Number of addresses found.';
     $this->eq(count($data), 2, $col);
     $firstrow = @$data[0];
     $col = 'Address 1';
     $this->eq(@$data[0]['addr'], '1EfgV2Hr5CDjXPavHDpDMjmU33BA2veHy6', $col);
     $col = 'Address 2';
     $this->eq(@$data[1]['addr'], '12iNxzdF6KFZ14UyRTYCRuptxkKSSVHzqF', $col);
     $col = 'Type';
     $this->eq(@$firstrow['type'], 'Receive', $col);
     $col = 'Total received';
     $this->eq(@$firstrow['total_received'], '0.00100000', $col);
     $col = 'Total sent';
     $this->eq(@$firstrow['total_sent'], '0.00100000', $col);
     $col = 'balance';
     $this->eq(@$firstrow['balance'], '0.00000000', $col);
     $col = 'relpath';
     $this->eq(@$firstrow['relpath'], '0/0', $col);
     $col = 'abspath';
     $this->eq(@$firstrow['abspath'], null, $col);
 }
コード例 #2
0
 protected function test_derivation()
 {
     // from mycelium android
     $xpub = 'xpub6DJTvbWn3dbKoVLJScvgPNUwEsGu19nMUXaRaHbwmQdY6wcJZgNd1iqfmfg5a1M3ckupB4roptN73nPqeU7MV5EdJS6ZdwUQ4nixjAuz6oM';
     $args = "-g --include-unused --gap-limit=2  --xpub={$xpub}";
     $data = hdwalletaddrscmd::runjson($args);
     $col = 'Number of addresses found.';
     $this->eq(count($data), 4, $col);
     // 2 empty receive + 2 empty change
     $col = 'First Receive Address';
     $this->eq(@$data[0]['addr'], '137vYfvKUwLnht5217E5vQ3zCp63Fp194A', $col);
     $col = 'Second Receive Address';
     $this->eq(@$data[1]['addr'], '1JYd1RBcL71hvhJxVAZrDiE2YTNMw9sQVm', $col);
     $col = 'First Change Address';
     $this->eq(@$data[2]['addr'], '171ajJyAeY4Qk8hZ3EfwrPEqTEqP6HR2x9', $col);
     $col = 'Second Change Address';
     $this->eq(@$data[3]['addr'], '1Kttmfi4uoLby9PFNqUMDxtNoZYbVqxKxC', $col);
 }
コード例 #3
0
 protected function test1()
 {
     // Verify at https://www.blockonomics.co/#/search?q=xpub6BfKpqjTwvH21wJGWEfxLppb8sU7C6FJge2kWb9315oP4ZVqCXG29cdUtkyu7YQhHyfA5nt63nzcNZHYmqXYHDxYo8mm1Xq1dAC7YtodwUR
     $xpub = 'xpub6BfKpqjTwvH21wJGWEfxLppb8sU7C6FJge2kWb9315oP4ZVqCXG29cdUtkyu7YQhHyfA5nt63nzcNZHYmqXYHDxYo8mm1Xq1dAC7YtodwUR';
     $args = "-g --gap-limit=5  --xpub={$xpub}";
     $data = hdwalletaddrscmd::runjson($args);
     $col = 'Number of addresses found.';
     $this->eq(count($data), 5, $col);
     // note: for some reason blockonomics is using a different sort order
     //       than we do.
     $col = 'Address 1';
     $this->eq(@$data[0]['addr'], '1Ge6rDuyCdYVGhXZjcK4251q67GXMKx6xK', $col);
     $col = 'Address 2';
     $this->eq(@$data[1]['addr'], '1NVsB73WmDGXSxv77sh9PZENH2x3RRnkDY', $col);
     $col = 'Address 3';
     $this->eq(@$data[2]['addr'], '1BkgqiHcvfnQ2wrPN5D2ycrvZas3nibMjC', $col);
     $col = 'Address 4';
     $this->eq(@$data[3]['addr'], '12SisoiXLUEbkytL5Pzia1jBY8gJP5XN8D', $col);
     $col = 'Address 5';
     $this->eq(@$data[4]['addr'], '1CkvACVpFwkPnMG13w9kXXE9YcsiyL4pcY', $col);
 }
コード例 #4
0
 protected function test2of2()
 {
     // from copay 1.x test wallet 2 of 2
     $keys = array('xpub68bjYyPhqAwK4T8WtXuGvruSQoJu1vdLD7DYc591MkFCR7wD9gyzteFYmzRyytWJ2SzTqZNTgggvPEyqEy9oArjLF7xhte5js1Lp1EPipwJ', 'xpub68ufoGjY41tQqP4LpeyYornuNxm8DNy2Rn7KAPUTAwFouj821eqcVpWw1jonrm2Xg5jnnSrd1QPQzGve3f66ZLf6Ni9VY6aN3AjYa4e7XTE');
     $numsig = 2;
     // 2 signers.
     $xpub = implode(',', $keys);
     $args = "-g --gap-limit=2  --xpub={$xpub} --derivation=copaylegacy --numsig={$numsig} --include-unused";
     $data = hdwalletaddrscmd::runjson($args);
     $col = 'Number of addresses found.';
     $this->eq(count($data), 4, $col);
     // 2 empty receive + 2 empty change
     $col = 'First Receive Address';
     $this->eq(@$data[0]['addr'], '35uhrWpDTj3Y7EwR9AWjACGfT47txtpH1v', $col);
     $col = 'Second Receive Address';
     $this->eq(@$data[1]['addr'], '3BnXxkW9CVCLn1EboGDJ8434eKFWZGHsjn', $col);
     $col = 'First Change Address';
     $this->eq(@$data[2]['addr'], '38dzdCQXatNdT9nWG7thpGC9KjBVLphZRP', $col);
     $col = 'Second Change Address';
     $this->eq(@$data[3]['addr'], '3CfbgQ5BxWRFBYXJxEVAmVCZsatdJfc2rS', $col);
 }
コード例 #5
0
ファイル: copay.test.php プロジェクト: dan-da/hd-wallet-addrs
 protected function test2of3()
 {
     // from copay 1.6.3 test wallet 2 of 3
     // note: wallet uses bip44 derivation strategy.
     $keys = array('xpub6CZte6DfeMoVwxv3ShiMwQjET47nRENqrkZaSXTcP7Yaja6sxyRbiyqPD7kfy4W2dTTuTdV4jHMmSe1k1qteTMN7qDLndt1RfQ8RLM3pjzb', 'xpub6DUGj5hRwp7t3DoH554Ce7p3KLepccYfG5BVbvyPSArTepacc3aPRDTMz3GSdoX1HgVYKBSaR6fFDm1daEtSQFBSNTq4X93pd8dBFyPW2gz', 'xpub6DRFPDtHueJ5sfqzcLSyoKL6TQZMofvjpLzsVXsWqjgYuAtUtdU8YjWFvpa2xegWLFeLQ38KLJzWdKQ3CsAQQLoMYnBsQy3FCeTDuxgcsfK');
     $numsig = 2;
     // 2 signers.
     $xpub = implode(',', $keys);
     $args = "-g --gap-limit=2  --xpub={$xpub} --numsig={$numsig} --include-unused";
     $data = hdwalletaddrscmd::runjson($args);
     $col = 'Number of addresses found.';
     $this->eq(count($data), 4, $col);
     // 2 empty receive + 2 empty change
     $col = 'First Receive Address';
     $this->eq(@$data[0]['addr'], '339H3pYP9AKiEo74D1BWiSK8jhWXsrJ3yk', $col);
     $col = 'Second Receive Address';
     $this->eq(@$data[1]['addr'], '3NcBBWtDscKchgkUCY3eEQZgYh8STtcona', $col);
     $col = 'First Change Address';
     $this->eq(@$data[2]['addr'], '3QtjkbY8Km4v5KCgTZxD7VW2vPCsBqkV3V', $col);
     $col = 'Second Change Address';
     $this->eq(@$data[3]['addr'], '3B7xNx7dCT6ydcVF1xQpEtG8UFeeh2PyAk', $col);
 }