EOSIO / eos

An open source smart contract platform
https://developers.eos.io/manuals/eos
MIT License
11.28k stars 3.6k forks source link

History api plugin get_transaction does not produce valid json #4783

Closed filipniziol closed 6 years ago

filipniziol commented 6 years ago

url https://eu1.eosdac.io:443/v1/history/get_transaction -X POST -d '{"id":"85b6ae3a842a77929b826a3a39f80fc10244a2ce6de1045488e520b02962662c"}'

The returned data is not a valid json: http://json.parser.online.fr/

andriantolie commented 6 years ago

I checked it, the above curl command returns

{"id":"85b6ae3a842a77929b826a3a39f80fc10244a2ce6de1045488e520b02962662c","trx":{"receipt":{"status":"executed","cpu_usage_us":1187,"net_usage_words":17,"trx":[1,{"signatures":["SIG_K1_Kgd5EBBzDBoWuYYB75UYxVFB8CaaE6mu3yrnXNwT1CZQ2qdSSC2hMVtWDn8Sf7xdgfYz3YNnKxuYZkauZt4dYuBLwhV8nu"],"compression":"none","packed_context_free_data":"","packed_trx":"697b515bb4c640f76baa000000000180a78234d38ad575000000572d3ccdcd0150aba9d5d08ad57500000000a8ed32322a50aba9d5d08ad575a09865ff4999876380d1f008000000000649524553504f000950726f6d6f74696f6e00"}]},"trx":{"expiration":"2018-07-20T06:04:25","ref_block_num":50868,"ref_block_prefix":2859202368,"max_net_usage_words":0,"max_cpu_usage_ms":0,"delay_sec":0,"context_free_actions":[],"actions":[{"account":"irespotokens","name":"transfer","authorization":[{"actor":"irespoappapp","permission":"active"}],"data":{"from":"irespoappapp","to":"gi3tmmjzgqge","quantity":"150.000000 IRESPO","memo":"Promotion"},"hex_data":"50aba9d5d08ad575a09865ff4999876380d1f008000000000649524553504f000950726f6d6f74696f6e"}],"transaction_extensions":[],"signatures":["SIG_K1_Kgd5EBBzDBoWuYYB75UYxVFB8CaaE6mu3yrnXNwT1CZQ2qdSSC2hMVtWDn8Sf7xdgfYz3YNnKxuYZkauZt4dYuBLwhV8nu"],"context_free_data":[]}},"block_time":"2018-07-20T06:03:55.500","block_num":6801398,"last_irreversible_block":7288593,"traces":[{"receipt":{"receiver":"irespotokens","act_digest":"c230ce16361566ab915c6ca610a57f4c52d8d747b1aace7b3b461126a10ea426","global_sequence":52929530,"recv_sequence":117,"auth_sequence":[["irespoappapp",337]],"code_sequence":4,"abi_sequence":4},"act":{"account":"irespotokens","name":"transfer","authorization":[{"actor":"irespoappapp","permission":"active"}],"data":{"from":"irespoappapp","to":"gi3tmmjzgqge","quantity":"150.000000 IRESPO","memo":"Promotion"},"hex_data":"50aba9d5d08ad575a09865ff4999876380d1f008000000000649524553504f000950726f6d6f74696f6e"},"elapsed":415,"cpu_usage":0,"console":"","total_cpu_usage":0,"trx_id":"85b6ae3a842a77929b826a3a39f80fc10244a2ce6de1045488e520b02962662c","inline_traces":[{"receipt":{"receiver":"irespoappapp","act_digest":"c230ce16361566ab915c6ca610a57f4c52d8d747b1aace7b3b461126a10ea426","global_sequence":52929531,"recv_sequence":114,"auth_sequence":[["irespoappapp",338]],"code_sequence":4,"abi_sequence":4},"act":{"account":"irespotokens","name":"transfer","authorization":[{"actor":"irespoappapp","permission":"active"}],"data":{"from":"irespoappapp","to":"gi3tmmjzgqge","quantity":"150.000000 IRESPO","memo":"Promotion"},"hex_data":"50aba9d5d08ad575a09865ff4999876380d1f008000000000649524553504f000950726f6d6f74696f6e"},"elapsed":3,"cpu_usage":0,"console":"","total_cpu_usage":0,"trx_id":"85b6ae3a842a77929b826a3a39f80fc10244a2ce6de1045488e520b02962662c","inline_traces":[]},{"receipt":{"receiver":"gi3tmmjzgqge","act_digest":"c230ce16361566ab915c6ca610a57f4c52d8d747b1aace7b3b461126a10ea426","global_sequence":52929532,"recv_sequence":674,"auth_sequence":[["irespoappapp",339]],"code_sequence":4,"abi_sequence":4},"act":{"account":"irespotokens","name":"transfer","authorization":[{"actor":"irespoappapp","permission":"active"}],"data":{"from":"irespoappapp","to":"gi3tmmjzgqge","quantity":"150.000000 IRESPO","memo":"Promotion"},"hex_data":"50aba9d5d08ad575a09865ff4999876380d1f008000000000649524553504f000950726f6d6f74696f6e"},"elapsed":5,"cpu_usage":0,"console":"","total_cpu_usage":0,"trx_id":"85b6ae3a842a77929b826a3a39f80fc10244a2ce6de1045488e520b02962662c","inline_traces":[]}]},{"receipt":{"receiver":"irespoappapp","act_digest":"c230ce16361566ab915c6ca610a57f4c52d8d747b1aace7b3b461126a10ea426","global_sequence":52929531,"recv_sequence":114,"auth_sequence":[["irespoappapp",338]],"code_sequence":4,"abi_sequence":4},"act":{"account":"irespotokens","name":"transfer","authorization":[{"actor":"irespoappapp","permission":"active"}],"data":{"from":"irespoappapp","to":"gi3tmmjzgqge","quantity":"150.000000 IRESPO","memo":"Promotion"},"hex_data":"50aba9d5d08ad575a09865ff4999876380d1f008000000000649524553504f000950726f6d6f74696f6e"},"elapsed":3,"cpu_usage":0,"console":"","total_cpu_usage":0,"trx_id":"85b6ae3a842a77929b826a3a39f80fc10244a2ce6de1045488e520b02962662c","inline_traces":[]},{"receipt":{"receiver":"gi3tmmjzgqge","act_digest":"c230ce16361566ab915c6ca610a57f4c52d8d747b1aace7b3b461126a10ea426","global_sequence":52929532,"recv_sequence":674,"auth_sequence":[["irespoappapp",339]],"code_sequence":4,"abi_sequence":4},"act":{"account":"irespotokens","name":"transfer","authorization":[{"actor":"irespoappapp","permission":"active"}],"data":{"from":"irespoappapp","to":"gi3tmmjzgqge","quantity":"150.000000 IRESPO","memo":"Promotion"},"hex_data":"50aba9d5d08ad575a09865ff4999876380d1f008000000000649524553504f000950726f6d6f74696f6e"},"elapsed":5,"cpu_usage":0,"console":"","total_cpu_usage":0,"trx_id":"85b6ae3a842a77929b826a3a39f80fc10244a2ce6de1045488e520b02962662c","inline_traces":[]}]}

