stormpat/crypto-coin 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

stormpat/crypto-coin

Composer 安装命令:

composer require stormpat/crypto-coin

包简介

Generate cryptocurrency addresses and private keys with PHP.

README 文档

README

#CryptoCoin

###Hightlights

###Requirements

Requires GMP or BcMath extension (GMP preferred for better performance)

Benchmarks

Test setup: 2.2Ghz Core i7, 8GB DDR3, OSX 10.9.1

The algorythm is quite slow with bcmath on older PHP versions. Its highly recommended that you use PHP 5.5.x. The benchmark is not tested on PHP 5.3.x yet, it does work, but the speed can be slow. I will add benchmarks when i do the tests.

With BcMath

  • PHP 5.4.21
  • ~6.3 sec
  • PHP 5.5.7
  • ~1.5 sec

With GMP

  • PHP 5.5.7
  • ~0.02 sec

As you can see in the above benchmarks, i strongly suggest GMP with a new PHP version. Otherwise you should probably try using some sort of queue service for the generation.

For additional info please read: BcMath vs GMP

###About

This lib generates public/private key pairs for various cryptocurrencies. Currently supported currencies are:

This library is a fork, and made because of my increased interest in cryptocurrencies, and because the original libraries where not composer friendly, and not namespaced. So this library can be easily used with other packages and frameworks. See credits for more info.

###Installation

With composer

Install Composer and require the lib.

$ curl -sS https://getcomposer.org/installer | php
$ mv composer.phar /usr/local/bin/composer

Then require the library.

composer require stormpat/crypto-coin

For the version constraint use dev-master

Or just update your composer.json and run composer install.

require": {
    "stormpat/crypto-coin": "dev-master"
}

Install with composer install

Manually

Just clone the repository, and set up your bootstrapping.

git clone https://github.com/stormpat/CryptoCoin.git ###Usage

Require the composer autoload file

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

Use the library by importing the namespace.

use CryptoCoin\CoinAddress;

Finally get the generated data from the algorythm.

$coin = CoinAddress::bitcoin(); // or ::litecoin etc.

var_dump($coin);

// dump looks like this

array (size=8)
  'public' => string '1L4LXsH5BWX1fjFJDteJ53h2W7FkJkVKW7' (length=34)
  'public_hex' => string '0474ec09bbbe2962fd0a9515a8665c6be71bd85da17f92b24d26999056a14787c4f6551b3d022ffd177ca99502d06fefb2280d2781eebfb22559f8cfc449420bc9' (length=130)
  'private' => string '5KaMAFrNeZhtRxxgJsq2GKDAhUq98S6EsVWAKd5hUCN5zzaMh3M' (length=51)
  'private_hex' => string 'e7be5bb61050630558d4b3f56c068a738961f7731f26911cb0935bfb6ef52dfe' (length=64)
  'public_compressed' => string '15HcvN6RxA1oN5vXKGv4F4Ch2b6rDqbDnu' (length=34)
  'public_compressed_hex' => string '0374ec09bbbe2962fd0a9515a8665c6be71bd85da17f92b24d26999056a14787c4' (length=66)
  'private_compressed' => string 'L4zByrYvYoMU1BzkVuLxabNhofqUsok8Droi9CFjd3A54kDdReK6' (length=52)
  'private_compressed_hex' => string 'e7be5bb61050630558d4b3f56c068a738961f7731f26911cb0935bfb6ef52dfe' (length=64)

###Licence

The MIT License (MIT)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

###Credits

This lib is based on the work of PHPCoinAddress and PHP Elliptic Curve DSA and DH please see their repos for additional info. Big salute!

stormpat/crypto-coin 适用场景与选型建议

stormpat/crypto-coin 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 10k 次下载、GitHub Stars 达 11, 最近一次更新时间为 2014 年 02 月 26 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「generator」 「address」 「bitcoin」 「litecoin」 「cryptocurrency」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 stormpat/crypto-coin 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 stormpat/crypto-coin 我们能提供哪些服务?
定制开发 / 二次开发

基于 stormpat/crypto-coin 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 10k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 12
  • 点击次数: 24
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 11
  • Watchers: 2
  • Forks: 7
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-02-26