t3ran13 / php-graphene-node-client

PHP client for connection to Graphene node (STEEM/GOLOS/VIZ/WHALESHARES)
MIT License
12 stars 12 forks source link

OpVote/OpTransaction Call fails #7

Closed CryptoBenji closed 6 years ago

CryptoBenji commented 6 years ago

Hi, I'm trying to use the library and keep get

Fatal error: Uncaught JsonRPC\Exception\ResponseException: 3030000 tx_missing_posting_auth: missing required posting authority Missing Posting Authorit

While trying to execute this code:


use GrapheneNodeClient\Connectors\Http\SteemitHttpConnector;
use GrapheneNodeClient\Tools\ChainOperations\OpVote;
use GrapheneNodeClient\Tools\Transaction;

$connector = new SteemitHttpConnector();
$answer = OpVote::doSynchronous(
    $connector, 
    'myname',
    '5Jdfgdfgdfgdfgdfgdfgsdfgdfg',
    'andyhoffman',
    'use-this-version-andy-hoffman-cryptogoldcentral-com-special-crypto-audioblog-bitcoin-community-unite-against-bcash',
    100
);

Same for OpTransaction (I use active WIF for that of course)

What I'm doing wrong?

Thanks :)

t3ran13 commented 6 years ago

posting WIF = posting private key, did you use it? try 'guest123', '5JRaypasxMx1L97ZUX7YuC5Psb5EAbF821kkAGtBj7xCJFQcbLg',

if the same error is (is the trouble with the environment?) then try this docker file

https://github.com/t3ran13/php-graphene-node-client/blob/debug/docker/local/dockerfile-php7-fpm

CryptoBenji commented 6 years ago

Might be some env. issue, it is local ubuntu VM...

I tried also

` use GrapheneNodeClient\Tools\Transaction; use GrapheneNodeClient\Connectors\Http\SteemitHttpConnector; use GrapheneNodeClient\Connectors\WebSocket\GolosWSConnector; use GrapheneNodeClient\Commands\Broadcast\BroadcastTransactionSynchronousCommand;

$connector = new SteemitHttpConnector(); //$connector = new GolosWSConnector();

$chainName = Transaction::CHAIN_STEEM;

$tx = Transaction::init($chainName); $tx->setParamByKey( '0:operations:0', [ 'vote', [ 'voter' => 'guest123', 'author' => 'andyhoffman', 'permlink' => 'use-this-version-andy-hoffman-cryptogoldcentral-com-special-crypto-audioblog-bitcoin-community-unite-against-bcash', 'weight' => 10000 ] ] );

$publicWif = '5JRaypasxMx1L97ZUX7YuC5Psb5EAbF821kkAGtBj7xCJFQcbLg'; $command = new BroadcastTransactionSynchronousCommand($connector); Transaction::sign($chainName, $tx, ['posting' => $publicWif]);

$answer = $command->execute( $tx ); var_dump($answer); ` Got

