Goal: To achieve on-chain verifiable pvp results using ECDSA
At first I had no idea how to achieve this, but after a few weeks I had an idea. Before and after battles he uses ECDSA signatures to ensure that all participants are recorded and sends these signatures up the chain via a central wallet. Her Web2 security here is a must. Since you’re using a centralized wallet, you shouldn’t try to implement a production version of this without spending significant time on web2 security.
hashedMessage = keccak256(
player1 token id,
string unique id
I forgot to add a unique id. Make sure to store the ID in a mapping that is used after each function call. mapping(string => bool) should be fine.
For those who don’t know about ECDSA (Elliptic Curve Digital Signature Algorithm), here is its implementation. Prefixed with _hashedMessage, recover the signer using the ecrecover function, passing the hashed message and her three parts _v, _r, _s of the signature.
Is there a case for using this in your project?
If you find this interesting, why not check this out!
Solidity Development Study Group — https://discord.gg/KzbcGmrnfN
-Polygon Alliance- https://www.polygonalliance.com/
-Polygon Alliance Discord- https://discord.gg/kJKPCGQu66
Did you enjoy this article?
Would you like to buy me a cup of coffee?
Polygon/Eth/Bsc — 0x4A581E0eaf6b71D05905e8E6014dc0277A1B10ad
New to trading?try crypto trading bot again copy trading upon best crypto exchange