Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.

Questions tagged [ecrecover]

Questions about EcRecover, a function of the programming language Solidity to verify a signature on the blockchain

Filter by
Sorted by
Tagged with
0
votes
2answers
54 views

Sign message with web3 and verify with openzeppelin-solidity ECDSA.sol

I'm trying to get a little example working with ECDSA.sol here: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/cryptography/ECDSA.sol This contract: Generate a random(...
0
votes
1answer
17 views

How to have ecrecover return nothing ? I means which value for malformed input?

I have a contract where the hash value is also the key to unlock the money. As the full ecrecover parameters are fetched from transaction parameters, and it was compiled in 2016, it is vulnerable to ...
0
votes
1answer
37 views

How to call ecrecover() in pure assembly?

If I do remember correctly, it’s a contract built‑in in the Ethereum Virtual machine, isn’t it? if yes, what’s the address to call for it?
0
votes
0answers
13 views

Ecrecover security level for fixed message signature verification

usually ownership of a private key is checked by providing some random message to user and ask him to sign that random message. I want to know if security goes below acceptable level If instead of ...
1
vote
2answers
71 views

ecrecover() always returns 0x0000000000000000000000000000000000000000

I'm aware of these posts How do you sign an verify a message in javascript proving you own an Ethereum address? How does one properly use ecrecover to verify Ethereum signatures? I'd like to sign a ...
0
votes
1answer
57 views

ecrecover not giving back the adress of the sender

I am trying to understand how eliptic curve work and when i try to get the sender of this transaction: https://etherscan.io/tx/0x14a298c1eea89f42285948b7d51eeac2876ca7406c9784b9b90dd3591d156d64 ( ...
0
votes
0answers
10 views

ecrecover function in solidity [duplicate]

how to extract sub-bytes r,s from bytes(signature). Is there any function to split the bytes into sub-bytes of desirable length starting from some fixed index?
1
vote
1answer
170 views

How to pass bytes32 to Web3.methods.function.call

I have a contract that is doing an ecrecover: function recover(bytes32 h, uint8 v, bytes32 r, bytes32 s) public returns (address) { return ecrecover(h, v, r, s); } It works ...
2
votes
1answer
47 views

How to get 0x0 from ecrecover?

I have a fair understanding of how ecrecover works, but I don't know how to enforce a parameter set that will deterministically return the 0x0 address. I need this in my contract tests. Is this even ...
1
vote
1answer
96 views

web3js recover returns different address than what signed message

Web3js as of version 1.0.0 beta supports an interface for verifying signed messages: https://github.com/ethereum/web3.js/issues/404 This is documented here: https://web3js.readthedocs.io/en/1.0/web3-...
1
vote
0answers
62 views

Ecrecover wrong address is returned

I'm trying to validate signed data with ecrecover. The message is signed like this on the FE: return this.web3.eth.personal.sign( `${nonce}`, publicAddress ).then( ( signature ) => { ...
1
vote
2answers
87 views

Why does ecrecover() take signature parameters (v,r,s) instead of the full signature?

Is there any reason ecrecover() takes the (v, r, s) signature parameters instead of the full signature, given that these can be easily computed inside the function itself? I am asking because ...
2
votes
0answers
26 views

How to change prefix of signature in Javascript?

Is it possible to change the signature prefix, which by default: "\x19Ethereum Signed Message:\n32" Can I change it to another prefix? I need to get a signature in solidity in this way: bytes32 ...
2
votes
1answer
292 views

HD wallet public to public key derivation and non-hardened keys

This question is about hierarchical deterministic wallets and the bip32 standard which, as I understand it, allows you to deterministically derive child private/public key pairs from a master seed ...
1
vote
1answer
55 views

web3.eth.sign sometimes gives V parameter of 54 or 55, ecrecover then fails. What's going on?

I've been using ecrecover and web3.eth.sign to authorize transactions, but when I run web3.eth.sign a second time on my server, the V part of the signature is wrong(or, at least, ecrecover thinks it's ...
0
votes
1answer
122 views

Geth ecrecover function returning '0x'

