![](https://cdn.nodeguardians.io/backend-production/solidity_bg_fc76a87eed/solidity_bg_fc76a87eed.webp)
Standalone
Using Signatures
![](https://cdn.nodeguardians.io/backend-production/Lotus_Monk_04_1200px_36128c511e/Lotus_Monk_04_1200px_36128c511e.webp)
Part II
Verifying Signatures
With the ability to sign messages, we can now work on the smart contract. To recap, the smart contract will:
Hold funds (received during deployment).
Transfer funds, aka blessing, to users (if they provide a corresponding signature from a Grandmaster).
Promote a user to Grandmaster (if they provide a corresponding signature from a Grandmaster).
We will build a Grandmasters
contract that supports the IGrandmasters
interface.
Function | Description |
| Returns true if |
| Promotes |
| Transfers |
Like before, the signed messages to verify are as follows:
1. Invite a Grandmaster
Instruction for smart contract to promote an address to be a Grandmaster.
keccak256(
"\x19Ethereum Signed Message:\n32"
+ keccak256("Invite{address}")
)
address
: Address of individual to be invited as a Grandmaster [20 bytes long]
2. Receive Blessing
Instruction for smart contract to transfer ETH to a recipient.
keccak256(
"\x19Ethereum Signed Message:\n32"
+ keccak256("Bless{address}{amount}{ctr}")
)
address
: Address of recipient of blessing [20 bytes long]amount
: Amount of blessing (in wei) [32 bytes long]ctr
: Number of blessings the recipient has been given beforehand [4 bytes long].
Lastly, take note of these 2 pointers:
The contract's creator is by default, a Grandmaster.
The contract's constructor should be
payable
, so that the contract can receive funds.
Your Task
Complete Grandmasters.sol
by implementing IGrandMasters
.
Run tests in Questplay
Submit work in Questplay
![](https://cdn.nodeguardians.io/backend-production/Lotus_Monk_04_1200px_36128c511e/Lotus_Monk_04_1200px_36128c511e.webp)
The Grandmasters’ words are absolute. It is important for their followers to be able to discern them from lies.