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
1answer
23 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
8 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
43 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 ...
3
votes
1answer
34 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
34 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
30 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
58 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
23 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
144 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
32 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
83 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
119 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
232 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
222 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
139 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
453 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
184 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
282 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
118 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
369 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
189 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
319 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
372 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
40 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
171 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
137 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
824 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
242 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
257 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
120 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
811 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
343 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
854 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
131 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
192 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 ...
5
votes
1answer
282 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
271 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
328 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
365 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
417 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
468 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 ...
12
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
698 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
6answers
14k 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
608 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 ...