kornrunner/ethereum-util 问题修复 & 功能扩展

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

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

kornrunner/ethereum-util

最新稳定版本:0.2.0

Composer 安装命令:

composer require kornrunner/ethereum-util

包简介

Pure PHP implementation of Ethereum Utils

README 文档

README

Pure PHP implementation of Ethereum Utils

Usage

Hash Personal Message

use kornrunner\Eth;

$hash = Eth::hashPersonalMessage('0xf20f20d357419f696f69e6ff05bc6566b1e6d38814ce4f489d35711e2fd2c481');
// 58a2db04c169254495a55b6dd5609a4902678ec29eac46df1e95994cdbeaebbb

Sign Personal Message

use kornrunner\Eth;

$result = Eth::signPersonalMessage('Hello, Ethereum!', $privateKey);

Recover Public Key from Signature (ecRecover)

use kornrunner\Eth;

$publicKey = Eth::ecRecover(
    '98d22cdb65bbf8a392180cd2ee892b0a971c47e7d29daf31a3286d006b9db4dc',
    'f67118680df5993e8efca4d3ecc4172ca4ac5e3e007ea774293e373864809703',
    '47427f3633371c1a30abbb2b717dbd78ef63d5b19b5a951f9d681cccdd520320',
    0
);

Verify Signature (ecVerify)

use kornrunner\Eth;

$isValid = Eth::ecVerify(
    '98d22cdb65bbf8a392180cd2ee892b0a971c47e7d29daf31a3286d006b9db4dc', // message hash
    'f67118680df5993e8efca4d3ecc4172ca4ac5e3e007ea774293e373864809703', // r component
    '47427f3633371c1a30abbb2b717dbd78ef63d5b19b5a951f9d681cccdd520320', // s component
    0, // recovery id (v)
    '04cf60398ae73fd947ffe120fba68947ec741fe696438d68a2e52caca139613ff94f220cd0d3e886f95aa226f2ad2b86be1dd5cda2813fd505d1f6a8f552904864' // public key
);
// true

All methods support both plain hex strings and 0x-prefixed hex strings.

Crypto

Ethereum 0x9c7b7a00972121fb843af7af74526d7eb585b171

统计信息

  • 总下载量: 40.23k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 6
  • 点击次数: 1
  • 依赖项目数: 6
  • 推荐数: 0

GitHub 信息

  • Stars: 6
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-12-04