Lockup
If you create NFTs (Non-fungible tokens), Lockup is a way to allow only the owner of the file to be able to view the image.
Using Lockup
Locking up a file
NOTE: This needs to be updated, the whole process has been greatly simplified.
DISCLAIMER: Lockup's point of failure is with an entity who holds the unencrypted, orginal, copy of the file. If this file is published, using Lockup would be pointless, so be sure this image is stored securely offline if it holds value.
Prerequisites:
- Golang is installed on your system. If you haven't done so already, you can click this link to learn how.
Process:
- Open a new terminal window and run this command
curl https:// <LINK> -O lockup.zip. Then run unzip -D lockup and finally cd lockup (Check the releases page to see which link you should use)
- We now need to encrypt the image file.
- Put the image in the lockup folder and then in the
encrypt folder.
- Click/run the
encrypt file in that folder. Complete the steps required.
- Be sure to copy the file name perfectly and jot down your encryption key for use later.
- Suggestion: Give the encrypted file a
.bin suffix to indicate an encrypted binary.
- Move the encrypted file back to the
lockup folder.
- Finally we will create the application binary that will decrypt and display the image.
- Navigate to the
params.go file in the lockup/params folder your preferred text editor
- If using a file format that is not an image(i.e. audio or music), comment that line (add a
// to the beginning of the line) and uncomment the line of your preferred format (remove the relevant //.
- Edit the lines of code beneath
// START USER CHANGES and // END USER CHANGES
tokenID is the ID of the specific NFT of the smart contract you will use.
contractAddress is the smart contract that the NFT is minted on.
Here are the addresses of some common platforms.
key is the encryption key that you used to encrypt the file during step 2.
rpcUrl is the URL of an Ethereum node's JSON RPC, this is to find the owner of a specific NFT. You can use services such as Infura or Alchemy. You can also run your own public node, just make sure it is secured with SSL and the server is publicly accessible.
nftTitle is the title of your NFT. It will be displayed as the title of the window.
fileName is just the encrypted file of your NFT
- After editing the file, save it, return to the console and run
go build
- Finally, make a new folder and put the
lockup file (not lockup.go) and the .bin file.
- Test your by following the instructions in the next section.
- Finally, if you wish to distribute this file, zip the folder and upload it to whatever service you choose such as IPFS or Swarm
Viewing/"Unlocking" a file
- Click the
lockup file.
- You will need to sign a digital signature. A terminal window should open upon clicking the file, it will contain the message you will need to sign.
- Sign the message. You can use a site like this one. If you would like to sign it yourself use the
personal_sign instead of eth_sign method, this is to avoid malcious programs from getting you to sign transactions.
- Enter the in the gui window. Make sure the data has a
0x prefix.
- If successful, your image should be shown.
Architecture
Lockup is meant to restrict access to the original NFT images in an almost completely decentralized manner. The system first calls an ERC721 contract to find the owner of an NFT. Then it uses a digital signature to verify the token owner. If the signature is valid, the program will decrypt the image and store it in a base64 format io stream (not a file). The io stream is read by the Fyne GUI API to display it in the window.
Goals
- Expand encryption to video and audio