Generating the mandelbrot set on Starknet. Computes a 100x100 mandelbrot plot and stores necessary data to recontruct it onchain in 100 storage felts. Packing of felts is used to minimize the number of storage slots required and therefore the cost to mint. One can then call the contract to retrieve the data and reconstruct the plot.
Create a python environment, activate it, and install Cairo within it as described in: https://www.cairo-lang.org/docs/quickstart.html
Install Nile:
pip install cairo-nileCompile:
nile compile contracts/mandelbrotOnChain.cairoRun a local starknet-devnet node:
nile nodeDeploy (using an alias of your choosing):
nile deploy mandelbrotOnChain --alias mandelbrotOnChain_InstanceInvoke the contract using the script supplied to generate the Mandelbrot set and store the data to produce it within the contract:
python3.7 scripts/generateMandelbrotOnChain.py mandelbrotOnChain_Instance Retrieve the Mandelbrot set data from within the contract and generate the plot of it using the supplied script:
python3.7 scripts/retrieveMandelbrotOnChain.py mandelbrotOnChain_Instance The resulting plot is stored within the images directory. It should look like this!