can someone help me with this ecrecover issue? The code below is a truffle test. The recoverSigner function just calls ecrecover, but the return is always '0x'. Recovering with ethereumjs-util works ...
1
vote
1answer
189 views

web3py: get public key from transaction

I'm trying to retrieve the public key of an address from a transaction. I'm getting the transaction via tx = web3.eth.getTransaction('xxx') According to the docs the public key should be retrievable ...
3
votes
1answer
420 views

Does Ethereum support pairing operations?

I need to build an application that uses bilinear pairing operations for generating signatures. If I send a message with its signature to Ethereum, can Ethereum verify this message? Does the EVM ...
0
votes
2answers
321 views

Trouble with ecrecover()

I have a test routine in Truffle which hashes data, signs it and passes the signature data to a contract to verify. The first test hashes a single string and its signature is successfully verified by ...
1
vote
1answer
206 views

Verifying Signed Data

I am busy trying to get my head around recovery of an address using ecrecover(). The I'm having trouble recovering the correct address when providing signed data to the contract. The contract that I'...
4
votes
1answer
595 views

How does ecrecover actually work?

I have a basic understanding of elliptic curves, so I'm more interested to find out how does ecrecover specifically verify signatures. It has rather weird requirements, like this prefix thing (excerpt ...
0
votes
1answer
382 views

How to use web3 function (ecRecover) that shouldn't require a provider?

I want to use web3's ecRecover functionality and nothing else. Unless I misunderstand its requirements - a signature, the signed data, some cryptomagic and poof you have recovered the signer - why do ...
4
votes
1answer
402 views

Verification of externally-created ECDSA signatures in Solidity

I have ECDSA signatures created using Golang without using web3 or anything related to Ethereum, and I want to verify these in Solidity. Step 1: Signing the message in Golang My Go code to create ...
2
votes
1answer
152 views

Ecrecover function doesn't trigger when called in truffle test

I am trying to run some tests for my ecrecover function. I saw a bunch of tutorials and I always have the same problem, my contract always reverts before anything is being logged. Contract function ...
5
votes
1answer
521 views

Extracting Public key from signed Ethereum message or transaction in JavaScript

I'm trying to find out how to derive a public key (not the address) of an Ethereum account by using ethereumjs-util's ecrecover method. Basically I get a transaction by hash using Web3, convert r, s ...
0
votes
1answer
388 views

Web3j Signature and Solidity Ecrecover

I'm trying to understand how to sign a message in Java and recover the public key in a Solidity smart contract however my public keys don't seem to match. Here's my Java code to generate the ...
3
votes
1answer
456 views

Truffle web3.eth.sign produces wrong signature

Somehow truffle produces an invalid signature. To clarify this I imported the private key of the first Ganache account to metamask and compared the results. The following code used in a chrome ...
0
votes
1answer
44 views

Is there any way to ecrecover something twice? (I.e. something signed by two different people)

I have a signature. That signature was then signed by someone else. If I pass this doubly-signed message as an argument to my function, is there a way to recover both signers?
0
votes
1answer
201 views

How to compute ecrecover parameters in solidity?

There are many answer which explain how to compute _r, _s, _v with an other language. But how to compute parameters in solidity itself ? Is there a built-in function like ecrecover ?
0
votes
1answer
171 views

OpenZeppelin ECRecovery does not work

I am trying to use the OpenZeppelin ECRecovery library for a project I am working on. Unfortunately I don't fully understand how it works and there's no documentation for it. Let's say I want to ...
1
vote
1answer
1k views

Validating Go Ethereum key signature with ecrecover

Resolved The basic process flow of what I'm writing goes as follows. Sign a message with a private key and create an Ethereum address from the private key (AKA the vettingAddress) Pass the signature ...
1
vote
1answer
283 views

verify ecdsa signature in solidity

I want to create a smart contract that contains the public key of a party (the key is generated outside the blockchain) and contains a function to verify signed data. How can we implement this ...
1
vote
0answers
271 views

Problem with web3.eth.personal.ecRecover

I'm using web3 v1.0 beta33 ethereum packages to do some signing and address recovery in a javascript/Angular5 app. I picked this version because I didn't see this function in 0.2x web3 versions' ...
2
votes
2answers
150 views

