Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [ecrecover]

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

0
votes
0answers
2 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
23 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
0answers
25 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
22 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
70 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
30 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
69 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
95 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
174 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
167 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
99 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
370 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
132 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
241 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 ...
0
votes
0answers
61 views

Prevent replay attacks with signed inputs to smart contracts

I found the following contract that returns whether a signature is valid or not. contract Verifier { function isSigned(address _addr, bytes32 msgHash, uint8 v, bytes32 r, bytes32 s) returns (bool)...
2
votes
1answer
106 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
313 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
0answers
179 views

Passing signature parameter to ERC865 contract and ecrecover()

I'm trying to deploy ERC865 Token while using C# Nethereum. The ERC865 contract expect to get signature length of 65 and when i tray to use "geth attach" web3.sha3(privatekey) i get 68 characters long ...
0
votes
1answer
277 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 ...
1
vote
1answer
331 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
32 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
157 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
125 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
720 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
218 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
246 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' ...
3
votes
2answers
103 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
776 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
319 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
744 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
121 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
172 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
274 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
253 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
306 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
337 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
397 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
441 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 ...
10
votes
1answer
3k 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 ...
11
votes
1answer
669 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 { ...
27
votes
5answers
13k 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 ...
5
votes
1answer
585 views

web3.eth.sign not returning a valid signature - Or how else does this work?

EDIT: Problem Solved; working example of login below I use the sha3 of a message I want to sign with eth.sign m = web3.sha3("Please work.") I then runeth.sign(eth.coinbase, m) And it returns me: ...
14
votes
1answer
2k views

Getting the wrong address back from ecrecover

When I sign a string using the following code I get back a different address to the one I signed with. The address returned is different for different strings. const util = require('ethereumjs-util') ...
8
votes
1answer
4k views

Getting an address from ethereumjs-utils ecrecover

I am trying to sign a string using web3.eth.sign() and then get the public key I signed with from the signature. To do this I am using ecrecover() from ethereumjs-utils, which returns a buffer. When I ...
23
votes
1answer
11k views

Ethereum ecrecover signature verification and encryption

The question of signing and verifying signatures with Solidity has been asked in these questions, both of which I have tried to study: How can I sign a piece of data with the private key of an ...
9
votes
2answers
5k views

How does one properly use ecrecover to verify Ethereum signatures?

I've been searching to figure out what I'm doing wrong here, but I've had no luck yet. As far as I can tell, I'm using ecrecover correctly, but I can't seem to get back the signing Ethereum address. ...