How to get revert status string for an Ethereum Transaction
====
_Note:_ the RPC node must support traces.
1. Yes, the transaction was failed:
```shell
$ curl -X POST -H "Content-Type: application/json" --data \
'{"jsonrpc":"2.0","method":"eth_getTransactionReceipt","params": ["0x5aff55e11c2befe5203bc0e821bc4503900a6ec44c07f377759353d71f0356bc"],"id":1}' \
https://sokol.poa.network
```
```json
{"jsonrpc":"2.0","result":{"blockHash":"0x6d70ef7f0cea0244e5611b33c7101d0549295b43e68fcb9e3eb327069485045f","blockNumber":"0xdf032d","contractAddress":null,"cumulativeGasUsed":"0x2234f","from":"0xe4c2820ec69410907f312b7487af3dfb32640c33","gasUsed":"0x5356","logs":[],"logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","status":"0x0","to":"0x852685e67b63dc237057252d82be1667deab3f31","transactionHash":"0x5aff55e11c2befe5203bc0e821bc4503900a6ec44c07f377759353d71f0356bc","transactionIndex":"0x1"},"id":1}
```
2. Get the transaction data:
```shell
$ curl -X POST -H "Content-Type: application/json" --data \
'{"jsonrpc":"2.0","method":"eth_getTransactionByHash","params": ["0x5aff55e11c2befe5203bc0e821bc4503900a6ec44c07f377759353d71f0356bc"],"id":1}' \
https://sokol.poa.network
```
```json
{"jsonrpc":"2.0","result":{"blockHash":"0x6d70ef7f0cea0244e5611b33c7101d0549295b43e68fcb9e3eb327069485045f","blockNumber":"0xdf032d","chainId":"0x4d","condition":null,"creates":null,"from":"0xe4c2820ec69410907f312b7487af3dfb32640c33","gas":"0x2dc6c0","gasPrice":"0x12a05f200","hash":"0x5aff55e11c2befe5203bc0e821bc4503900a6ec44c07f377759353d71f0356bc","input":"0xa2b7c801","nonce":"0x9a","publicKey":"0xda348cbb706eeeb0fcecd2f742dd2b95fd1ccec36b2e5b00c3e49e1d9a861736b0d6edf33bc16de3bb802b093765b8f8897cd014d78997ba83171095296ca087","r":"0x4e7d954c6a5dc5ccb5184a784a5120fe5c69da72bd100d9986f0bbb8568bd837","raw":"0xf86b819a85012a05f200832dc6c094852685e67b63dc237057252d82be1667deab3f318084a2b7c80181bea04e7d954c6a5dc5ccb5184a784a5120fe5c69da72bd100d9986f0bbb8568bd837a060a3fd596dc97c33cc4dab466f57ae89a4516b8e8ebe8d1fd1c8047748e70e6d","s":"0x60a3fd596dc97c33cc4dab466f57ae89a4516b8e8ebe8d1fd1c8047748e70e6d","standardV":"0x1","to":"0x852685e67b63dc237057252d82be1667deab3f31","transactionIndex":"0x1","v":"0xbe","value":"0x0"},"id":1}
```
3. Construct `eth_call` with the transaction data:
```shell
$ curl -X POST -H "Content-Type: application/json" --data \
'{"jsonrpc":"2.0","method":"eth_call","params": [{"from": "0xe4C2820EC69410907F312b7487af3DFB32640c33","to": "0x852685E67B63Dc237057252D82Be1667Deab3f31","gas": "0x2dc6c0","gasPrice": "0x12a05f200","value": "0x0","data": "0xa2b7c801"}, "0xdf032d"],"id":1}' \
https://sokol.poa.network
```
```json
{"jsonrpc":"2.0","error":{"code":-32015,"message":"VM execution error.","data":"Reverted 0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000d43616e2049206765742069743f00000000000000000000000000000000000000"},"id":1}
```
4. Decode the revert status string:
```shell
$ python3 -c "print(0x43616e2049206765742069743f.to_bytes(32, 'big').lstrip(b'\0x00'))"
```
```
b'Can I get it?'
```