eos icon indicating copy to clipboard operation
eos copied to clipboard

How to judge illegal transaction?

Open guaiguaihw opened this issue 8 years ago • 4 comments

I push this transaction to the chain, use api http://localhost:8888/v1/chain/push_transaction, body is below:

{
  "expiration": "2018-05-09T08:33:24",
  "region": 0,
  "ref_block_num": 59579,
  "ref_block_prefix": 2183939961,
  "max_net_usage_words": 0,
  "max_kcpu_usage": 0,
  "delay_sec": 0,
  "context_free_actions": [],
  "actions": [{
      "account": "eosio.token",
      "name": "transfer",
      "authorization": [{

          "actor": "user",
          "permission": "active"
        }
      ],
      "data": "00000000007015d6000000005c95b1ca400d03000000000004454f5300000000046d656d6f"
    }
  ],
  "signatures": [    "EOSJuvvxpUH4QJuvh3PAQezjTsUT4HqPcQRV37rrfkxFD7hhBm1mYLHNXDE4DsfBf42Wf5gc7PubUv6wa2t9CyGphYrkthQwU"
  ],
  "context_free_data": []
}

But the data field is illegal, I transfer an amount of tokens that far more than my account balance, use api to get data encode:

curl  http://127.0.0.1:8888/v1/chain/abi_json_to_bin -X POST -d '{"code":"eosio.token", "action":"transfer", "args":"args":{"from":"user", "to":"tester", "quantity":"90.0000 SYS", "memo":"memo"}}'

Then I found that this illegal transaction is on chain, but the data field can't be decoded, and the transfer is not effective.

{
  "expiration": "2018-05-31T04:00:00",
  "ref_block_num": 54801,
  "ref_block_prefix": 2102018996,
  "max_net_usage_words": 0,
  "max_cpu_usage_ms": 0,
  "delay_sec": 0,
  "context_free_actions": [],
  "actions": [{
      "account": "eosio.token",
      "name": "transfer",
      "authorization": [{
          "actor": "exter",
          "permission": "active"
        }
      ],
      "data": "0000000080ab725700000000807015d6a0860100000000000453595300000000046d656d6f"
    }
  ],
  "transaction_extensions": [],
  "signatures": [
    "SIG_K1_Jv4bGtMJtwASdU22fBZwqNiLSSjHNCWDADmtQDvYbH2QMQtp8BDLF3GjedqkSr6LEUZe3VopZX546NqLqMFtq37GWsEsbV"
  ],
  "context_free_data": []
}

My question is that there is no field to judge if the transaction has been done correctly by BP, so what should we do to judge it? I guess if the data field can't be decoded correctly, it could be sure that the transaction has not been done correctly?

guaiguaihw avatar May 31 '18 10:05 guaiguaihw

@bytemaster

guaiguaihw avatar May 31 '18 10:05 guaiguaihw

I think you will find this helpful: https://github.com/EOSIO/eos/wiki/Tutorial-Exchange-Deposit-Withdraw#polling-account-history

heifner avatar May 31 '18 11:05 heifner

I have already read it. The iilegal tansaction is comfired by blockchain, But data field can't be decoded.@heifner

guaiguaihw avatar Jun 01 '18 03:06 guaiguaihw

@guaiguaihw You find a way to identify the correct completion of a transaction

tianYD avatar Jul 13 '18 07:07 tianYD