💻Code
Artist requirements
The gm.studio platform supports artwork code created in Processing (the java app) or Javascript (including p5js).
Javascript
Artists should provide a script adhering to the following spec:
A single minified js file.
We recommend p5.js, but we can also support any non-WebGL based libraries.
Your script should contain a standalone function that reads parameters from
window.params
and draws the artwork in a canvas in the current window.The window params type is described in the code block below.
Your script should write the attributes to
window.metadata
Upon completion your script should set
document.complete = true
Notes:
All metadata values should be output as
String
types.You should tell us the aspect ratio of the output so that we can display the pieces optimally in our gallery.
The currently supported version of p5 is
1.4.0
Processing
Artists can also submit Processing code. In order for your script to inter-operate with GMStudio's rendering stack, you are required to include the following code:
Code archival
The official on-chain code repository for the gm.studio was deployed to 0x8229e9bc30cb02c2d9af25022bc146a302c48c47. This repository is used to store the code for all on-chain collections and acts as a central database thereof.
Storing in contract bytecode
This step is usually performed by the studio team
generate a gzipped tarball of all files
tar -czf archive.tar.gz sketch.min.js desc.json
get the blob's hex string e.g. by
echo "0x"$(hexdump archive.tar.gz -v -e '/1 "%02X"')
store blob using
repo.store(blob)
an event containing the storage address will be emitted during the transaction
Code verification
Please make sure that the stored code matches the one used for rendering the tokens.
The code can be either fetched directly from the contract using the repo.getBlob(collectionAddress)
or more conveniently using the tool under gmstudio.art/repo:
Connect a wallet (needed to get a connection to the blockchain)
Make sure to select the correct collection address
Click
Download Blob
to download the code archiveUnpack the archive
Please verify that the stored script is correct e.g. by rerendering the genesis token using the downloaded code.
You can fetch the seed for a given token directly from the collection contract on etherscan:
Navigate to the collection contract, e.g. 0x65d8b2bf930a0015028efcaee5af7bf61b90b76f
Fetch the seed using
contract.tokenSeed(tokenId)
Code signature
If the stored code is correct, you can proceed to sign your code (this step is optional but we highly encourage to do so).
Navigate to gmstudio.art/repo
Connect the wallet that you want to use to sign your code. The wallet will be associated with your code.
Make sure to select the correct address of your collection. See also contracts
Click
Sign
Metamask will pop up and prompt you to sign something - please do so.
Even though some of the characters might seem weird, this is totally fine because we are signing the raw binary hash of the repository entry while Metamask tries to interpret it as a string.
Please communicate the output appearing below the buttons to the studio team.
Last updated