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

in #utopian-io7 years ago (edited)

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

Sort:  

Your contribution cannot be approved yet. Can you please include little more details about your Project as an introduction. Also according to the rules "You must provide the links to the branches/forks/gists/pull requests", so please add that too.

You may edit your post as shown below:

You can contact us on Discord.
[utopian-moderator]

thank you, upd)

Hello @t3ran13, I can see you have updated your posts, but can you write all the commits which you have worked on for this development contribution.

comits list was added to footer

well post bro👍👍

Thank you for the contribution. It has been approved. Awesome Work, we need more quality work from you, so keep posting.

You can contact us on Discord.
[utopian-moderator]

thank you!

Hey @t3ran13 I am @utopian-io. I have just upvoted you!

Achievements

  • This is your first accepted contribution here in Utopian. Welcome!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x

thank you!

Thanks for supporting me

Coin Marketplace

STEEM 0.22
TRX 0.26
JST 0.040
BTC 99435.17
ETH 3495.95
USDT 1.00
SBD 3.23