> For the complete documentation index, see [llms.txt](https://artgridz.gitbook.io/artgridz-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://artgridz.gitbook.io/artgridz-documentation/onchain-art-storage/core-concept.md).

# Core Concept

### Visual Overview

<figure><img src="/files/D5VuKuV2iTaocIFo34K7" alt=""><figcaption></figcaption></figure>

### Core Functionalities

#### **1. Recording Pixel Changes**

Pixels are represented on a 100x100 grid. Each pixel's state is tracked using `pixelChanged`, a nested mapping:

```
mapping(uint256 => mapping(uint256 => mapping(uint256 => address))) public pixelChanged;
```

**Workflow:**

* A pixel change emits the `PixelChanged` event, including details of the sender, coordinates, color, and grid ID.
* The total pixels colored are tracked per user using `totalPixels` and `totalPixelsId`.

**Events:**

* **`PixelChanged`**: Triggered when a pixel is colored or erased.
* **`AmountPixel`**: Logs the number of pixels a user has contributed.

#### **Event Declaration**

```solidity
PixelChanged(address indexed sender, uint256 x, uint256 y, uint256 color, uint256 id);
```

```solidity
AmountPixel(address indexed sender, uint256 PixelAmount);
```

#### **Purpose**

The purpose of the event is to record and broadcast changes to the pixel data in a way that is immutable and queryable on the blockchain.&#x20;

This allows anyone to reconstruct the grid's state purely by retrieving and processing these events.

The only potential point of failure is the underlying blockchain itself, making the ArtGridz canvas a direct and tangible visualization of the blockchain's core principles.
