Firma no válida para la transacción de Tezos
2 respuestas
- votos
-
- 2020-04-24
Hay dospuntos EC válidos que corresponden a lamismafirma,pero algunas cadenas debloques restringenel uso a uno deesos dospuntos ECparaevitar lamaleabilidad (=esfácil convertir lafirma al otro valor defirma y así crear una segundatransacción válida quetendría un ID detransacción diferente sintener acceso a la claveprivada).
Editar: Latransacción válida correspondientees:
008f1d96e2783258ff663f03dacfe946c026a5d194c73d1987b3da73fadea7d46b01549a0cde570a49b9200680341a6c78e87635480f940adc85a001f44eac02010238244743822921db1661fc7306c3044faac1e373906fdb5582d9454352b3b31c6c01549a0cde570a49b9200680341a6c78e87635480ff00bdd85a0018452ac02e0a712000153957451d3cc83a71e26b65ea2391a1b16713d2d0049ff4a47599e0c65447182eca4c900893a74de3ca24c26708fc9d4bf79891ca384b0d5f98618bc3acec4f0c6bffd002de6fd839a418f47e83404aed285fc0235
Esto se creó sin volver afirmar y sin acceso a la claveprivada.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
Asegúrate de haber revelado la clavepública solo una vez y asegúrate de cementar correctamenteel contador.
Además,eche un vistazo a Netezos ,C # Tezos SDK. A continuación,semuestra unejemplo de cómofalsificar,firmar yenviar unatransacción:
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));
Sinofuncionaincluso con Netezos,verifique si sunodo RPCestá sincronizado y actualizado.
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.
-
Segúnel JSON de lapregunta original yelestado de la dirección del remitente [enlace] (https://tezos.id/accounts/tz2G2Zy3sgYCuh1EQqrx9Q62CcpSkgcLPPDt),¿el contador y la revelación se venbien?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
-
Le sugiero que useelexplorador TzKT,porquemuestramásinformación útil,incluidas las operacionesfallidasen mempool https://tzkt.io/tz2G2Zy3sgYCuh1EQqrx9Q62CcpSkgcLPPDt/operations.Entonces,lo que veo son dos operacionesfallidasen mempool con contadores `..72`,` ..73` de `12:01:49 UTC`.En supregunta,veo JSON con losmismos contadores PERO con la rama https://tzkt.io/BKiXcfN1ZTXnNNbTWSRArSWzVFc6om7radWq5mTqGX6rY4P2Uhe - desde `12:55:12 UTC`.Entonces,asumo queintentasteenviar las operaciones con los contadores `..72`,` ..73` que yaestabanen 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
-
Entérminosgenerales,su JSON se vebien,peroel hecho de que haya "clones"fallidosen elmempoolpuede causarelerror que describió.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
-
Graciaspor la rápida respuesta.Latransacciónen elmempooles latransacciónexitosa a la queme refería,sinembargo,ahoranoes válidaporque la sucursalestá desactualizada,siesobloquearatransaccionesfuturas,bloquearía completamente la cuenta y deberíagenerar unerror críticoen elnodo de Tezos.,por lo queno creo que deba ser la causa delerror.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
-
Desafortunadamente,nopodréprobar lafirma con Netezos ya que recupero lafirma de un HSM ynopuedo acceder a la claveprivada.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
Estoyescribiendo un software debilleterapersonalizado completopara Tezosen C # y obtuve la siguientetransacción sinprocesar:
UnsignedHex: 008f1d96e2783258ff663f03dacfe946c026a5d194c73d1987b3da73fadea7d46b01549a0cde570a49b9200680341a6c78e87635480f940adc85a001f44eac02010238244743822921db1661fc7306c3044faac1e373906fdb5582d9454352b3b31c6c01549a0cde570a49b9200680341a6c78e87635480ff00bdd85a0018452ac02e0a712000153957451d3cc83a71e26b65ea2391a1b16713d2d00
HashPreimage: 03008f1d96e2783258ff663f03dacfe946c026a5d194c73d1987b3da73fadea7d46b01549a0cde570a49b9200680341a6c78e87635480f940adc85a001f44eac02010238244743822921db1661fc7306c3044faac1e373906fdb5582d9454352b3b31c6c01549a0cde570a49b9200680341a6c78e87635480ff00bdd85a0018452ac02e0a712000153957451d3cc83a71e26b65ea2391a1b16713d2d00
Hash: 8541434de6c77aaa3e6a4d4e341717a5c96b14e990183fd33e8157ef53f38579
Firmado: 008f1d96e2783258ff663f03dacfe946c026a5d194c73d1987b3da73fadea7d46b01549a0cde570a49b9200680341a6c78e87635480f940adc85a001f44eac02010238244743822921db1661fc7306c3044faac1e373906fdb5582d9454352b3b31c6c01549a0cde570a49b9200680341a6c78e87635480ff00bdd85a0018452ac02e0a712000153957451d3cc83a71e26b65ea2391a1b16713d2d0049ff4a47599e0c65447182eca4c900893a74de3ca24c26708fc9d4bf79891ca384b0d5f98618bc3acec4f0c6bffd002de6fd839a418f47e83404aed285fc0235
Cuandointentoinyectar latransacción sinprocesarfirmada ('Firmado') conelnodo rpc,obtengo la respuesta:
[
{
"kind": "temporal",
"id": "error",
"msg": "Error al aplicar la operación oozXCEKTUFcw8PHcrskvuWphiH1kNz12eohX1mp8AKinJU9fPYS: \nrefused (Error: \n Lafirma de la operaciónnoes válida \n)"
}
]
Puedo verificar lafirma (secp256k1) de latransacción con herramientas deterceros y verifica (es decir,queel valor 'Hash'estéfirmado correctamente). Utilicéelpuntofinal delnodo rpc 'Forge'para verificar la serialización correcta conel siguiente JSON:
{"rama": "BKiXcfN1ZTXnNNbTWSRArSWzVFc6om7radWq5mTqGX6rY4P2Uhe",
"contenido": [{
"kind": "revelar",
"fee": "1300",
"gas_limit": "10100",
"storage_limit": "300",
"public_key": "sppk7ZjMvKgUwnjYZKoQEYaNhorr1NJxmqgHLjExsP3uq98XKChFius",
"contador": "2622172",
"fuente": "tz2G2Zy3sgYCuh1EQqrx9Q62CcpSkgcLPPDt"},{
"kind": "transacción",
"fee": "1520",
"gas_limit": "10500",
"storage_limit": "300",
"monto": "300000",
"contador": "2622173",
"destino": "tz2FwBnXhuXvPAUcr1aF3uX84Z6JELxrdYxD",
"fuente": "tz2G2Zy3sgYCuh1EQqrx9Q62CcpSkgcLPPDt"}]
}
Ytambiénpudo verificar UnsignedRaw=> Hash con código Python:
Casiparece unmalmensaje deerror. ¿Alguienpuede ayudarme a averiguar cuáleselproblema conmi transacción?
P.s.en una segundapasada conelmismo software quefue capaz degenerar unatransaccióntotalmente válida: 007fc1ecd6a56046aaaeab78bbfa1c889eb8f502b66c720bf1ac3b40ee9ecf6d6b01549a0cde570a49b9200680341a6c78e87635480f940adc85a001f44eac02010238244743822921db1661fc7306c3044faac1e373906fdb5582d9454352b3b31c6c01549a0cde570a49b9200680341a6c78e87635480ff00bdd85a0018452ac02c09a0c000153957451d3cc83a71e26b65ea2391a1b16713d2d00231176ec0cf55e3f04d5de633c33b38a6370ad2c37fd31c4c45e12ec9f1466753c8137f5dee8105bd5cc3d4ce780f51ec01d5adb21893e75eef4b960189818a3
Unaterceraejecución se considerónuevamenteno válida.