# Solidity beginners

Using Shadow does require some Solidity knowledge, but you don't need to be an expert.

At a high-level, you need to be able to:

* Decide what you want your end shadow event data table to look like
* Read smart contracts well enough to understand where to insert shadow events
* Write short snippets of Solidity code to declare and emit shadow events
* Use ChatGPT tools to help you out when you get stuck (see recommendations below)

## How long will it take me to learn?

If you're a non-Solidity engineer, it'll be easy. You'll be able to use Shadow within 1-2 hrs.

If you're a data analyst that doesn't know any Solidity at all, you'll be able to use Shadow effectively within a few days. Some shadow events are easier to write, so you may even be able to get things working within a few hours. Many people who primarily have a SQL skillset have learned enough to use Shadow effectively, so don't be deterred!

## High-level steps

We'll walk you through the steps to get started with detailed instructions and screenshots, and also provide tips on common issues that may arise as you create your own shadow events.&#x20;

[I. Get things set up](#i.-get-things-set-up) (e.g. recommended tools and how to get contract code)

[II. Add your shadow event to the contract](#ii.-add-your-shadow-event)

[III. Deploy on Shadow and get your custom data](#iii.-deploy-on-shadow-and-get-data)

## I. Get things set up

### 1. Set up recommended tools

We *highly recommend* Solidity beginners to use these tools in order to use Shadow effectively, and have written detailed instructions with screenshots on how to get them set up.

{% content-ref url="solidity-beginners/recommended-tools" %}
[recommended-tools](https://docs.shadow.xyz/tips/solidity-beginners/recommended-tools)
{% endcontent-ref %}

### 2. Open the contract in Cursor

See "How to use" for the [Contract Code Viewer extension](https://docs.shadow.xyz/tips/recommended-tools#contract-code-viewer-extension).

* You can also download from Etherscan using Open In > Remix IDE from the Contract tab.

<figure><img src="https://content.gitbook.com/content/S7wZ4G2hJbxyJhrQE8Kz/blobs/gps2ytSJPfNeYMdrVKqR/image.png" alt=""><figcaption><p>This will open a new Remix tab </p></figcaption></figure>

* Right click the folder with the contract address and select `Download`

<div align="left"><figure><img src="https://content.gitbook.com/content/S7wZ4G2hJbxyJhrQE8Kz/blobs/O1nvJk4PntVPhi0ZHnPp/image.png" alt=""><figcaption></figcaption></figure></div>

* Open a new Cursor window > `Open from folder`> open the folder with the contract address

<figure><img src="https://content.gitbook.com/content/S7wZ4G2hJbxyJhrQE8Kz/blobs/dQx1QJRYYBm4Ak0C7vio/image.png" alt=""><figcaption></figcaption></figure>

After this step, you should have a folder with the `.sol` file(s) from the contract imported into Cursor. Most contracts will have multiple folders, subfolders, and `.sol` files within each. This may look intimidating at first, but you'll usually only need to modify 1-2 files to add a shadow event.

## II. Add your shadow event

### 1. Declare the shadow event within the contract

The first step of adding a shadow event is to declare it somewhere in the contract. This makes your contract aware of the event and its data parameters.

To keep things organized, you should try to declare your shadow event where the contract's other events are already declared. Search the codebase for "event" – it's usually pretty easy to find.

<figure><img src="https://content.gitbook.com/content/S7wZ4G2hJbxyJhrQE8Kz/blobs/GePJMdQmBdX8eBwACBlS/image.png" alt=""><figcaption><p>In the UniswapV3Pool contract, events are declared in the IUniswapV3PoolEvents.sol file</p></figcaption></figure>

<figure><img src="https://content.gitbook.com/content/S7wZ4G2hJbxyJhrQE8Kz/blobs/rI9HjXIjKuEBJgxwdONr/image.png" alt=""><figcaption><p>You'll see all the events that already exist in the publicly deployed version of the contract</p></figcaption></figure>

Declare your new shadow event where the contract's existing events are declared.

If you don't need to add a brand new event and instead just want to add data parameters to an existing event, you can do that too. If you're modifying an existing event, it's helpful for readability to rename it by pre-fixing "Shadow" to the name, e.g. `ShadowMint`

<figure><img src="https://content.gitbook.com/content/S7wZ4G2hJbxyJhrQE8Kz/blobs/UgjzFgHcsxd3VpRbuQPe/image.png" alt=""><figcaption></figcaption></figure>

### 2. Identify the contract function to emit the shadow event in

The second step&#x20;

<figure><img src="https://content.gitbook.com/content/S7wZ4G2hJbxyJhrQE8Kz/blobs/zDF4cNeQY8xTBBosiN68/image.png" alt=""><figcaption></figcaption></figure>

### 3. Implement the shadow event emit within the contract function

### 4. Compile your shadow contract in Cursor using the Solidity extension

See "How to use" for the [Solidity compiler extension](https://docs.shadow.xyz/tips/recommended-tools#solidity-compiler-extension).

## III. Deploy on Shadow and get data

### 1. Paste your shadow contract in the Shadow browser IDE and deploy

Go to the contract page on [app.tryshadow.xyz](https://app.tryshadow.xyz/). The URL of the page should look something like this, with the contract address replaced and using your unique project\_id at the end.

{% code overflow="wrap" %}

```
https://app.tryshadow.xyz/explorer/addresses/0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640?project_id=a8a8a8a8-3a3a-423e-8b8b-b0b0b0b0b0b0
```

{% endcode %}

Click on the `Open in editor` button in the top right corner.

<figure><img src="https://content.gitbook.com/content/S7wZ4G2hJbxyJhrQE8Kz/blobs/yAY46pEVCypmm0wMdjv1/image.png" alt=""><figcaption></figcaption></figure>

Copy paste your modified code into the right `.sol` files, and click `Deploy`. If you modified multiple `.sol` files to add your shadow event, be sure to replace the contents for each one.

<figure><img src="https://content.gitbook.com/content/S7wZ4G2hJbxyJhrQE8Kz/blobs/dSldcNGC7lO9kSXVqUj6/Deploy.png" alt=""><figcaption></figcaption></figure>

### 2. Access your shadow event data

Once deployed, you can see your shadow events happening in realtime on the Event Feed tab.

<figure><img src="https://content.gitbook.com/content/S7wZ4G2hJbxyJhrQE8Kz/blobs/PvwYnfMyb6r3kCyHEQtD/image.png" alt=""><figcaption></figcaption></figure>

You can also access your shadow event data via RPC, streams to your own database, or a Shadow hosted SQL API. Please talk to us if you're having trouble deciding or setting that up.

## Get in touch

<table data-card-size="large" data-view="cards"><thead><tr><th align="center"></th><th align="center"></th></tr></thead><tbody><tr><td align="center">💬</td><td align="center"><a href="https://t.me/shadow_devs"><strong>Telegram</strong></a></td></tr><tr><td align="center">💌</td><td align="center"><a href="mailto:founders@tryshadow.xyz"><strong>Email</strong></a></td></tr></tbody></table>
