eosio_assert_message assertion failure

Created on 10 Jun 2018  ยท  6Comments  ยท  Source: EOSIO/eos

I'm getting below error when executing push transaction:

{
    "code": 500,
    "message": "Internal Service Error",
    "error": {
        "code": 3050003,
        "name": "eosio_assert_message_exception",
        "what": "eosio_assert_message assertion failure",
        "details": [
            {
                "message": "assertion failure with message: read",
                "file": "wasm_interface.cpp",
                "line_number": 928,
                "method": "eosio_assert"
            },
            {
                "message": "",
                "file": "apply_context.cpp",
                "line_number": 53,
                "method": "exec_one"
            }
        ]
    }
}

This is my request payload to sign transaction:

[
  {
    "expiration": "2018-06-10T11:30:00",
    "ref_block_num": 10580,
    "ref_block_prefix": 3966243334,
    "max_net_usage_words": 200,
    "max_cpu_usage_ms": 100,
    "delay_sec": 0,
    "compression": "none",
    "context_free_actions": [],
    "actions": [
      {
        "code": "currency",
        "account": "eosio.token",
        "name": "transfer",
        "authorization": [
          {
            "actor": "eosio",
            "permission": "active"
          }
        ],
        "data": "227b2266726f6d223a22656f73696f2e746f6b656e222c22746f223a22616e696b6574222c227175616e74697479223a2232302e3030303020454f53222c226d656d6f223a22454f53616e696b6574227d22"
      }
    ],
    "transaction_extensions": [],
    "signatures": [],
    "context_free_data": []
  },
  [
    "EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV"
  ],
  "706a7ddd808de9fc2b8879904f3b392256c83104c1d544b38302cc07d9fca477"
]

This is my request payload for push transaction:

{
  "signatures": [
    "SIG_K1_K62FwQovHpRM3grkAreHxkFDBXoUy9pi2FELC4EwCJLwVEjJLY6QtyTcrfintATbMVxXmXQUqaA7wrRMXdSZ6MiwGhPLNw"
  ],
  "compression": "none",
  "context_free_data": [],
  "transaction": {
    "expiration": "2018-06-10T11:30:00",
    "ref_block_num": 10580,
    "ref_block_prefix": 3966243334,
    "max_net_usage_words": 200,
    "max_cpu_usage_ms": 100,
    "delay_sec": 0,
    "context_free_actions": [],
    "actions": [
        {
            "account": "eosio.token",
            "name": "transfer",
            "authorization": [
                {
                    "actor": "eosio",
                    "permission": "active"
                }
            ],
            "data": "227b2266726f6d223a22656f73696f2e746f6b656e222c22746f223a22616e696b6574222c227175616e74697479223a2232302e3030303020454f53222c226d656d6f223a22454f53616e696b6574227d22"
        }
    ]
    }
}

Can someone please tell me what am I missing here?

I have one more question. Can I not send json as data in transaction? for example, I need to send this below json

{
   "from": "sender_account",
   "to": "receiver_account",
   "quantity": "100.0000 EOS",
   "memo": "123456"
}

When I try to sign transaction using above json, it gives me cast error(something like can not cast object type to string).
How do I send this json as data in transaction?

Most helpful comment

@cindyssun5 @fundurian This is the flow which worked for me.

  1. Unlock wallet
  2. Convert the json { "from": "sender_account", "to": "receiver_account", "quantity": "100.0000 EOS", "memo": "123456"} to binary using /v1/chain/abi_json_to_bin
  3. sign the transaction using /v1/wallet/sign_transaction. For this you might need latest chain_info(for chain_id) and block(for ref_block and ref_block_prefix)
 post_body = [
   {
     expiration: expiration,
     ref_block_num: ref_block_num,
     ref_block_prefix: ref_block_prefix,
     max_net_usage_words: 200,
     max_cpu_usage_ms: 100,
     delay_sec: 0,
     compression: 'none',
     context_free_actions: [],
     actions: [
       {
         code: 'eosio.token',
         account: 'eosio.token',
         name: 'transfer',
         authorization: [
           {
             actor: "account_name",
             permission: 'active'
           }
         ],
         data: data
       }
     ],
     signatures: []
   },
   [
     public_key
   ], chain['chain_id']
 ].to_json
  1. Send the transaction using /v1/chain/push_transaction
    If signed_tx is response of step 3 then,
    post_body = post_body = { signatures: signed_tx['signatures'], compression: 'none', context_free_data: [], transaction: signed_tx }.to_json
    You should receive transaction id in the response if everything goes well
  2. Lock the wallet

Hope this helps!

All 6 comments

Sorted

@aniketdivekar - Curious as to how you fixed this? Having the same issue.

Same error, how do you solve it ? please help?

cri cri

I believe is the decimals, you have to add them

@cindyssun5 @fundurian This is the flow which worked for me.

  1. Unlock wallet
  2. Convert the json { "from": "sender_account", "to": "receiver_account", "quantity": "100.0000 EOS", "memo": "123456"} to binary using /v1/chain/abi_json_to_bin
  3. sign the transaction using /v1/wallet/sign_transaction. For this you might need latest chain_info(for chain_id) and block(for ref_block and ref_block_prefix)
 post_body = [
   {
     expiration: expiration,
     ref_block_num: ref_block_num,
     ref_block_prefix: ref_block_prefix,
     max_net_usage_words: 200,
     max_cpu_usage_ms: 100,
     delay_sec: 0,
     compression: 'none',
     context_free_actions: [],
     actions: [
       {
         code: 'eosio.token',
         account: 'eosio.token',
         name: 'transfer',
         authorization: [
           {
             actor: "account_name",
             permission: 'active'
           }
         ],
         data: data
       }
     ],
     signatures: []
   },
   [
     public_key
   ], chain['chain_id']
 ].to_json
  1. Send the transaction using /v1/chain/push_transaction
    If signed_tx is response of step 3 then,
    post_body = post_body = { signatures: signed_tx['signatures'], compression: 'none', context_free_data: [], transaction: signed_tx }.to_json
    You should receive transaction id in the response if everything goes well
  2. Lock the wallet

Hope this helps!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

williamleecn picture williamleecn  ยท  3Comments

bezalel picture bezalel  ยท  3Comments

ResponsiveWebApps picture ResponsiveWebApps  ยท  3Comments

christola picture christola  ยท  3Comments

sim31 picture sim31  ยท  3Comments