3

I want to provide some RPC interfaces for web to interact with my own contract. I want to use the way like

curl http://localhost:8888/v1/chain/push_transaction -X POST -d '{"ref_block_num":"100","ref_block_prefix":"137469861","expiration":"2017-09-25T06:28:49","scope":["initb","initc"],"actions":[{"code":"currency","type":"transfer","recipients":["initb","initc"],"authorization":[{"account":"initb","permission":"active"}],"data":"000000000041934b000000008041934be803000000000000"}],"signatures":[],"authorizations":[]}'

in the link

https://eosio.github.io/eos/group__eosiorpc.html#v1chainpushtransaction

However it's out of date ? where could i find a correct one ?

1 Answer 1

1

I don't think they updated the code somewhere. What I usually do is to copy what we have from eosjs (checking their repo and/or using chrome inspection and looking at the network tab). For now, with DAWN-v4.0.0, we have this structure for the push_transaction:

  {
    "signatures": [
      "EOSKZ4pTehVfqs92wujRp34qRAvUjKJrUyufZfJDo9fdBLzhieyfUSUJpKz1Z12rxh1gTQZ4BcWvKourzxCLb2fMsvN898KSn"
    ],
    "compression": "none",
    "context_free_data": [],
    "transaction": {
      "region": 0,
      "ref_block_num": "32697",
      "ref_block_prefix": "32649",
      "expiration": "2018-09-25T06:28:49",
      "max_net_usage_words": 0,
      "max_kcpu_usage": 0,
      "delay_sec": 0,
      "context_free_actions": [],
      "actions": [
        {
          "account": "eoseco",
          "name": "transfer",
          "authorization": [
            {
              "actor": "eoseco",
              "permission": "active"
            }
          ],
          "data": "0000000050a430550000000000003ab60a000000000000000045434f0000000000"
        }
      ]
    }
  }
3
  • Thank you for your excellent answer. that's what i want.
    – Harry Ma
    Commented May 19, 2018 at 1:06
  • Do you know how to get the signatures": [ "EOSKZ4pTehVfqs92wujRp34qRAvUjKJrUyufZfJDo9fdBLzhieyfUSUJpKz1Z12rxh1gTQZ4BcWvKourzxCLb2fMsvN898KSn" ] manually without using cleos ?could eosjs sign that?
    – Harry Ma
    Commented May 19, 2018 at 2:04
  • Yes you can, my suggestion is to see how Scatter signs transactions because it utilizes eosjs. Commented May 19, 2018 at 2:54

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.