---
description: >-
  The ARTGRIDZ smart contract tracks every pixel drawn as a blockchain event.
  Artworks are displayed by querying these events, ensuring an immutable and
  decentralized record of artistic contributions.
---

# Core Concept

### Visual Overview

<figure><img src="https://3978789388-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fckp3Fnb7Lg03CBX8O1jS%2Fuploads%2FPJCdS2T0G2F07A9vX4AN%2Fbanner3d.png?alt=media&#x26;token=116e4aa7-6472-4eba-b045-cfcf7e25a4de" 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.
