# The EUCLID CODE

In which we talk about the origins and challenges of transforming 2300 years old theorems into a generative art NFT collection on the Ethereum blockchain, released July 2022.

# Introduction

Around 300 BC, Greek mathematician Euclid of Alexandria wrote a work that would become one of the most influential textbooks ever written, Elements, where he describes his mathematical thinking on geometry and number theory. From just **10 axioms**, he proves **465 theorems**, including the **Pythagoras Theorem** and the proof of the existence of only five **Platonic Solids**.

axiom,

noun:a statement or proposition which is regarded as accepted truth.theorem,

noun:a truth established by means of accepted truths.

Once known mainly by scholars, *Elements* quickly spread worldwide after its first printed edition in 1482. But it was a **hard read**! When conceived, equations and the cartesian coordinates system, taken for granted today, didn't even exist. Euclid explained math with just words and a few doodles.

That changed in 1847 when the Irish professor **Oliver Byrne** published a **graphic **interpretation of the seminal work, *The First Six Books of The Elements Of Euclid, In Which Coloured Diagrams And Symbols Are Used Instead Of Letters For The Greater Ease Of Learners*. The original is available online, and as a beautiful edition by Taschen, with renewed designs by Nicholas Rougeux.

The ** EUCLID CODE** collection idea was inspired by Byrne's edition.

**The Generative Challenge**

What if… we could develop a **deterministic algorithm** that was able to generate Euclid’s theorems from a **randomized hash**. The random emergence of the original drawings could be compared to the Infinite Monkey Theorem, but if we manage to make a few hand-crafted hashes that generate them, the system would be able to create an **infinite number of unique new theorems**!

Sounds fun! And challenging…

A challenge that took almost a year to complete, beginning by researching *Elements*, of course, then finding a **notation to describe the theorems**.

The ** Wolfram Language** immediately came to mind. One of its core principles is to

*“represent everything in terms of symbolic expressions”*, exactly what we needed. To my surprise, Stephen Wolfram has already used his language to explore Euclid’s

*Elements.*This research is detailed in

*The Empirical Metamathematics of Euclid and Beyond*. TLDR: He speaks about the complexity of this task on the Lex Fridman podcast.

Being the **Soul**, the **DNA** of each token, one of my main requirements for *EUCLID CODE* was that the **notation has to reside on-chain,** making it impractical to use Wolfram Language. Licensing could also be an issue.

Thus a unique **formula** was designed, ultimately as a string containing all the geometry and aesthetic parameters. It was developed and refined in **JavasScript** and rendered as **SVG** vectors for optimal display. The parameters and algorithm for randomization and formula creation were designed in a way that could be easily **ported to Solidity**, the Ethereum smart contract language. This port is automated for maximum fidelity.

# Token Distribution

**1870 Tokens**, spread over 9 squares of the**Fibonacci Token Map**above.- Each minted Token is assigned to
**one random slot**on the Token Map. Tokens Ids are**shuffled on-chain**and the Artwork is**revealed immediately**after minting. (tech details at the end…) **Inner**Tokens feature**minimalistic**artworks, with less shapes and effects. Simpler, fewer,**rarer**.**Outer**Tokens can generate more**complex**and chaotic artwork.

# The Drop

On July 1st, 2022, ** Chromium Sale** starts (CHROMA Premium Sale). Automatically available to

**CHROMA Token Holders**. No need to apply, no snapshot.

** CHROMA CODE** is our genesis collection. At minting, collectors choose to

**Build**(definitive artwork is generated) or mint as a

**Source**(artwork to be built later). Source Holders can claim 1 EUCLID, Built Holders can claim 3 EUCLIDs. All details are on the

*EUCLID CODE*page.

- July 1st, 2022:
**Chromium Sale**, fixed price of*ETH 0,001* - July 8th, 2022:
**Public Sale,**fixed price of*ETH 0,005* **Chromium**still continues, until sold out.- Up to 100 tokens can be minted by the Team, for airdrops and treasury, randomly like every other.
.*Because we love it*

Secondary market **royalties** will be set at **5%**.

# Mainnet Mints

EUCLIDs are already being minted! Following are some selected artworks, but you can check the full gallery online or on OpenSea.

# Tech Stuff…

This is what happens to generate a new artwork, from minting to the screen…

**Hash Generation**. When minting a new Token, the smart contract generates a randomized**128-bit number**known as Hash, that will serve as**seeds**to the theorems, stored on-chain.**Euclid Formula**. Using the Hash, the Formula is generated every time the Token**Metadata**is requested. This function is**deterministic**, meaning each Hash will always generate the same Formula.**Euclid Graph**. Using the Formula, the DApp create a JSON graph with the actual geometry (shapes, lines, colours, styles, etc). For development freedom and flexibility, from here we need to process off-chain.**Render**. Finally, the Graph can be rendered, as an**SVG**or**PNG**image. USD is also being considered.

Graph and Render **source code** must be **immutable** and **open source **to preserve artwork integrity and prosperity. (GitHub link later)

Several Smart Contracts have to be deployed to deliver this collection:

**Euclid.sol**: Customized OpenZeppelin ERC-721 minter.**EuclidFormula.sol**: Using a Token’s Hash, generates the artwork Formula.**EuclidShuffle.sol**: Using the Randomizer, shuffles and delivers the 1870 Token Ids one by one.**EuclidRandomizer.sol**: Generate Hashes the random number sequences (not verifyed to preserve randomization integrity).**Whitelist.sol**: Manages the CHROMA Tokens claiming status for Chromium Sale.**ChromaBatch.sol**: Abstract the five CHROMA contracts as if they were just one, for Chromium Sale.

# Thank You!

Go to The collect-code Vision for the full project roadmap.

Official marketplaces: OpenSea, Rarible, LooksRare, X2Y2, Coinbase.

Smart contract verified on Etherscan.

Updates from Twitter: @CollectCoder.

Mints are posted on Instagram: @CollectCoder.

Get involved on Discord.

Created by Studio Avante.