I want to call a function named "testFunction" which takes "claimDate" as a parameter. claimDate parameter comes from a server via api.
contract TestSmartContract {
testFunction(uint256 id, uint256 claimDate) public payable returns (uint) {
// I need a logic to verify if claimDate is coming from a valid source which will mean it is correct.
}
}
In short, you can use signature verification to check if the data comes from the verified source.
The idea is that;
claimDate
from off-chain (ex. backend server).claimDate
together with the signature to the contract.claimDate
is really from the source.⚠️ Note that signing
claimDate
alone might not be enough. Because once the signature is created, it can be visible and reused by exploiters.
Read more: https://blog.chainsafe.io/how-to-verify-a-signed-message-in-solidity-6b3100277424