Questions tagged [ecdsa]

In cryptography, the Elliptic Curve Digital Signature Algorithm offers a variant of the Digital Signature Algorithm which uses elliptic curve cryptography.

Filter by
Sorted by
Tagged with
0 votes
1 answer
6 views

Ethers.js recovers wrong address when signing its transactions with elliptic.js

Can someone show me how to correctly sign an ether's unsigned transaction hash using elliptic npm package. Below is my attempt (with some random private key) and transaction should ideally fail with &...
kuco 23's user avatar
  • 218
0 votes
0 answers
15 views

What happens to ECDSA public key if a constant is added to private key?

Consider I have a random number on curve Secp256k1 as the private key. I know if I calculate G multiplied by the private key in EC domain, I get the public key. I am wondering what happens to public ...
MJay's user avatar
  • 140
1 vote
1 answer
110 views

ECDSA (ecrecover) - How an attacker can construct a hash and signature that look valid

I found information, that it is possible to construct a hash and signature that look valid if the hash is not computed within the contract itself (we are talking about ECDSA/ecrecover here). So, the ...
Andrew Rukin's user avatar
1 vote
0 answers
28 views

What to do with lost coins in post-quantum world?

There is a certain (relatively high) probability that quantum computers capable of breaking the elliptic curve digital signature algorithm will be built within our lifetimes. These computers will be ...
Adam's user avatar
  • 11
1 vote
1 answer
21 views

Invalid signature in mined transaction (txid 0xde26b1deeb157c634ad06d08cc4e533d663496a25c75443e10c1fe0e760cd0a5)

I have a encounter a stranged transaction with an invalid signature. This transaction has been registered in the block chain. Here the transaction in etherscan : https://etherscan.io/tx/...
rllola's user avatar
  • 111
0 votes
1 answer
180 views

Getting error in using ECDSA