Dynamic number of inputs to a smart contract

Assume we a smart contract that accepts a number of cryptographically signed attributes. The smart contract will validate each signature and check that all the addresses of those signed signatures ...
0
votes
1answer
911 views

To pay for the gas for ERC20 token holders' transactions

I would like to make a ERC20 contract in which the contract owner will pay the gas for clients transactions (for example, to allow to transfer tokens between clients for free). There is an excellent ...
2
votes
2answers
415 views

Get public key from signature in a smart contract (note, public key, not address)

Are there any libraries to get a public key from a signature in a smart contract? The ecrecover method returns an address, not a public key, and to do computations that need to derive a public key ...
1
vote
0answers
1k views

Why the value of v is always either 27 (11011) or 28 (11100)?

Why the value of v is always either 27 (11011) or 28 (11100), and, how is it known wether it will be 27 or 28?
1
vote
0answers
143 views

Convert an hexadecimal string to bytes in pure Solidity

I am using Oraclize to recover a signature from a website. When I have it, I have to check if the address who signed it is correct. To do that, I would use ECRecovery from Zeppelin. The signature ...
2
votes
1answer
225 views

What is the best type to store a signature on chain?

I'm signing a hash and getting a string with 130 bytes. What is the best way to store this signature later in my smart contract? Should I just go ahead and split it into r,s, and v and store it in ...
4
votes
1answer
327 views

Verifying Bicoin signed message in Ethereum smart contract

I'd like to explore the option to verify the messages that have been signed in Bitcoin wallets in Ethereum smart contracts. Ethereum smart contract is given a list of Bitcoin addresses Ethereum smart ...
2
votes
1answer
307 views

How are state channels being implemented (MetaMask?)

I've been trying to get MetaMask to produce a signature for a sha3 hash that I can verify in solidity. I've tried eth_sign, personal_sign, eth_signTypedData, and I've had 0 success. My test suite ...
4
votes
1answer
385 views

Can a message hash be recovered from a signature?

A message can be signed and its signing public key recovered given the signature and message hash... signature = web3.personal.sign(<account>,<message hash>) pubKey = web3.personal....
5
votes
1answer
415 views

Signatures differ in web3js and web3j

I'm using web3J version 3.0.0-alpha4 and hit following problem. When I sign the same raw message (it's simply string like "TEST" for now) I get different signatures using web3js i web3j. The signature ...
0
votes
2answers
448 views

Ecrecover: does passing the hash and checking it adds any security?

I have seen quite a few examples where both the data and the hash of the data is passed. The signature is verified using ecrecover which is fine. The passed hash is also verified against the ...
3
votes
1answer
531 views

I need help with signatures

So, for my studies, I am supposed to interact with a contract function that has the following built in condition: if (ecrecover(_h, _v, _r, _s) == msg.sender && _h == sha3(this)) I am ...
13
votes
1answer
4k views

Does ecRecover in solidity expects the “\x19Ethereum Signed Message:\n”-prefix

I struggle heavy to actually recover the ethereum address from a hash and the {r, s, v} from a signature with the ecRecover-method in solidity. What i want is to sign another ethereum-address. So i ...
5
votes
1answer
2k views

Solidity ecrecover and web3j Sign.signMessage() are not compatible, is it?

Using Web3j to sign and verify a message is fine but when I use the signature generated by Web3j to verify using ecrecover in solidity it doesnot seem to work correctly. The signer address is ...
0
votes
1answer
1k views

using solidity to verify ECDSA signature from external key pair

say a user has an external public key (unrelated to ethereum address). they use the private key associated with this public key to sign sha3(message) via ECDSA. the message, public key and signature ...
12
votes
1answer
744 views

Ethereum signature verification not matching

What I want to achieve is sign a message and then verify the signature whether verified by same address or not. Contract to Invoke ecrecover method to verify the address contract MyAuth { ...
29
votes
6answers
16k views

ecrecover from Geth and web3.eth.sign

I have tried to use ecrecover() to verify the signature of a message. I have looked at lots of references here and elsewhere, like: https://lab-blog.ey.com/2016/12/19/ecrecover/ How does one ...