Transactions/Broadcast for STEEM/GOLOS on PHP [php-graphene-node-client v3.0.0]

It is correct, you can send transactions to STEEM/GOLOS blockchain on PHP!

php-graphene-node-client

It is PHP API client for STEEM/GOLOS blockchain

Github or packagist with MIT license. Author @t3ran13 and active helper @semaspring

In Release v3.0.0

  • broadcast (example for vote)
  • tools for broadcast
  • bag fixes for broadcast commands

Install Via Composer

For readonly, without broadcast

composer require t3ran13/php-graphene-node-client

with broadcast (sending transactions to blockchain)

(details and dockerfile here)

install components

  • automake
  • libtool
  • libgmp-dev

install extensions

broadcast_api operations templates

  • vote
<?php

use GrapheneNodeClient\Tools\ChainOperations\OpVote;
use GrapheneNodeClient\Tools\Transaction;

$answer = OpVote::doSynchronous(
    Transaction::CHAIN_STEEM, //Transaction::CHAIN_GOLOS
    'guest123',
    '5JRaypasxMx1L97ZUX7YuC5Psb5EAbF821kkAGtBj7xCJFQcbLg',
    'firepower',
    'steemit-veni-vidi-vici-steemfest-2016-together-we-made-it-happen-thank-you-steemians',
    10000
);

// example of answer
//Array
//(
//    [id] => 5
//    [result] => Array
//        (
//            [id] => a2c52988ea870e446480782ff046994de2666e0d
//            [block_num] => 17852337
//            [trx_num] => 1
//            [expired] =>
//        )
//
//)

##Tools: Transaction for blockchain (broadcast)

<?php

use GrapheneNodeClient\Tools\Transaction;

/** @var CommandQueryData $tx */
$tx = Transaction::init($chainName);
$tx->setParamByKey(
    '0:operations:0',
    [
        'vote',
        [
            'voter'    => $voter,
            'author'   => $author,
            'permlink' => $permlink,
            'weight'   => $weight
        ]
    ]
);

if (Transaction::CHAIN_GOLOS === $chainName) {
    $connector = new GolosWSConnector();
} elseif (Transaction::CHAIN_STEEM === $chainName) {
    $connector = new SteemitWSConnector();
}
$command = new BroadcastTransactionSynchronousCommand($connector);
Transaction::sign($chainName, $tx, ['posting' => $publicWif]);

$answer = $command->execute(
    $tx
);

WARNING

Transactions are signing with spec256k1-php with function secp256k1_ecdsa_sign_recoverable($context, $signatureRec, $msg32, $privateKey) and if it is not canonical from first time, you have to make transaction for other block. For searching canonical sign function have to implement two more parameters, but spec256k1-php library does not have it.


It is better with each commit

Commits were done by me for release v3.0.0

  • serializer for vote operation
  • partly PrivateKeyFromWif
  • PrivateKeyFromWif
  • signature is not canonical
  • Missing Posting Authority
  • 3030000 tx_missing_posting_auth: missing required posting authority
  • OperationSerializer.php code review
  • serealizer is ok
  • code review
  • checking signature is canonical with DER
  • checks
  • Auth.php: some echo for data
  • code review
  • sing done
  • SteemitWSConnector.php upd
  • change ByteBuffer
  • code review
  • README.md upd
  • sing for steem (bug fix)
  • README.md upd
  • Merge branch 'master' into dev-auth
  • README.md upd



Posted on Utopian.io - Rewarding Open Source Contributors

H2
H3
H4
3 columns
2 columns
1 column
Join the conversation now