And I have checked it with both http://json.parser.online.fr/ and https://jsoneditoronline.org/. Both of them tell me that it is a valid json. Can you elaborate your situation more?

rise-worlds commented 6 years ago

node not enabled for plugins history_plugin or no parameters are set --filter-on *

tradzero commented 6 years ago

@rise-worlds so, can i know which node already set up that parameters?

grigio commented 6 years ago

Transactions where an action is involved are currently broken https://github.com/EOSIO/eosjs/issues/287

grigio commented 6 years ago
curl https://eu1.eosdac.io:443/v1/history/get_transaction -X POST -d '{"id":"85b6ae3a842a77929b826a3a39f80fc10244a2ce6de1045488e520b02962662c"}'

{"code":400,"message":"Bad Request","error":{"code":3040011,"name":"tx_not_found","what":"The transaction can not be found","details":[{"message":"Transaction 85b6ae3a842a77929b826a3a39f80fc10244a2ce6de1045488e520b02962662c not found in history and no block hint was given","file":"history_plugin.cpp","line_number":396,"method":"get_transaction"}]}}

it works with non actions transactions

Eospark is not affected https://eospark.com/MainNet/tx/85b6ae3a842a77929b826a3a39f80fc10244a2ce6de1045488e520b02962662c

grigio commented 6 years ago

OK curl https://api.eosn.io/v1/history/get_transaction -d '{"id":"ec63b53ca"}'

NO OK curl https://api.eosn.io/v1/history/get_transaction -d '{"id":"efec8d264dfce6f8d26f8f8101283308cb9ac78aaf89bc4db35ff5f79bfe3fcf"}'

But in some explorer is still a valid action transaction https://eosflare.io/tx/efec8d264dfce6f8d26f8f8101283308cb9ac78aaf89bc4db35ff5f79bfe3fcf screenshot from 2018-08-06 19-08-55 but on some explorers still works

grigio commented 6 years ago

https://github.com/EOSIO/eosjs/issues/287#issuecomment-410788732

filipniziol commented 6 years ago

I am closing it. I was generating it in gitbash and it was showing that it is not valid json. Generating in Visual Studio turned out to be valid. Maybe some extra characters when copying?