DMDcoin / diamond-contracts-claiming

claiming contracts
0 stars 2 forks source link

ECDSA recovery #42

Closed SurfingNerd closed 3 months ago

SurfingNerd commented 3 months ago

PoC implementation.

should solve https://github.com/DMDcoin/diamond-dapp-claiming/issues/3

if unit tests fail we have proven that the signature verification is connected with the Contracts or the API

https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/cryptography/ECDSA.sol

SurfingNerd commented 3 months ago

first prototype with ECDSA library from solidity shows same error. internally it does not use a real ECDSA implementation, and also relies on the Ethereum integrated function ecrecover

SurfingNerd commented 3 months ago

the given problematic public key has a Y signature starting with "0x00". But the Y value is not part of the RIPE MD result, the only question is if it is Odd or Even. lets brute force other signatures to figure out problematic public keys.

i have also found addresses that point to a public key of 0x00... as X Coordinates. they result in the same error.

SurfingNerd commented 3 months ago

to verify the Public Key address relation on DMDv3. example: diamond-cli validateaddress dLVGTA4EoZrR1BbNJu1beqUoLXDCTjXmA1 It seems that it can show the public key for addresses that are stored on this node

https://learnmeabitcoin.com/technical/keys/public-key/

SurfingNerd commented 3 months ago

Large testsets ahave been included - however, due to their long duration github kills the process. to enable them pass Environment variable

export CLAIMING_TEST_RUN_LARGE=1