bzzhh / pezos
There is no license information available for the latest version (v0.1.6) of this package.
Tezos library
v0.1.6
2023-06-13 21:53 UTC
Requires
- php: ^8.1
- ext-sodium: *
- jane-php/open-api-runtime: ^7.5
- simplito/elliptic-php: ^1.0
- symfony/config: ^5.3|^6.0
- symfony/dependency-injection: ^5.3|^6.0
- symfony/http-kernel: ^5.3|^6.0
- tuupola/base58: ^2.1
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- jane-php/open-api-3: ^7.5
- nyholm/psr7: ^1.4
- php-http/client-common: ^2.3
- php-http/curl-client: ^2.2
- php-http/discovery: ^1.13
- php-http/message: ^1.11
- phpunit/phpunit: ^10
- symfony/var-dumper: ^5.2
- vimeo/psalm: ^5.8
README
PHP lib for Tezos
composer require bzzhh/pezos
Features
Handles Secp256k1 and Ed25519 keys.
Instanciate key from secret key
$key = Pezos\Keys\Key::fromBase58( 'edskRkGanpJ2fEBdV5xjhFS6DaB5CUsGwZPuTD73VoioQYTTJJKcxJPXXa5FrjA2e8y2LKqwdXNqB9WB4yAQG3gaQTnp15LwDu', ); $key->getPublicKey(); // "edpkvCdu6RSSe379P2ACo8rGoqNRzQRRwNmHfj1dBr4DnSTKwCNxi5" $key->getAddress(); // "tz1PAeuxsMA76x5cnKPkWKof2iGneN3Mb1eQ"
Instanciate key from public key
$pubKey = Pezos\Keys\PubKey::fromBase58( 'edpkvCdu6RSSe379P2ACo8rGoqNRzQRRwNmHfj1dBr4DnSTKwCNxi5', ); $pubKey->getAddress(); // "tz1PAeuxsMA76x5cnKPkWKof2iGneN3Mb1eQ"
Sign messages
$privKey->sign('05010000000548656c6c6f'); // edsigtxHb4HCsgf3zLLcTx4Rj23Y3CSJf8jaRXwoVHZJgSsMhzFoxKtinx2TT5FgYKprLVQ9nq8o93MCpmxaTuRB7igT9b6nZyf
Verify signed messages
$pubKey->verifySignature( 'edsigtxHb4HCsgf3zLLcTx4Rj23Y3CSJf8jaRXwoVHZJgSsMhzFoxKtinx2TT5FgYKprLVQ9nq8o93MCpmxaTuRB7igT9b6nZyf', '05010000000548656c6c6f', ); // true
RPC
RPC clients generated with jane are available.
The open api files are taken from the official Tezos repo.
Symfony
Enable the Bundle
enable the bundle by adding it to the list of registered bundles
in the config/bundles.php
file of your project:
// config/bundles.php return [ // ... Bzzhh\Pezos\Bridge\Symfony\BzzhhPezosBundle::class => ['all' => true], ];
Configuration
Configure your host:
# config/packages/bzzhh_pezos.yaml bzzhh_pezos: rpc_host: https://mainnet-tezos.giganode.io/
Dev workflow
- Launch services with
make up
- If possible do TDD,
make test
Resources
Thanks to these libraries from which code is just translated to PHP.