The Scripts page comprises three sections: Project scripts, Features, and Flex Assets. To access the specific fields within each section, click on the corresponding tab located at the top of the form.
Script Type and Version ⛽*
Select your script type and the version number of that dependency from the drop-down menu provided. Artists must define the library AND version (when applicable).
Project scripts* ⛽
Here, you will upload your project’s script. Your features script should be separate from your project script.
<aside> 🚨 tokenData.hash is a global variable in the environment this script will live in, so you do not need to define tokenData in your script, however your script will have access to it.
</aside>
If your script is large, consider minifying it. There are no limits to the total script length. That said, scripts larger than 24 kilobytes will need to be broken up into segments of 24kb. Segments can be added using the ‘add script segment’ button when uploading a script. Be aware that you will have to pay transaction gas fees proportional to the size of the script upload.
Features Overview
All feature attributes that you want displayed should be directly generated from the transaction hash and should not depend on any other randomness.
This function should essentially encapsulate the feature-determining logic within the rendering script but without any library dependencies (for example, p5js) present (the server won't have access to them).
The function should assume that it receives the tokenData object as an input \(containing both a tokenId and hash string\), and should use these to return the correct desired feature metadata for a given mint.
Properly displaying your project features requires both a a\) feature calculation script and b\) setting the feature fields for your project in the Art Blocks website's artist interface.
Updating the features script or features fields for a given project will recalculate features for all tokens within that project.
Features script
All code required for calculating your features (including any necessary helper functions) must be defined and implemented within the single top-level calculateFeatures function.
For many artists, the process for writing your features script will likely entail starting with your project script, copying it into the calculateFeatures interface/shell above, and then trimming it down to remove all library \(e.g. p5js\) references and draw functionality and instead to build the relative key-value object map for your features.
Feature Fields
In order for filtering and rarity (% occurrence of different features) to be accessible via the Art Blocks website, the feature fields must be added in the artist interface UI on the Art Blocks website.
There are three types of feature fields: enum, number, and boolean:
enum fields, values should be outputted as strings in your features scripts.number fields, the step size set in the feature fields is used for the step size of the slider in the filters. This step size is set in the feature fields UI, not in the script, and should be on a per field basis.boolean fields, the only values are true and false, so you just need to give the field a name.enum field and output the enumerated possible numeric values as strings (for example, if the slider UI would not be the best way to navigate these features).In order to utilize off-chain assets in your project script, you must configure your own IPFS or Arweave gateway and pin your desired assets. Step-by-step instructions to configure a Piñata gateway can be found in our technical docs.
