0

I am trying RPC API. Here is the code which I am using on cmd for testing a dummy transaction.

curl --request POST --url http://localhost:8080/v1/chain/push_transaction --header 'accept: application/json' --header 'content-type: application/json' --data '{"signatures":["EOS4wJVpa8YBT1BnBtGHXM8PgQr9cxD2TuZVGhciLZZwp4AsjStoC"],"compression":false,"packed_context_free_data":"00","packed_trx":"00"}'

But each time I get same error message:

{"code":500,"message":"Internal Service Error","error":{"code":3010010,"name":"packed_transaction_type_exception","what":"Invalid packed transaction","details":[{"message":"Invalid packed transaction","file":"chain_plugin.cpp","line_number":1562,"method":"push_transaction"},{"message":"pivot != std::string::npos: No delimiter in string, cannot determine type: EOS4wJVpa8YBT1BnBtGHXM8PgQr9cxD2TuZVGhciLZZwp4AsjStoC","file":"signature.cpp","line_number":20,"method":"parse_base58"},{"message":"error parsing signature","file":"signature.cpp","line_number":28,"method":"parse_base58"},{"message":"Failed to deserialize variant","file":"abi_serializer.hpp","line_number":697,"method":"from_variant"}]}}

Not sure what is wrong there. I want to use it in one PHP application so RPC is important for me.

UPDATE

Then tried solution with SIG_K1_ and SIG_R1_ also.

curl --request POST --url http://localhost:8080/v1/chain/push_transaction --header 'accept: application/json' --header 'content-type: application/json' --data '{"signatures":["SIG_K1_EOS4wJVpa8YBT1BnBtGHXM8PgQr9cxD2TuZVGhciLZZwp4AsjStoC"],"compression":false,"packed_context_free_data":"00","packed_trx":"00"}'

But it throw some different error like below.

{"code":500,"message":"Internal Service Error","error":{"code":3010010,"name":"packed_transaction_type_exception","what":"Invalid packed transaction","details":[{"message":"Invalid packed transaction","file":"chain_plugin.cpp","line_number":1562,"method":"push_transaction"},{"message":"Unable to decode base58 string EOS4wJVpa8YBT1BnBtGHXM8PgQr9cxD2TuZVGhciLZZwp4AsjStoC","file":"base58.cpp","line_number":625,"method":"from_base58"},{"message":"error parsing signature","file":"signature.cpp","line_number":28,"method":"parse_base58"},{"message":"Failed to deserialize variant","file":"abi_serializer.hpp","line_number":697,"method":"from_variant"}]}}

FYI, I am using cleos wallet keys to see the signature.

1 Answer 1

0

You are adding the public Key as your signature instead of signature itself and you have to provide a signature-base-prefix/signature-prefix because you can use different curve-algorithms to create keys (R1/K1).

... "signatures":["EOS4wJVpa8YBT1BnBtGHXM8PgQr9cxD2TuZVGhciLZZwp4AsjStoC"]...

must be

..."signatures":["SIG_K1_SIGNATUREJH1J2j124235HJWEHFE"]...

or

..."signatures":["SIG_R1_SIGNATUREJH1J2j124235HJWEHFE"]...
7
  • Unable to decode base58 string EOS4wJVpa8YBT1BnBtGHXM8PgQr9cxD2TuZVGhciLZZwp4AsjStoC New error is something like this with STG_K1 or STG_R1. Commented Oct 22, 2019 at 10:49
  • FYI, I am using cleos wallet keys to see the signature. Commented Oct 22, 2019 at 11:05
  • sry, my fault. Obviously you are adding the key as the signature - but you have to add the signature instead.
    – cmadh
    Commented Oct 22, 2019 at 12:05
  • You mean the openssl signature for my local machine? Or something else? Where can I find it? Commented Oct 22, 2019 at 12:07
  • You need to generate a signature based on base58-transaction-hash and your private-key. OpenSSL doesn't support the ECDSA needed and unfortunately I'm not a php-dev. Have you seen this one? packagist.org/packages/manamine/php-eos-rpc-sdk
    – cmadh
    Commented Oct 22, 2019 at 12:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.