Assinatura inválida para a transação de Tezos
2 respostas
- votos
-
- 2020-04-24
Existem doispontos de CE válidos que correspondem àmesma assinatura,mas algunsblockchains restringem o uso a um desses doispontos da CEparaevitarmaleability (=éfácil converter a assinaturapara o outro valor de assinaturae,assim,criar uma segundatransação válida queteria um ID detransação diferente semter acesso à chaveprivada).
editar: Atransação válida correspondente é:
008f1d96e2783258ff663f03dacfe946c026a5d194c73d1987b3da73fadea7d46b01549a0cde570a49b9200680341a6c78e87635480f940adc85a001f44eac02010238244743822921db1661fc7306c3044faac1e373906fdb5582d9454352b3b31c6c01549a0cde570a49b9200680341a6c78e87635480ff00bdd85a0018452ac02e0a712000153957451d3cc83a71e26b65ea2391a1b16713d2d0049ff4a47599e0c65447182eca4c900893a74de3ca24c26708fc9d4bf79891ca384b0d5f98618bc3acec4f0c6bffd002de6fd839a418f47e83404aed285fc0235
Issofoi criado sem re-assinare sem acesso à chaveprivada.There are two valid EC points that correspond to the same signature, but some blockchains restrict the usage to one of those two EC points to avoid malleability (= it is easy to convert the signature to the other signature value, and thus create a second valid transaction which would have a different transaction id without haveing access to the private key).
Edit: The corresponding valid transaction is:
008f1d96e2783258ff663f03dacfe946c026a5d194c73d1987b3da73fadea7d46b01549a0cde570a49b9200680341a6c78e87635480f940adc85a001f44eac02010238244743822921db1661fc7306c3044faac1e373906fdb5582d9454352b3b31c6c01549a0cde570a49b9200680341a6c78e87635480ff00bdd85a0018452ac02e0a712000153957451d3cc83a71e26b65ea2391a1b16713d2d0049ff4a47599e0c65447182eca4c900893a74de3ca24c26708fc9d4bf79891ca384b0d5f98618bc3acec4f0c6bffd002de6fd839a418f47e83404aed285fc0235
This was created without re-signing and without access to the private key. -
- 2020-04-19
Certifique-se de revelar a chavepública apenas uma veze certifique-se de que você contador adequadamenteincentivo.
Além disso,dê uma olhadaem netezos ,C # Tezos SDK. Aquiestá umexemplo de comoforjar,assinare enviar umatransação:
var key = Key.FromBase58("edskS9DjUKo8ogBBU8LeU..."); var rpc = new TezosRpc("https://rpc.tzkt.io/carthagenet/"); var head = await rpc.Blocks.Head.Hash.GetAsync<string>(); var counter = await rpc.Blocks.Head.Context.Contracts[key.PubKey.Address].Counter.GetAsync<int>(); var forge = new LocalForge(); var bytes = await forge.ForgeOperationAsync(head, new TransactionContent { Source = key.PubKey.Address, Counter = ++counter, Fee = 10_000, GasLimit = 20_000, StorageLimit = 20_000, Amount = 1_000_000, Destination = "tz1KhnTgw...", }); var sig = key.Sign(new byte[] { 3 }.Concat(bytes).ToArray()); var op = bytes.Concat(sig.ToBytes()).ToArray(); var tx = await rpc.Inject.Operation.PostAsync(Hex.Convert(op));
Senãofuncionarmesmo comnetezos,verifique se o seunó RPC é sincronizadoe atualizado.
Make sure you revealed public key just once and make sure you properly incement counter.
Also, take a look at Netezos, C# Tezos SDK. Here is an example of how to forge, sign and send a transaction:
var key = Key.FromBase58("edskS9DjUKo8ogBBU8LeU..."); var rpc = new TezosRpc("https://rpc.tzkt.io/carthagenet/"); var head = await rpc.Blocks.Head.Hash.GetAsync<string>(); var counter = await rpc.Blocks.Head.Context.Contracts[key.PubKey.Address].Counter.GetAsync<int>(); var forge = new LocalForge(); var bytes = await forge.ForgeOperationAsync(head, new TransactionContent { Source = key.PubKey.Address, Counter = ++counter, Fee = 10_000, GasLimit = 20_000, StorageLimit = 20_000, Amount = 1_000_000, Destination = "tz1KhnTgw...", }); var sig = key.Sign(new byte[] { 3 }.Concat(bytes).ToArray()); var op = bytes.Concat(sig.ToBytes()).ToArray(); var tx = await rpc.Inject.Operation.PostAsync(Hex.Convert(op));
If it doesn't work even with Netezos, check if your RPC node is synced and up to date.
-
Combaseno JSONnapergunta originale no status doendereço do remetente [link] (https://tezos.id/accounts/tz2g2zy3sgycuh1eqqrx9q62ccpskgclpppdt),Contadore revelar OK?Based on the JSON in the original question and the status of the sender address [link](https://tezos.id/accounts/tz2G2Zy3sgYCuh1EQqrx9Q62CcpSkgcLPPDt), does counter & reveal look ok?
- 0
- 2020-04-20
- Felix Laufenberg
-
Eu sugiro que você use o Tzkt Explorer,porquemostrainformaçõesmais úteis,incluindo operaçõesfalhadasem mempool https://tzkt.io/tz2g2zzy3sgycuh1eqqrx9q62ccpskgclppdt/operations.Então,o queeu vejo é doisfalhadosem operações demempool com contadores '..72` ..73' de `12:01:49 UTC`Em suapergunta,vejo JSON com osmesmos contadores,mas com o ramo https://tzkt.io/bkixcfn1ztxnnnbtwsrarwzvfc6om7Radwq5mtqgx6radwq5mtqgx6ry4p2Uhe - de `12:55:12 UTC`.Então,eu suponho que vocêtentouenviar as operações com osbalcões` ..72` ..73 ',quejátinhaestadoem Mempool.I suggest you use TzKT explorer, because it shows more useful info, including operations failed in mempool https://tzkt.io/tz2G2Zy3sgYCuh1EQqrx9Q62CcpSkgcLPPDt/operations. So, what I see is two failed in mempool operations with counters `..72`, `..73` from `12:01:49 UTC`. In your question I see JSON with the same counters BUT with the branch https://tzkt.io/BKiXcfN1ZTXnNNbTWSRArSWzVFc6om7radWq5mTqGX6rY4P2Uhe - from `12:55:12 UTC`. So, I assume that you tried to send the operations with the counters `..72`, `..73` which had already been in mempool.
- 1
- 2020-04-20
- Groxan
-
De ummodogeral,seu JSONparecebem,mas ofato de que houve "clones"fracassadosno Mempoolpode causar oerro que você descreveu.Generally speaking, your JSON looks fine, but the fact that there were failed "clones" in the mempool may cause the error you described.
- 0
- 2020-04-20
- Groxan
-
Obrigadopela resposta rápida.Atransaçãono Mempool é atransaçãobem-sucedida queeuestava se referindo,noentanto,agora éinválidaporque o ramoestá desatualizado,seissoforparabloquearfuturastransações,ele concluiriabloquear a contae deve ser renderizada umerro críticononó Tezos,entãonão acho que seja a causa doerro.Thanks for the quick response. The transaction in the mempool is the successfull transaction that I was referring to, however it is now invalid because the branch is outdated, if that were to block future transactions it would complete block the account and should be rendered a critical bug in the Tezos node, so I don't think that it should be the cause of the error.
- 0
- 2020-04-20
- Felix Laufenberg
-
Infelizmentenãopodereitestar a assinatura comnetezos desde que recuperar a assinatura de um HSMe não consigo obter acesso à chaveprivada.Unfortunately I won't be able to test signing with Netezos since I retrieve the signature from an HSM and can not get access to the private key.
- 0
- 2020-04-21
- Felix Laufenberg
Euestouescrevendo software de carteirapersonalizado completopara Tezosem C #e recebi a seguintetransaçãobruta:
unsignedhex: 008f1d96e2783258ff663f03dacfe946c026a5d194c73d1987b3da73fadea7d46b01549a0cde570a49b9200680341a6c78e87635480f940adc85a001f44eac02010238244743822921db1661fc7306c3044faac1e373906fdb5582d9454352b3b31c6c01549a0cde570a49b9200680341a6c78e87635480ff00bdd85a0018452ac02e0a712000153957451d3cc83a71e26b65ea2391a1b16713d2d00
hashpreimage: 03008f1d96e2783258ff663f03dacfe946c026a5d194c73d1987b3da73fadea7d46b01549a0cde570a49b9200680341a6c78e87635480f940adc85a001f44eac02010238244743822921db1661fc7306c3044faac1e373906fdb5582d9454352b3b31c6c01549a0cde570a49b9200680341a6c78e87635480ff00bdd85a0018452ac02e0a712000153957451d3cc83a71e26b65ea2391a1b16713d2d00
hash: 8541434DE6C77AAA3E6A4D4E341717A5C96B14E95C96B14E90183fd338579
assinado: 008f1d96e2783258ff663f03dacfe946c026a5d194c73d1987b3da73fadea7d46b01549a0cde570a49b9200680341a6c78e87635480f940adc85a001f44eac02010238244743822921db1661fc7306c3044faac1e373906fdb5582d9454352b3b31c6c01549a0cde570a49b9200680341a6c78e87635480ff00bdd85a0018452ac02e0a712000153957451d3cc83a71e26b65ea2391a1b16713d2d0049ff4a47599e0c65447182eca4c900893a74de3ca24c26708fc9d4bf79891ca384b0d5f98618bc3acec4f0c6bffd002de6fd839a418f47e83404aed285fc0235
Quandotentoinjetar atransação assinada crua ('assinada') com onó RPCeu recebo a resposta:
[
{
. "tipo": "temporário",
"ID": "falha",
"Msg": "Erro ao aplicar a operação OozxcektuwW8PhrskVuwphih1knz12EOHX1MP8AKINJU9FPY: \ Nrefused (Erro: \n A assinatura de operação éinválida \n)"
}
. ]
Euposso verificar a assinatura (secp256k1) datransação contraferramentas deterceirose verifica (que épuramente que o valor 'hash' é assinado corretamente). Eu usei oendpoint donó RPC 'Forge'para verificar a serialização correta com o seguinte JSON:
{"Branch": "Bkixcfn1ztxnnbbtwsrarwzvfc6om7Radwq5mtqgx6ry4p2uhe",
"Conteúdo": [{
"gentil": "revelar",
"Taxa": "1300",
"Gas_limit": "10100",
"Storage_limit": "300",
"Public_key": "sppk7zjmvkguwnjyzkoqeyanhorr1njxmqhljexp3uq98xkchfius",
"Contador": "2622172",
"Fonte": "tz2g2zy3sgycuh1eqqrx9q62ccpskgclpppdt"},{
"tipo": "transação",
"Taxa": "1520",
"Gas_limit": "10500",
"Storage_limit": "300",
"Quantidade": "300000",
"Contador": "2622173",
"Destino": "tz2fwbnxhuxvpaucr1af3ux846jelxrdyxd",
"Fonte": "tz2g2zy3sgycuh1eqqrx9q62ccpskgclpppdt"}] }
e tambémfoi capaz de verificarinsignedraw=> hash com códigopython:
Quaseparece umamensagem deerro ruim. Alguémpodeme ajudar a descobrir qual é oproblema com aminhatransação?
p.s.em uma segunda corrida com omesmo software queeuera capaz degerar umatransaçãototalmente válido: 007fc1ecd6a56046aaaeab78bbfa1c889eb8f502b66c720bf1ac3b40ee9ecf6d6b01549a0cde570a49b9200680341a6c78e87635480f940adc85a001f44eac02010238244743822921db1661fc7306c3044faac1e373906fdb5582d9454352b3b31c6c01549a0cde570a49b9200680341a6c78e87635480ff00bdd85a0018452ac02c09a0c000153957451d3cc83a71e26b65ea2391a1b16713d2d00231176ec0cf55e3f04d5de633c33b38a6370ad2c37fd31c4c45e12ec9f1466753c8137f5dee8105bd5cc3d4ce780f51ec01d5adb21893e75eef4b960189818a3
Umaterceira corridafoinovamente consideradainválida.