This repo describes the basic workflow to use medusa from scripts using only ethers.js.
The application contract that we will be using is OnlyFiles.sol from the Live Demo created by the Medusa team.
In this example we will be working on the Arbitrum Goerli testnet but you can also use the Filecoin Hyperspace testnet
First, install dependencies with npm install
The steps are:
- We encrypt our text by running
node encrypt.mjs. We have to copy our encrypted text to thedecrypt1.mjsfile. - We start to decrypt using
node decrypt0.mjs. In this script we pay to view the file. - Step 2 triggered an event that the front end should listen, that event has the the encrypted key.
- We copy the values from the event and update the
ciphertextobject, and finally rundecrypt1.mjs