Trendaavat aiheet
#
Bonk Eco continues to show strength amid $USELESS rally
#
Pump.fun to raise $1B token sale, traders speculating on airdrop
#
Boop.Fun leading the way with a new launchpad on Solana.
CryptoAgents: a smart contract art collection
Smart contract art like @cryptopunksnfts & @autoglyphs is the holy grail of crypto art
CryptoAgents follows the same principle - with every pixel stored fully on @ethereum
Let's dive into how CryptoAgents works 🧵
1/ VISUAL ASSET REGISTRATION
All visual assets are registered to the CryptoAgents Solidity smart contract first, allowing us to compose the 10,000 agents.
The 3 main functions:
- addDNA(): Alien, Kong, etc
- addItem(): Eyes, Head, etc
- setPalettes(): Popsicl, Kindness, etc

2/ ONCHAIN ART RENDERING
This function works as follows:
- Gets position data for each trait (DNA, head, etc)
- Maps each trait to its color palette
- Generates a 24×24 pixel map (2304 bytes) where each pixel has RGBA values
- Combines all traits into a single pixel array

The interesting part is how it processes trait data:
- Each trait has positions that reference palette indices
- It processes these in groups of 5 bytes (x, y, r, g, b)
- It assembles these into a single 24×24 RGBA pixel buffer

3/ SVG GENERATION
Here's how we implemented a function that returns each CryptoAgent as an SVG:
- Gets the pixel data from the art rendering function
- Loops through each pixel
- For non-transparent pixels (alpha > 0), creates an SVG rectangle with the color
- Combines all rectangles into a complete SVG
- Returns a data URI with the SVG content
The SVG uses rectangles of size 1×1 for each pixel, positioned at the correct x,y coordinates.

4/ ASSEMBLY OPTIMIZATION
- We use assembly for memory manipulation to save gas
- We also use a custom format to encode ERG values efficiently

3,41K
Johtavat
Rankkaus
Suosikit