Fatal error: Uncaught JsonRPC\Exception\ResponseException: 3030000 tx_missing_posting_auth: missing required posting authority Missing Posting Authority guest123 {"id":"guest123","posting":{"weight_threshold":1,"account_auths":[["busy.app",1]],"key_auths":[["STM6aGPtxMUGnTPfKLSxdwCHbximSJxzrRjeQmwRW9BRCdrFotKLs",1]]},"active":{"weight_threshold":1,"account_auths":[],"key_auths":[["STM7KVz2JzGVUHuuguoAK9BPosAbXWaCEp3Bgr5TUmMyvPjSJRt6m",1]]},"owner":{"weight_threshold":1,"account_auths":[],"key_auths":[["STM5j6x515jjYcjqtSVr7c6FRaXMkUGUDdduxvQJ3M1abDYxiT7Lx",1]]}} th_a transaction.cpp:129 verify_authority {"ops":[["vote",{"voter":"guest123","author":"andyhoffman","permlink":"use-this-version-andy-hoffman-cryptogoldcentral-com-special-crypto-audioblog-bitcoin-community-unite-against-bcash","weight":10000}]],"sigs":["STM7TaomWLQHJPXAYW46yK4EToLKP5Lpf6LM6DKMcfGY9sJsHxoSV"]} th_a transaction.cpp:172 verify_authority {"*this":{"ref_block_num":22744,"ref_block_prefix":1673392350,"expiration":"2018-01-27T21 in /var/www/html/vendor/fguillot/json-rpc/src/JsonRPC/Response/ResponseParser.php on line 135

Will try the docker...

t3ran13 commented 6 years ago

Transaction::init($chainName) Here connector have to be

t3ran13 commented 6 years ago

And here Transaction::sign($chainName...

CryptoBenji commented 6 years ago

I rolled back to older version, for tests, I'll now fix it, so we will debug the same one :)

CryptoBenji commented 6 years ago

Now it looks like this

use GrapheneNodeClient\Tools\Transaction; use GrapheneNodeClient\Connectors\Http\SteemitHttpConnector; use GrapheneNodeClient\Connectors\WebSocket\GolosWSConnector; use GrapheneNodeClient\Commands\Broadcast\BroadcastTransactionSynchronousCommand;

$connector = new SteemitHttpConnector(); //$connector = new GolosWSConnector();

$chainName = Transaction::CHAIN_STEEM;

$tx = Transaction::init($connector);

$tx->setParamByKey( '0:operations:0', [ 'vote', [ 'voter' => 'guest123', 'author' => 'andyhoffman', 'permlink' => 'use-this-version-andy-hoffman-cryptogoldcentral-com-special-crypto-audioblog-bitcoin-community-unite-against-bcash', 'weight' => 10000 ] ] );

$publicWif = '5JRaypasxMx1L97ZUX7YuC5Psb5EAbF821kkAGtBj7xCJFQcbLg'; $command = new BroadcastTransactionSynchronousCommand($connector);

Transaction::sign($chainName, $tx, ['posting' => $publicWif]);// in the code sign accepts chainName rather than connector...

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

var_dump($answer);

resulting in

Fatal error: Uncaught JsonRPC\Exception\ResponseException: 3030000 tx_missing_posting_auth: missing required posting authority Missing Posting Authority guest123 {"id":"guest123","posting":{"weight_threshold":1,"account_auths":[["busy.app",1]],"key_auths":[["STM6aGPtxMUGnTPfKLSxdwCHbximSJxzrRjeQmwRW9BRCdrFotKLs",1]]},"active":{"weight_threshold":1,"account_auths":[],"key_auths":[["STM7KVz2JzGVUHuuguoAK9BPosAbXWaCEp3Bgr5TUmMyvPjSJRt6m",1]]},"owner":{"weight_threshold":1,"account_auths":[],"key_auths":[["STM5j6x515jjYcjqtSVr7c6FRaXMkUGUDdduxvQJ3M1abDYxiT7Lx",1]]}} th_a transaction.cpp:129 verify_authority {"ops":[["vote",{"voter":"guest123","author":"andyhoffman","permlink":"use-this-version-andy-hoffman-cryptogoldcentral-com-special-crypto-audioblog-bitcoin-community-unite-against-bcash","weight":10000}]],"sigs":["STM8QNLSvbanopzwsEQi96TYxbfcgxBdhqJy8rpLg5gyikraK5k3Y"]} th_a transaction.cpp:172 verify_authority {"*this":{"ref_block_num":23084,"ref_block_prefix":706930404,"expiration":"2018-01-27T22: in /var/www/html/vendor/fguillot/json-rpc/src/JsonRPC/Response/ResponseParser.php on line 135

Might be it is env issue, didn't had the opportunity to test it on real production server...

t3ran13 commented 6 years ago

https://github.com/t3ran13/php-graphene-node-client/blob/debug/docker/local/dockerfile-php7-fpm

Try install all like in docker file

t3ran13 commented 6 years ago

your code looks like this one

use GrapheneNodeClient\Connectors\Http\SteemitHttpConnector;
use GrapheneNodeClient\Tools\ChainOperations\OpVote;

$connector = new SteemitHttpConnector();
//upvote post or comment
$answer = OpVote::doSynchronous(
    $connector,
    'guest123',
    '5JRaypasxMx1L97ZUX7YuC5Psb5EAbF821kkAGtBj7xCJFQcbLg',
    't3ran13',
    'color-world-magic-prague-12-cute-place-panorama',
    10000
);

now, did you install all ? components

extensions

the same with details here https://github.com/t3ran13/php-graphene-node-client/blob/debug/docker/local/dockerfile-php7-fpm

CryptoBenji commented 6 years ago

I will try to play with it, but I think I have it all...

CryptoBenji commented 6 years ago

Tried everything, doesn't seem to work, will try on production server when I'll have the opportunity

meanwhile I can use node.js + steemlib as payment module and call it from php... (it works)

CryptoBenji commented 6 years ago

I had some progress in the errors, by changing the node to protected $nodeURL = 'https://gtg.steem.house'; The default one not works from my server for some reason... Will try to play with this one later...

executing steemlib from php also works fine... believe it will also be ok if amount of transactions is not very big...

JsonRPC\Validator\JsonFormatValidator::validate(NULL) #1 /var/www/html/vendor/fguillot/json-rpc/src/JsonRPC/Client.php(194): JsonRPC\Response\ResponseParser->parse() #2 /var/www/html/vendor/fguillot/json-rpc/src/JsonRPC/Client.php(178): JsonRPC\Client->sendPayload('{"jsonrpc":"2.0...') #3 /var/www/html/vendor/t3ran13/php-graphene-node-client/Connectors/Http/HttpConnectorAbstract.php(160): JsonRPC\Client->execute('call', Array) #4 /var/www/html/vendor/t3ran13/php-graphene-node-client/Commands/Login/CommandAbstract.php(70): GrapheneNodeClient\Connectors\Http\HttpConnectorAbstract->doRequest('login_api', Array, 'array') #5 /var/www/html/vendor/t3ran13/php-graphene-node-client/Commands/Login/CommandAbstract.php(40): GrapheneNodeClient\Commands\Login\Comm in /var/www/html/vendor/fguillot/json-rpc/src/JsonRPC/Validator/JsonFormatValidator.php on line 26

t3ran13 commented 6 years ago

sorry for long answer it is arror with parsing of answer from node

t3ran13 commented 6 years ago

i will check brodcast and tell later

t3ran13 commented 6 years ago

OpVote works correctly with node https://api.steemit.com and the same error for https://gtg.steem.house

try wss://rpc.steemliberator.com, i will fix it later

t3ran13 commented 6 years ago

'JsonRPC\Validator\JsonFormatValidator::validate(NULL)'

@CryptoBenji i think trouble in port)

see details for https://gtg.steem.house here https://geo.steem.pl/ you need port 8090

choose some other node, it is down now

t3ran13 commented 6 years ago

@CryptoBenji hi! i fixed bug! It was string serialisation bug, it was working only with short strings

bug fix in master