PHP library for interacting with the Waves blockchain.

Overview

Waves-PHP

packagist php-version codecov phpstan codecov phpstan phpstan

PHP client library for interacting with Waves blockchain platform.

Installation

composer require waves/client

Usage

See example.php for full code examples.

  • New account:
$account = PrivateKey::fromSeed( 'your mnemonic seed phrase' );
$sender = $account->publicKey();
echo 'address = ' . $sender->address()->toString() . PHP_EOL;
  • Node basics:
$nodeChainId = $node->chainId();
echo 'node chainId = ' . $nodeChainId->asString() . PHP_EOL;
$nodeVersion = $node->getVersion();
echo 'node version = ' . $nodeVersion . PHP_EOL;
$nodeHeight = $node->getHeight();
echo 'node height = ' . $nodeHeight . PHP_EOL;
  • Transfer transaction:
$amount = Amount::of( 1 ); // 0.00000001 Waves
$recipient = Recipient::fromAddressOrAlias( 'test' ); // from alias
$recipient = Recipient::fromAddressOrAlias( '3N9WtaPoD1tMrDZRG26wA142Byd35tLhnLU' ); // from address

$transferTx = TransferTransaction::build( $sender, $recipient, $amount );
$transferTxSigned = $transferTx->addProof( $account );
$transferTxBroadcasted = $node->broadcast( $transferTxSigned );
$transferTxConfirmed = $node->waitForTransaction( $transferTxBroadcasted->id() );
  • DApp invocation transaction:
$dApp = Recipient::fromAddressOrAlias( '3N7uoMNjqNt1jf9q9f9BSr7ASk1QtzJABEY' );
$functionCall = FunctionCall::as( 'retransmit', [
    Arg::as( Arg::STRING, Value::as( $sender->address()->toString() ) ),
    Arg::as( Arg::INTEGER, Value::as( 1 ) ),
    Arg::as( Arg::BINARY, Value::as( hash( 'sha256', $sender->address()->toString(), true ) ) ),
    Arg::as( Arg::BOOLEAN, Value::as( true ) ),
] );
$payments = [
    Amount::of( 1000 ),
];

$invokeTx = InvokeScriptTransaction::build( $sender, $dApp, $functionCall, $payments );
$invokeTxSigned = $invokeTx->addProof( $account );
$invokeTxBroadcasted = $node->broadcast( $invokeTxSigned );
$invokeTxConfirmed = $node->waitForTransaction( $invokeTxBroadcasted->id() );

Requirements

You might also like...
:date: The VObject library for PHP allows you to easily parse and manipulate iCalendar and vCard objects

sabre/vobject The VObject library allows you to easily parse and manipulate iCalendar and vCard objects using PHP. The goal of the VObject library is

Small convention based CQRS library for PHP

LiteCQRS for PHP Small naming-convention based CQRS library for PHP (loosely based on LiteCQRS for C#) that relies on the MessageBus, Command, EventSo

Experimental library for forking PHP

Spork: PHP on a Fork ?php $manager = new Spork\ProcessManager(); $manager-fork(function() { // do something in another process! return 'Hel

Collection pipeline library for PHP

Knapsack Collection pipeline library for PHP Knapsack is a collection library for PHP = 5.6 that implements most of the sequence operations proposed

A PHP library to play with the Raspberry PI's GPIO pins
A PHP library to play with the Raspberry PI's GPIO pins

php-gpio php-gpio is a simple PHP library to play with the Raspberry PI's GPIO pins. It provides simple tools such as reading & writing to pins. [UPDA

PHP library for dealing with European VAT

ibericode/vat This is a simple PHP library to help you deal with Europe's VAT rules. Fetch VAT rates for any EU member state using ibericode/vat-rates

iOS passbook library for PHP 5.4+

PHP PASSBOOK LIBRARY What is Passbook? Passbook is an application in iOS that allows users to store coupons, boarding passes, event tickets, store car

Sslurp is a simple library which aims to make properly dealing with SSL in PHP suck less.

Sslurp v1.0 by Evan Coury Introduction Dealing with SSL properly in PHP is a pain in the ass and completely insecure by default. Sslurp aims to make i

A framework agnostic PHP library to build chat bots
A framework agnostic PHP library to build chat bots

BotMan If you want to learn how to create reusable PHP packages yourself, take a look at my upcoming PHP Package Development video course. About BotMa

Releases(v1.0.2)
Owner
Waves Protocol
Waves.tech is an all-encompassing ecosystem of innovative technologies advancing technological frontiers for the pioneering developers of tomorrow.
Waves Protocol
A simple package for interacting with the exchangerate.host API

Table of Contents Overview Installation Usage Methods Exchange Rate Getting the Rate Between Two Currencies Getting the Rate Between More Than Two Cur

Ash Allen 23 Feb 16, 2022
A fluent interface for interacting with Netopia's services.

laravel-netopia A fluent interface for interacting with Netopia's services. Info Database It'll create a table named netopia_payments with the followi

Codestage 3 Oct 10, 2022
🎮 A simple command line tool for installing and interacting with your leaf apps

Leaf CLI 2 A simple command line tool for creating and interacting with your leaf projects. You can do stuff like installing packages, interacting wit

Leaf Framework 7 Aug 24, 2022
Dobren Dragojević 6 Jun 11, 2023
Easy to use utility functions for everyday PHP projects. This is a port of the Lodash JS library to PHP

Lodash-PHP Lodash-PHP is a port of the Lodash JS library to PHP. It is a set of easy to use utility functions for everyday PHP projects. Lodash-PHP tr

Lodash PHP 474 Dec 31, 2022
PHP Text Analysis is a library for performing Information Retrieval (IR) and Natural Language Processing (NLP) tasks using the PHP language

php-text-analysis PHP Text Analysis is a library for performing Information Retrieval (IR) and Natural Language Processing (NLP) tasks using the PHP l

null 464 Dec 28, 2022
php-echarts is a php library for the echarts 5.0.

php-echarts 一款支持Apache EChart5.0+图表的php开发库 优先ThinkPHP5/6的开发及测试。 Apache EChart5.0已经最新发布,在视觉效果、动画效果和大数据展示方面已经远超之前的版本; 故不考虑EChart5.0之前版本的兼容问题;建议直接尝试5.0+

youyiio 5 Aug 15, 2022
Minimalist PHP frame for Core-Library, for Developing PHP application that gives you the full control of your application.

LazyPHP lightweight Pre-Made Frame for Core-library Install Run the below command in your terminal $ composer create-project ryzen/lazyphp my-first-pr

Ry-Zen 7 Aug 21, 2022
Gettext is a PHP (^7.2) library to import/export/edit gettext from PO, MO, PHP, JS files, etc.

Gettext Note: this is the documentation of the new 5.x version. Go to 4.x branch if you're looking for the old 4.x version Created by Oscar Otero http

Gettext 651 Dec 29, 2022
Columnar analytics for PHP - a pure PHP library to read and write simple columnar files in a performant way.

Columnar Analytics (in pure PHP) On GitHub: https://github.com/envoymediagroup/columna About the project What does it do? This library allows you to w

Envoy Media Group 2 Sep 26, 2022