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

This package is auto-updated.

Last update: 2024-04-13 23:56:56 UTC


README

tests

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

  1. Launch services with make up
  2. If possible do TDD, make test

Resources

Thanks to these libraries from which code is just translated to PHP.