A guide on how to structure the features script for your Art Blocks project.

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 Interface

<aside> 🚨 All code required for calculating your features including any necessary helper functions must be defined and implemented within the single top-level calculateFeatures function.

</aside>

/**
* Calculate features for the given token data.
* @param {Object} tokenData
* @param {string} tokenData.tokenId - Unique identifier of the token on its contract.
* @param {string} tokenData.hash - Unique hash generated upon minting the token.
*/
function calculateFeatures(tokenData) {
/**
* Implement me. This function should return a set of features in the format of key-value pair notation.
*
* For example, this should return {"Palette": "Rosy", "Scale": "Big", "Tilt": 72} if the desired features for a mint were:
* - Palette: Rosy
* - Scale: Big
* - Tilt: 72
*/
return {}
}

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.

Features 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:

OpenSea Personalization