1

In ripple, bitcoin and ethereum you can sign a transaction and push/broadcast signed transaction hash only. That effectively represents the whole transaction. for example

12000022800000002400000001201B7FFFFFFF614000000011E1A300684000000000B71B00732102823A1B036701A084E5F0A924CBDDD164B9772697B1115524A59A64AE0A9ADAF1744730450221008CB6CEF2F851A3BA6CAE744C8680A797C6B5BE2AC166822EB6293BC8BFB8A197022067D98766D5D670D9919386DE4E7FB4

Is it possible in EOS as well?

I have signed a transaction and this is my signed transaction which I want to push:

{
 "transaction_id":"3992f5daa5d8fe741771939948d8d85ac1a76da7110d66caaf7ff3a9be70b2a9",
"broadcast":false,
"transaction":{
  "compression":"none",
  "transaction":{
     "expiration":"2018-12-11T13:51:20",
     "ref_block_num":45983,
     "ref_block_prefix":71589329,
     "max_net_usage_words":0,
     "max_cpu_usage_ms":0,
     "delay_sec":0,
     "context_free_actions":[

     ],
     "actions":[
        "transfer"
     ],
     "transaction_extensions":[

     ]
  },
  "signatures":[
     "SIG_K1_Kb7o3xyCmTAqb7o7Nuea3og3Df9u9nbMB4U6idiyhKnC3CVqLhfb3GnuqX5mCuFY3powY9ARHszwo9xXinrzp6Z25ZUZHt"
  ]
}
}

Can I just used signature to push the transaction or do I have to send the Packed Transaction data as well?

1 Answer 1

0

Yes, you need the packed transaction data. If you add the flags --print-request and --print-response (example of this), you can see how the signature process works. It requires (docs):

  • txn - string
  • keys - string
  • id - string

The push transaction RPC API call requires:

  • signatures - array of signatures required to authorize transaction
  • compression - compression used, usually false
  • packed_context_free_data - string
  • packed_trx - string

In cleos, you can use the -d and --return-packed flags together to print to the console a signed transaction.

-d,--dont-broadcast  - don't broadcast transaction to the network (just print to stdout)
--return-packed      - used in conjunction with --dont-broadcast to get the packed transaction

So I did this for a simple contract:

cleos -u http://jungle2.cryptolions.io:80 push action -d --return-packed eosezchatnat sendmsg '["eosezchatnat","hi"]' -p eosezchatnat

{
  "signatures": [
    "SIG_K1_K9PsoNw9AGY7YEmuQkgmC1i3qfuLvGvUZTzc2dHZ9Bjoru6KZEQJAZrYRFVHw22TG1dthryxfW4m5YWcaCDeCLNBHPeDqQ"
  ],
  "compression": "none",
  "packed_context_free_data": "",
  "packed_trx": "56de0f5c82dc4a508078000000000190cdcca6a1af3055000000806199a6c20190cdcca6a1af305500000000a8ed32320b90cdcca6a1af305502686900"
}

You could then send that transaction to the chain.

1
  • 1
    Thanks, I have figured out as well. I used /v1/chain/abi_json_to_bin -X POST -d '{"code":"eosio.token", "action":"transfer", "args":{"from":"alice", "to":"bob", "quantity":"10.0000 EOS", "memo":"gift from alice to bob"}}' to get packed transaction.
    – VJV
    Commented Dec 11, 2018 at 16:09

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.