We have a function: function _validSignature(bytes memory signature, bytes32 msgHash) internal view returns (bool) { return msgHash.toEthSignedMessageHash().recover(signature) == ...
Hacek 's user avatar
  • 645
0 votes
0 answers
48 views

How to get extended public key from extended private key in bip39?

I have root key, and I want derivate child key from it. As I understood, I need parent key`s fingerprint, which is first 32 bits of ripemd160, of sha256 of public key. How can I get public key from ...
Mod diller's user avatar
2 votes
1 answer
33 views

Verifying OTP on-chain (keccak vs ecdsa)

I am looking to build a smart contract that enables a user to withdraw the contract funds via a one-time-password provided by the creator. My idea was to hash a password off-chain and store that ...
wenzel's user avatar
  • 21
1 vote
0 answers
31 views

how to get 'z' in ECDSA?

There are 2 nice articles about ECDSA of getting private key by the same 'r'. I dont know how to get the 'z'. Can u describe in detail and give an example?first article second article
LEVI_104's user avatar
1 vote
3 answers
654 views

how to get public key by the transaction hash?

For example, this is the transaction hash in goerli: 0x60605c7e3fddd2be1fa63f4fa8ef12bfc5e5c69062c6a4788d1277e007e7de02. We know that the public key can be derived by ECDSA. And we can get v,r,s from ...
LEVI_104's user avatar
4 votes
1 answer
403 views

The Solidity 'keccak256' and the Javascript ethers.js 'solidityKeccak256' produces different output

I'm trying to code a signature like opensea does for approving the Terms of Service. To do so I'm using the ECDSA library. This code in javascript using ethers: const message = ethers.utils....
Loo's user avatar
  • 41
0 votes
1 answer
18 views

decode proposer pub key format to get its address

I want to get the address of the following public key for a proposer provided by the beacon node: 0x8f97b04a965ffe46247ae428892e09499511e94f6dee5366e710eab937b42bfec3861466e6575a69b39c5d23e0282bcf ...
Plus Ultra's user avatar
1 vote
0 answers
77 views

Public Key from Transactional Hash of Type 2 EIP-1559

Is it possible to derive the public key based solely on information provided from the transaction hash? It must be able to work on newer transactions (type 0x02 transactions EIP-1559).I want to get ...
ECZY's user avatar
  • 11
0 votes
1 answer
45 views

Can ECDSA keys hashing to a contract address be used to sign a transaction?

Theoretical question: say I randomly managed to get a private key that provides a pubic key that hashes to and address that happens to be already in use for a contract instead of being an EOA. Does ...
Pablo González's user avatar
0 votes
0 answers
63 views

Generate EDSCA recoverable signature for use with OpenZeppelin EDSCA contract (Embedded/C/C++ Hardware wallet)

I'd like to sign a message on an Arduino-compatible microcontroller, and create a recoverable signature which can be used with EIP-191 and Ethereum's erecover / OpenZeppelin's ECDSA smart contracts to ...
xtools's user avatar
  • 101
1 vote
0 answers
65 views

Getting wrong signature while using etherjs in react native

I'm trying to get the signature using etherjs in a react native project which should be compatible with ECDSA.sol, When i try to get the signature with metamask it returns totally fine. but when i try ...
Hamza Yasin's user avatar
2 votes
1 answer
1k views

Verifying signed message in Solidity. ECDSA: invalid signature length

I am trying to verify a signed message using Solidity. For testing, the signed message is created using ethers.js. I am unable to verify the signed message because Solidity returns an "ECDSA: ...
dotchapter's user avatar
0 votes
1 answer
564 views

Signed message in ethers not recovered in solidity

In Ethers.js i am signing a message which I want to recover in Solidity using the ECDSA library from openzeppeling, I have one version which works but when I try the same method in which the ...
0xFlem's user avatar
  • 11
0 votes
1 answer
306 views

ETH ECDSA r reuse / nonce reuse solving

Reference article: https://bertcmiller.com/2021/12/28/glimpse_nonce_reuse.html Reference repo: https://github.com/Marsh61/ECDSA-Nonce-Reuse-Exploit-Example/blob/master/Attack-Main.py Objective: Solve ...
Brianleect's user avatar
2 votes
0 answers
207 views

How exactly is the signature encoded in a raw transaction?

I'm working on an Ethereum wallet as part of a school project. I am currently trying to sign this example transaction: ...
jepwei's user avatar
  • 21
1 vote
1 answer
131 views

How to use TypedDataHash to make a transaction?

I am trying to make a Meta Transaction without using the conventional TypedData object. Instead I have used ethers.utils._TypedDataEncoder.hash to create the hash. I signed the hash using the ...
Subhadeep Karmakar's user avatar
1 vote
2 answers
721 views

Can't recover address from signature (implementing EIP712 with eth_signTypedData_v4 and using OpenZeppelin)

can someone help me to find out what is wrong with my solidity code? (I'm trying to implement usage of the signatures and EIP712) (ECDSA and _hashTypedDataV4 are from OpenZeppelin: https://github.com/...
DarkCenobyte's user avatar
1 vote
1 answer
220 views

GS026: checkNsignatures succeeds when called directly, but fails through execTransaction

I have a gnosis safe which I am interacting with directly (no sdk here). It has a threshold of 2 and 3 signers. I am attempting to execute a txn by calling execTransaction() directly. It is failing ...
Eric Brown's user avatar
1 vote
0 answers
231 views

How to implement EIP155 signature on Polygon?

My understanding of EIP155 is that it encodes the chain ID into the signature's V value via the following: v = CHAIN_ID * 2 + 35 This works fine on chains such as Ethereum and its testnets where the ...
Ryan Collingham's user avatar
1 vote
0 answers
27 views

How to correctly get PubKey from PrivateKey in Python

I'm trying to master the basics of cryptography behind ethereum etc, mean very basics. trying to calculate the Pub Key via basic Pub = Priv * Generator Poing G in python, so basically from ecdsa....
user109280's user avatar
0 votes
1 answer
571 views

Can you verify an EIP712 signature using ethers/web3?

Is it possible to verify EIP712 signature using ethersjs or web3js? or the standard will always be to verified it on-chain? Thanks!
Lonewarp's user avatar
  • 141
1 vote
2 answers
964 views

Get signature bytes from V,R,S (ECDSA) using Solidity

How do I get the signature bytes from V, R, S? Here is what I have tried: // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.16; import {Test} from "forge-std/Test.sol"; import {...
Vasiliy Yorkin's user avatar
1 vote
1 answer
85 views

Cannot generate Ethereum address from private key

I am trying to use the Bitcoin ECDSA Library to generate an Ethereum address from a private key. I took the private key from my Metamask wallet then used the following code to generate the public key. ...
Melkor's user avatar
  • 121
1 vote
1 answer
263 views

What's the probability of getting the same signature using ECDSA?

If I hash the message "HELLO" - keccak256("Hello") then run it to an ECDSA, what's the probability that I will get the same r, s and v value everytime? Do I need to add some unique ...
Lonewarp's user avatar
  • 141
1 vote
1 answer
596 views

Extracing v, r, s from signature and adding it to a transaction

I am trying to decode the v, r, s from a signature and add that to a transaction and broadcast at some point. When I convert the signature into v,r,s and build the raw tx the from: parameter does not ...
MisterBulle's user avatar
2 votes
1 answer
591 views

How to encode message using public key ETH address?

I want to send an encrypted message to a specific ETH address via the blockchain. Hello, my secret. Can I encrypt this message in the browser with the public key of the recipient's address? I ...
YBul's user avatar
  • 23
0 votes
2 answers
230 views

Is this implementation of Openzeppelin's ECDSA module secure?

I am quite new to ECDSA signatures and the exact way they work. In an attempt to understand it better I have tried experimenting with it. I am trying to create an ERC20 mint function using ...
user104640's user avatar
0 votes
1 answer
333 views

Failing to verify signature

I'm trying to verify a signature using OpenZeppelin's SignatureChecker library, but always returns false. This is the verify function from the lib: function isValidSignatureNow( address ...
dNyrM's user avatar
  • 675
2 votes
1 answer
1k views

Get Signature for Tuple input for EIP712 [duplicate]

I'm using web3.js to try and sign a tuple and get the signature. I'm utilizing draft-EIP712Upgradeable.sol in order to hash and recover the input in solidity. I originally looked at the following link ...
Bryant Backus's user avatar
2 votes
1 answer
1k views

How to Export public key from Metamask

【Front】 const keyB64 = await window.ethereum.request({ method: 'eth_getEncryptionPublicKey', params: [accounts], }); const publicKey = Buffer.from(keyB64, 'base64') ...
Rock Wu's user avatar
  • 21
4 votes
2 answers
4k views

solidity cannot verify ethers.js signed data (signTypedData)

i am using _signTypedData in etherjs to sign and encode a signature out of the data as follows const domain = { name: "og-nft", version: "1", }; const types = { ...
Adarsh Raj's user avatar
1 vote
1 answer
684 views

Simpler verification of externally-created ECDSA signatures in Solidity

I just want to use ecrecover to verify with a public key that the corresponding private key signed a message passed through a variable in solidity. What's the simple way to do this? I have inserted ???...
helpme's user avatar
  • 67
1 vote
1 answer
3k views

How to recover an ethers.js signed message in go-ethereum?

I generated a signed message using ethers.js. Here's how I did that: const provider = new ethers.providers.Web3Provider(web3Provider.provider); const signer = provider.getSigner(); await signer....
hexcowboy's user avatar
0 votes
0 answers
24 views

Go Ethereum "invalid signature recovery id" when recovery byte is >= 4 [duplicate]

I have a signed message that was generated by Metamask. It looks like this: ...
hexcowboy's user avatar
1 vote
1 answer
3k views

How to use function Recover from ECDSA library?

I have an error when trying to use Recover function of ECDSA Library. What is the problem? import "hardhat/console.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; ...
ra1n89's user avatar
  • 129
0 votes
1 answer
131 views

Verifying the signature of a transaction seems circular

I'm reading Mastering Ethereum. Around page 116 it says; "to verify the signature one must have the signature (r and s), the serialized transaction, and the public key that corresponds to the ...
Luke Puplett's user avatar
0 votes
1 answer
615 views

Solidity: recover address from hashed message

I recently was going through some sol contracts, because I am planning to create my own one. So I stumbled upon this function call: function tryRecover(bytes32 hash, bytes memory signature) internal ...
Robert Bahn's user avatar
0 votes
2 answers
2k views

Using ECDSA to verify a signature inside smart contract

Following the technique to verify ethereum signature with ECDSA. Sign it like you mean it: creating and verifying Ethereum signatures Signing and Verifying Messages in Ethereum A Closer Look At ...
rodrigosimoesrosa's user avatar
2 votes
1 answer
563 views

Signing a tuple (struct) for ECDSA.recover

I'm using web3js, and I'm trying to sign a tuple correctly. Below you can see the solidity code for verification. I'm using draft-EIP712Upgradeable.sol struct NFTVoucher { uint256 tokenId; ...
Rafayel Khachatryan's user avatar
0 votes
1 answer
612 views

What is the purpose of OpenZeppelin ECDSA.sol contract?

what is the purpose of the ECDSA contract ( https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/cryptography/ECDSA.sol ) ? Contract looks like a wrapper around builtin ...
alex's user avatar
  • 101
8 votes
1 answer
2k views

Getting wrong address from ECDSA.recover()

I'm signing typed data using _signTypedData() method of ethers. But when I retrieve the signer's address in Solidity Smart Contract using ECDSA.recover(), it returns the wrong address. Let me know if ...
Yash Gajjar's user avatar
1 vote
2 answers
232 views

web3.eth.accounts.sign 'K' generation

I have been searching for the actual implementation of the web3.eth.accounts.sign to find out how the random variable k is generated. But I could not find the implementation of the method web3.eth....
Ahmed Maher's user avatar
1 vote
0 answers
62 views

Could Insufficient Funds error mean the signature is incorrect? - using golang and raw transactions

I want to sign a transaction "offline" without using crypto.sign. The code looks like the following: unsignedTx := types.NewTransaction(nonce, to, amount, gasLimit, gasPrice, nil) networkID ...
Jorge Alvarado's user avatar
1 vote
0 answers
306 views

Is the ECDSA signature hash, its derived v value and the chainID still a thing?

I was browsing some code at the go-ethereum and I noticed this method to validate the signature: https://github.com/ethereum/go-ethereum/blob/56dec25ae26bf749b93c3ea69538fabea60c5768/crypto/crypto.go#...
Jorge Alvarado's user avatar
3 votes
1 answer
88 views

Do miners undergo a sunken cost of attempting to verify an invalid transaction signature?

In the case of an 'invalid' transaction whereby the state transition of the execution is deemed to conflict in some way and reverts, the transaction itself is actually valid; gas is consumed, tx ...
Shiri's user avatar
  • 736