![](https://cdn.nodeguardians.io/backend-production/solidity_bg_fc76a87eed/solidity_bg_fc76a87eed.webp)
Standalone
Stealth Addresses
![](https://cdn.nodeguardians.io/backend-production/Forbiden_Book_1200px_71e37928e9/Forbiden_Book_1200px_71e37928e9.webp)
Part II
Generating Stealth Addresses
The Cursed Grimoires is an ERC721 collection that wishes to support stealth transfers between its users. To do so, it needs the following features:
Users need to be able to declare their public keys. This allows others to use these keys to generate stealth addresses and discreetly send them tokens.
The logic to compute stealth addresses off-chain should be provided.
The ERC721 token has to log all stealth transfers. This allows recipients to search for any stealth transfers designated to them.
Hence, the CursedGrimoires
contract wants to support the following interface.
Function | Description |
| Mints |
| Register the given public key to |
| Transfers a grimoire to a stealth address and emits a |
View Function | Description |
| Generates a stealth address (and its published data) given a registered |
The detailed interface can be found in interfaces/IGrimoires.sol
.
With this implemented interface, CursedGrimoires
facilitates stealth transfers via the following process:
Recipient calls
register()
to register their public key onto the contract.Sender calls
getStealthAddress()
off-chain to generate a stealth address belonging to the registered recipient.
This must be done off-chain, or else everyone can see the recipient's true identity from the input parameters.Sender calls
stealthTransfer()
to transfer the token to the generated stealth address. This also logs relevant information for the recipient to compute the private key to the stealth address.
Your Task
Implement the CursedGrimoires
contract using the Improved Stealth Address Protocol (ISAP) covered in the previous section.
Only make changes to the files listed in files-to-test.json
! Do not add or modify any other files in the contracts/
folder.
Run tests in Questplay
![](https://cdn.nodeguardians.io/backend-production/Forbiden_Book_1200px_71e37928e9/Forbiden_Book_1200px_71e37928e9.webp)
Looking for a way to trade their literature discreetly, owners of the Cursed Grimoires come seeking both your aid and your… discretion.