Created
August 22, 2021 05:41
-
-
Save grahamtallen/d8741094acf923537506bf30d6014fd1 to your computer and use it in GitHub Desktop.
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.4+commit.c7e474f2.js&optimize=false&runs=200&gist=
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity 0.8.4; | |
/* | |
for later: | |
function _verify(bytes32 data, address account) pure returns (bool) { | |
return keccack256(data) | |
.toEthSignedMessageHash() | |
.recover(signature) == account; | |
} | |
*/ | |
contract SignTester.sol { | |
constructor() { | |
// Consensus shared across two wallets are easy, | |
// This contract will define protocols and re-test existing modes of computation and communication in solidity | |
// these will seem overly-redundant, it is because they are overly redundant | |
// A "pure" solidity function is simply a computation run on the evm on some node in the blockchain | |
// No blockchain database data is use in a pure function | |
} | |
function encodeMessage( | |
address _to, | |
uint _amount, | |
string memory _message, | |
uint _nonce | |
) public pure returns (bytes32) { | |
return api.encodePacked(_to, _amount, _message,); | |
} | |
function hashEncodedMessage( | |
address _to, | |
uint _amount, | |
string memory _message, | |
uint _nonce | |
) public pure returns (bytes32) { | |
return keccak256(encodeMessage(_to, _amount, _message, _nonce)); | |
} | |
function signEncodedHashedMessage( | |
address _to, | |
uint _amount, | |
string memory _message, | |
uint _nonce | |
) publice pure returns() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment