有没有办法将经过验证的参数传递到坚固的智能合约功能?
我想将名为“ testfunction”的函数称为“索赔达特”作为参数。索赔数据参数来自服务器通过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.
}
}
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.
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
简而言之,您可以使用签名验证来检查数据是否来自经过验证的源。
这个想法是;
索赔date
从Off-Chain(Ex。BackendServer)签名。索赔
以及合同的签名一起发送。索赔
实际上来自源。阅读更多信息: https://blog.chainsafe .io/how-to-verify-a-signed-message-in-solidity-6b3100277424
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.Read more: https://blog.chainsafe.io/how-to-verify-a-signed-message-in-solidity-6b3100277424
您可以使用钱包地址来验证源是否有效。
例如:
You can use the wallet address to validate if the source is valid.
For example: