トランザクションが失敗した理由をどのように理解できますか?
1 回答
- 投票
-
- 2019-02-02
失敗したトランザクションを検出し、事前適用(RPC)でエラーコードを返す必要があります.このトランザクションが挿入されている場合でも、ウォレットのバグまたは不正なエラー処理を示しています.このトランザクションが失敗した理由は簡単にわかります.それは全額を送ろうとしましたが、火傷をカバーするのに十分な資金がありませんでした.
rpcを使用してメタデータを取得できます.この例では、レベル
です.296452
でophashesをチェックします.元のリンクから関心のあるophashは、onuEbjVrbaXtn4iK8KFzc4a8xTkfkyAfxiNE698SLm3MtnimdUs
ブロックに関するすべての情報は、でアクセスできます
https://rpc.tezrpc.me/chains/main/blocks/296452
簡単にするために、関心のある特定の操作を除外できます.操作には2つの値のインデックスが付けられます.ウォレットから実行される操作の場合、最初のインデックスは常に3になります.
https://rpc.tezrpc.me/chains/main/blocks/296452/operation_hashes/3
["ooeujV9F66p54xzKL3d8UgsdriAPwqroipLZRdVXVJKpD6oAMJA","onuEbjVrbaXtn4iK8KFzc4a8xTkfkyAfxiNE698SLm3MtnimdUs"]
ここでの2番目の操作ハッシュ(インデックス1)は、関心のあるものであるため、場所3/1でオファッシュを見つけます.
https://rpc.tezrpc.me/chains/main/ブロック/296452/operation_hashes/3/1
"onuEbjVrbaXtn4iK8KFzc4a8xTkfkyAfxiNE698SLm3MtnimdUs"
最後に、rpcにブロック
296452
と場所3/1
での操作を要求します.https://rpc.tezrpc.me/chains/main/ブロック/296452/operations/3/1
{ "protocol": "PsddFKi32cMJ2qPjf43Qv5GDWLDPZb3T3bF6fLKiF5HtvHNU7aP", "chain_id": "NetXdQprcVkpaWU", "hash": "onuEbjVrbaXtn4iK8KFzc4a8xTkfkyAfxiNE698SLm3MtnimdUs", "branch": "BMVq2BDfVH4Y3NdNa9Dr8smiHHkFkFqiD7qRKT9SH6TH4zrr74M", "contents": [ { "kind": "transaction", "source": "tz1eKsvd2G7QXsJvim5ZBYhxnuN7SJLe2phy", "fee": "1420", "counter": "302028", "gas_limit": "10300", "storage_limit": "300", "amount": "1681485669", "destination": "tz1MNEqXdtu8YT4ppF5tRJ7PLS8vRZJ19FRQ", "metadata": { "balance_updates": [ { "kind": "contract", "contract": "tz1eKsvd2G7QXsJvim5ZBYhxnuN7SJLe2phy", "change": "-1420" }, { "kind": "freezer", "category": "fees", "delegate": "tz1Yju7jmmsaUiG9qQLoYv35v5pHgnWoLWbt", "level": 72, "change": "1420" } ], "operation_result": { "status": "backtracked", "errors": [ { "kind": "temporary", "id": "proto.003-PsddFKi3.contract.cannot_pay_storage_fee" }, { "kind": "permanent", "id": "proto.003-PsddFKi3.context.storage_error", "missing_key": [ "contracts", "index", "ed25519", "cc", "fb", "95", "87", "2a", "59f77f5729e9376bcb315e917e322e", "balance" ], "function": "get" } ], "balance_updates": [ { "kind": "contract", "contract": "tz1eKsvd2G7QXsJvim5ZBYhxnuN7SJLe2phy", "change": "-1681485669" }, { "kind": "contract", "contract": "tz1MNEqXdtu8YT4ppF5tRJ7PLS8vRZJ19FRQ", "change": "1681485669" }, { "kind": "contract", "contract": "tz1eKsvd2G7QXsJvim5ZBYhxnuN7SJLe2phy", "change": "-257000" } ], "consumed_gas": "10260", "allocated_destination_contract": true } } } ], "signature": "sigS5LzsJh9wuk4vniGtB2xn8jiFgBjVujd3nrWXVSZhigQhKwm7scVoEVgWmGSrqPq5uM3frp6b1dBZYzfnhAYTiSv1YEw5" }
最初のエラーコードは
であることがわかります.proto.003-PsddFKi3.contract.cannot_pay_storage_fee
Failed transactions should be detected and get an error code returned in the preapply (RPC). So that this transaction even have been injected indicate a bug or bad error handling in a wallet. It is very easy to see why this transaction failed. It tried to send the full balance and wont have enough funds to cover the burn.
You can use the rpc to get the metadata. In this example you would check the ophashes on level
296452
. The ophash we are interested in from your original link isonuEbjVrbaXtn4iK8KFzc4a8xTkfkyAfxiNE698SLm3MtnimdUs
The entire information regarding the block can be accessed at
https://rpc.tezrpc.me/chains/main/blocks/296452
To make it easier we can filter out the specific operation we are interested in. Operations are indexed by 2 values. The first index will always be 3 for operations done from a wallet.
https://rpc.tezrpc.me/chains/main/blocks/296452/operation_hashes/3
["ooeujV9F66p54xzKL3d8UgsdriAPwqroipLZRdVXVJKpD6oAMJA","onuEbjVrbaXtn4iK8KFzc4a8xTkfkyAfxiNE698SLm3MtnimdUs"]
The second operation hash (index 1) here is the one we are interested in, so we'll find your ophash at location 3/1.
https://rpc.tezrpc.me/chains/main/blocks/296452/operation_hashes/3/1
"onuEbjVrbaXtn4iK8KFzc4a8xTkfkyAfxiNE698SLm3MtnimdUs"
Finally we ask the rpc for block
296452
and the operation at location3/1
.https://rpc.tezrpc.me/chains/main/blocks/296452/operations/3/1
{ "protocol": "PsddFKi32cMJ2qPjf43Qv5GDWLDPZb3T3bF6fLKiF5HtvHNU7aP", "chain_id": "NetXdQprcVkpaWU", "hash": "onuEbjVrbaXtn4iK8KFzc4a8xTkfkyAfxiNE698SLm3MtnimdUs", "branch": "BMVq2BDfVH4Y3NdNa9Dr8smiHHkFkFqiD7qRKT9SH6TH4zrr74M", "contents": [ { "kind": "transaction", "source": "tz1eKsvd2G7QXsJvim5ZBYhxnuN7SJLe2phy", "fee": "1420", "counter": "302028", "gas_limit": "10300", "storage_limit": "300", "amount": "1681485669", "destination": "tz1MNEqXdtu8YT4ppF5tRJ7PLS8vRZJ19FRQ", "metadata": { "balance_updates": [ { "kind": "contract", "contract": "tz1eKsvd2G7QXsJvim5ZBYhxnuN7SJLe2phy", "change": "-1420" }, { "kind": "freezer", "category": "fees", "delegate": "tz1Yju7jmmsaUiG9qQLoYv35v5pHgnWoLWbt", "level": 72, "change": "1420" } ], "operation_result": { "status": "backtracked", "errors": [ { "kind": "temporary", "id": "proto.003-PsddFKi3.contract.cannot_pay_storage_fee" }, { "kind": "permanent", "id": "proto.003-PsddFKi3.context.storage_error", "missing_key": [ "contracts", "index", "ed25519", "cc", "fb", "95", "87", "2a", "59f77f5729e9376bcb315e917e322e", "balance" ], "function": "get" } ], "balance_updates": [ { "kind": "contract", "contract": "tz1eKsvd2G7QXsJvim5ZBYhxnuN7SJLe2phy", "change": "-1681485669" }, { "kind": "contract", "contract": "tz1MNEqXdtu8YT4ppF5tRJ7PLS8vRZJ19FRQ", "change": "1681485669" }, { "kind": "contract", "contract": "tz1eKsvd2G7QXsJvim5ZBYhxnuN7SJLe2phy", "change": "-257000" } ], "consumed_gas": "10260", "allocated_destination_contract": true } } } ], "signature": "sigS5LzsJh9wuk4vniGtB2xn8jiFgBjVujd3nrWXVSZhigQhKwm7scVoEVgWmGSrqPq5uM3frp6b1dBZYzfnhAYTiSv1YEw5" }
You will see that the first error code is
proto.003-PsddFKi3.contract.cannot_pay_storage_fee
トランザクションエラーコード?
ランダムに失敗したtzscan.ioでのトランザクション例は、特定のエラーコードを提供しません.ターミナル出力にアクセスできない未知のノードによって注入されました.
エラーがどのように発生したかをさかのぼる方法はありますか?これは単にtzscanに表示されませんか?