Comment puis-je comprendre pourquoi une transaction a échoué?
1 réponses
- votes
-
- 2019-02-02
Échec destransactions doivent être détectéeset obtenir un code d'erreur renvoyé dans lapriorité (RPC). Pour que cettetransaction ait étéinjectée,indiquez unbug ou unemauvaisemanipulation d'erreurs dans unportefeuille. Ilesttrèsfacile de voirpourquoi cettetransaction a échoué. Il aessayé d'envoyer le solde completet n'aurapas assez defondspour couvrir labrûlure.
Vouspouvez utiliser le RPCpour obtenir lesmétadonnées. Dans cetexemple,vous vérifieriez les ophases auniveau
296452
. L'ophash quenous souhaitons de votre lien d'origineestonuebjvrbaxtn4ik8kfzc4a8xtkfkyafxine698slm3mtnimdus
Lesinformations complètes sur lebloc sont accessibles à
https://rpc.tezrpc.me/chains/main/blocks/296452
Pourfaciliter,nouspouvonsfiltrer l'opération spécifique quenousintéressons. Les opérations sontindexéespar 2 valeurs. Lepremierindex seratoujours 3pour les opérationseffectuées àpartir d'unportefeuille.
https://rpc.ezrpc.me/chains/main/Blocs/296452 /Operation_HASHES/3
["OOEUJV9F66P54XZKL3D8UGSDRIAPWQROIPLZRDVXVJKPD6OAMJA","ONUEBJVRBAXTN4IK8KFXC4A8XTKFKEFXINE698SLM3MTNIMDUS"]
La deuxième opération HASH (Index 1) Voici celle quinousintéresse,nous allons donctrouver votre ophash à l'emplacement 3/1.
https://rpc.tezrpc.me/chains/Main/Blocs/296452 /Operation_HASHES/3/1
"onuebjvrbaxtn4ik8kfzc4a8xtkfkyafxine698slm3mtnimdus"
Enfin,nous demandons au RPCpour Bloc
296452
et l'opération à l'emplacement3/1
.https://rpc.tezrpc.me/chains/Main/Blocs/296452 /Opérations/3/1
{ "Protocole": "PSDDFKI32CMJ2QPJF43QV5GDWLDPZB3T3BF6FLKIF5HTVNU7AP", "Chain_id": "Netxdqprcvkpawu", "hachage": "Onuebjvrbaxtn4ik8kfzc4a8xtkfkyafxine698slm3mtnimdus", "BRANCH": "BMVQ2BDFVH4Y3NDNA9DR8SMIHHKFKFQID7QRKT9SH6TH4ZRR74M", "Contenu": [ { "type": "transaction", "Source": "tz1eksvd2g7qxsjvim5zbyhxnun7sjle2phy", "Frais": "1420", "Compteur": "302028", "gas_limit": "10300", "stockage_limit": "300", "montant": "1681485669", "destination": "tz1mneqxdtu8yt4ppf5trj7pls8vrzj19frq", "Metadata": { "Balance_Updates": [ { "type": "contrat", "contrat": "tz1eksvd2g7qxsjvim5zbyhxnun7sjle2phy", "Changement": "-1420" }, { "type": "congélateur", "Catégorie": "Frais", "Délégué": "Tz1yju7jmmsauig9qQloyv35v5PHgnwolwbt", "Niveau": 72, "Changement": "1420" } ], "Operation_Result": { "Statut": "retourné", "leserreurs": [ { "type": "temporaire", "ID": "proto.003-psddfki3.contract.cannot_pay_storage_fee" }, { "type": "permanent", "ID": "proto.003-psdddfki3.Context.storage_error", "Missing_key": [ "Contrats", "indice", "ED25519", "cc", "fb", "95", "87", "2a", "59f77f5729E9376BCB315E917E322E", "équilibre" ], "Fonction": "Obtenez" } ], "Balance_Updates": [ { "type": "contrat", "contrat": "tz1eksvd2g7qxsjvim5zbyhxnun7sjle2phy", "Changement": "-1681485669" }, { "type": "contrat", "contrat": "tz1mneqxdtu8yt4ppf5trj7pls8vrzj19frq", "Changement": "1681485669" }, { "type": "contrat", "contrat": "tz1eksvd2g7qxsjvim5zbyhxnun7sjle2phy", "Changement": "-257000" } ], "consommé_gas": "10260", "allouat_destination_contract": vrai } } } ], "Signature": "SIGS5LZSJH9WUK4VNIGTB2XN8JIFGBJVUJD3NRWXVSZHIGQHKWM7SCVOEVGWMGSRQPQ5UM3FRP6B1DBZYZFNHAYTISV1YEW5" }
Vous verrez que lepremier code d'erreurest
proto.003-psdddfki3.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
Un échec aléatoire Exempletransaction surtzscan.io ne fournitpas de code d'erreur spécifique .Il a étéinjectépar unnœudinconnu sans accès à sa sortieterminale.
Y a-t-il unmoyen de retracer comment l'erreur a émergéet que celane figuretout simplementpas dans TZScan?