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
1answer
69 views

How to implement owner check in Solidity

Is there any EIP that specifies how to implement function in contract, that let's you call any other function as contract owner, with provided signature? I don't want to reinvent wheel. For example: I ...
0
votes
1answer
65 views

Is it best practice to check signature malleability in ecrecover

I am wondering if it is considered best practice to guard against signature malleability to check against the half curve order like this or if this is totally unnecessary. uint256 constant ...
1
vote
0answers
105 views

EIP712— Sign/Recovery using ethereumJS/Solidity

I've tried to mirror the example as shown: https://github.com/ethereum/EIPs/tree/master/assets/eip-712 However after much attempt at troubleshooting I have been unable to return the correct address ...
0
votes
0answers
65 views

Verification of ECDSA signature is not valid while testing HashDice.sol

While practising on the ethereum contract HashDice.sol using truffle, the verification of the ECDSA signature is getting invalid after running the test script. describe('verify()', () => { it('...
0
votes
1answer
55 views

What is the gas cost of recovering a wallet address from a signature using Solidity?

As titled. I understand that there's an ecrecover function in Solidity. Can I use it for recovering a wallet address from a signature? Is it cheaper than a Keccak hash operation?
2
votes
1answer
232 views

Recover public key from sign generated by AWS Cloud HSM - Golang

I am signing a transaction by using a private key in AWS Cloud HSM. But not able to recover the correct public key from the signature. Every time I try to run ECRecover method, it generates different ...
2
votes
1answer
60 views

What's the magic numbers meaning of 27 or 28 in VRS ( use to ecrover the sender) ? why not 0 or 1?

What's the magic numbers meaning of 27 or 28 in VRS ( use to ecrover the sender) ? why not 0 or 1? Ecrecover need 0 or 1, but transaction RLP is 27 or 28. Before ecrecover, sub 27 to get 0 or 1. Why ...
1
vote
1answer
392 views

ethers.js Recover public key from contract deployment via v,r,s values

I'm currently trying to get the public key of the user that deploys a contract. Unfortunately I can't make it work. I am trying to achieve this solely by using ethers.js as I don't want to bloat my ...
0
votes
0answers
52 views

Signature not matching the sig obtained from MyEtherWallet

I am serializing the unsigned txn in C, then I found Keccak-256 hash and I signed it with the privatekey. However, the resulting signature is not the same as in MyEtherWallet for the same values(...
0
votes
2answers
74 views

Recovering of typed signature fails because it's too long

I have a typed signature generated by EIP712 V3. It is 132 characters long. I'm trying to recover it using recoverTypedSignature from eth-sig-util. This fails saying: index.js:1 Error: Invalid ...
1
vote
2answers
853 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
57 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
98 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?
1
vote
2answers
335 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
148 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 ( ...
1
vote
1answer
470 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 ...
4
votes
1answer
132 views

How to get the zero address 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
199 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
93 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 ) => { ...
4
votes
2answers
256 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
36 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
491 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
118 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 ...
1
vote
1answer
182 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
331 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
856 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
494 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
296 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
785 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
611 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
915 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
226 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
1k 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
637 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 signature:...
4
votes
1answer
686 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
54 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
222 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
206 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 ...
3
votes
2answers
2k 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
373 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
327 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
221 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
1k 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 ...
3
votes
2answers
539 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
2k 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
158 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
295 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
383 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
369 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 ...
5
votes
1answer
546 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....