Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Runes second series doc #140

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
6 changes: 6 additions & 0 deletions docs/04-resources/08-runes/airdrop/_category_.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
label: Build A Giveaway Airdrop Machine
position: 4
link:
type: generated-index
description: This guide will focus on airdrops on the Rootstock network, highlighting how they function and the unique benefits they offer to users. A particular focus will be on the Runes Giveaway Machine Airdrop Claim, where you will learn how to install and use this innovative tool to claim your tokens easily.
slug: /resources/runes/
47 changes: 47 additions & 0 deletions docs/04-resources/08-runes/airdrop/airdrop-Intro.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
sidebar_position: 1
title: Introduction to Airdrops on Bitcoin
sidebar_label: Introduction
tags: [rsk, rootstock, resources, tutorials, runes, nft, Ethereum, dApps, smart contracts, airdrop]
description: "Airdrops are a way for cryptocurrency projects to distribute free or sometimes paid tokens to users, often to promote a new project or reward loyal users. "
---

<img src="/img/resources/runes/airdrop/intro-airdrop.png"/>

Airdrops are a way for cryptocurrency projects to distribute free or sometimes paid tokens to users, often to promote a new project or reward loyal users.

While most airdrops are associated with Ethereum-based tokens, Bitcoin also has its own share of airdrops. One exciting example is the **Runes giveaway machine Airdrop claim**, which we’ll dive into later to explain how to install and use it.
In this guide, you will learn about airdrops, focusing on how they serve as a tool for cryptocurrency projects to engage with their communities.

You will gain an understanding of what airdrops are, including their purpose in promoting new projects and rewarding loyal users.
This guide will focus on airdrops on the Rootstock network, highlighting how they function and the unique benefits they offer to users. A particular focus will be on the Runes Giveaway Machine Airdrop Claim, where you will learn how to install and use this innovative tool to claim your tokens easily.

Additionally, you will learn the process of building your airdrop machine, you can create your token distribution systems for future projects.

## What is an Airdrop?
An airdrop refers to the distribution of cryptocurrency tokens or coins, usually free of charge, to users. The main reasons for this distribution include promoting a new project, rewarding users, or building a community around a token. Generally, users must meet certain criteria, such as holding a particular cryptocurrency or signing up for the project, to receive the airdrop.

## Airdrops on Bitcoin
Although Bitcoin isn’t as widely used for airdrops as Ethereum, a few notable projects use its technology to offer them. These airdrops may come from Bitcoin forks or projects built on Bitcoin’s Layer 2 solutions.

For example:
- **Fork Airdrops:** When a fork of Bitcoin happens (e.g., Bitcoin Cash), users holding Bitcoin at the time of the fork automatically receive an equal amount of the new currency.
- **Layer 2 Airdrops:** Some projects that utilize Bitcoin’s second-layer solutions, like the Lightning Network, reward users through airdrops to encourage adoption and participation in new services.

## The Runes Giveaway Machine Airdrop Claim

One of the more exciting developments in the Bitcoin airdrop space is the Runes giveaway machine Airdrop claim. This project is an open-source proof of concept that implements an **Airdrop dApp** (decentralized application).

It allows users to claim airdropped tokens in a decentralized manner, making the process transparent and secure. Below is a breakdown of the technologies used in this project and how to get started with installation.

### Technologies Used
- OpenZeppelin Standards: These are widely used, secure smart contract libraries that help with the development of blockchain applications.
- Ethers.js: A powerful library for interacting with the Ethereum blockchain, used here for its flexible capabilities in building dApps.

## Why Are Airdrops Important?
Airdrops serve several key purposes in the cryptocurrency ecosystem:
1. **Building Awareness:** Airdrops are an effective way to introduce users to new projects, fostering quick community growth.
2. **Rewarding Users:** Loyal users or early adopters often receive airdrops as a way of thanking them for their support.
3. **Creating Liquidity:** By distributing tokens to a wide user base, projects can increase the liquidity of their tokens.
4. **Decentralization:** Airdrops help spread ownership of tokens, ensuring that the token distribution is more decentralized.

128 changes: 128 additions & 0 deletions docs/04-resources/08-runes/airdrop/airdrop-setup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
---
sidebar_position: 2
title: Setup Airdrop Machine
sidebar_label: Setup
wise4rmgodroot marked this conversation as resolved.
Show resolved Hide resolved
tags: [rsk, rootstock, resources, tutorials, runes, nft, Ethereum, dApps, smart contracts, airdrop]
description: "This shows you steps to set up your airdrop giveaway machine"
---

## **Prerequisite**

Before going further in this guide, it's essential to have the following foundational knowledge and tools in place:

1. **Familiarity with Remix IDE:**
* Understanding how to navigate and utilize Remix IDE is crucial. This includes knowledge of its features, such as the Solidity compiler, file management, and debugging tools. Being comfortable with the IDE will enable you to write, test, and deploy smart contracts efficiently.
2. **Basic Knowledge of Solidity:**
* A foundational grasp of Solidity, the primary programming language for Ethereum smart contracts, is necessary. This should include familiarity with basic syntax, data types, functions, and contract structures. You should be able to write simple smart contracts and understand how to interact with them.
3. **Git Installation:**
* Ensure that Git is installed on your machine. Familiarity with Git will help you manage version control effectively, collaborate with others, and track changes to your code.

#### **Installation**

To install and run the Runes giveaway machine Airdrop claim locally, follow these steps:

1. **Clone the Repository**:

```
git clone https://github.com/rsksmart/airdrop-ui.git
cd airdrop-ui
```

2. **Install Dependencies**:
Run the following command to install the necessary packages:

```
npm install
```

3. **Configure Environment Variables**: Create a `.env` file in the root directory and add the necessary environment variables. Below is an example of how to configure the environment variables:

```
NEXT_PUBLIC_AIRDROP_MANAGER_ADDRESS=<your_airdrop_manager_address>
NEXT_PUBLIC_RPC_URL=<your_rpc_url>
NEXT_PUBLIC_EXPLORER=<your_blockchain_explorer>
```

### Explanation with added context for each environment variable:

```
NEXT_PUBLIC_AIRDROP_MANAGER_ADDRESS=<your_airdrop_manager_address>
```

This variable specifies the address of the Airdrop Manager smart contract. To ensure your application interacts with it correctly, you'll need to deploy this contract using Remix IDE. After deployment, copy the contract's address and paste it here.

:::info[Info]

For detailed instructions on obtaining the Airdrop Manager address, please refer to the [Deploy](docs/04-resources/09-Airdrop/deploy.md) section

:::

```
NEXT_PUBLIC_RPC_URL=<your_rpc_url>
```

This variable holds the URL of the Remote Procedure Call (RPC) endpoint for your blockchain network. It allows your application to communicate with the blockchain by sending requests and receiving responses. Be sure to replace `<your_rpc_url>` with the actual URL provided by your blockchain service provider.

The Remote Procedure Call (RPC) URL is how your Runes Mock Bridge interacts with the Rootstock (RSK) blockchain.

* To get the RSK RPC URL, go to the [RSK Dashboard](https://dashboard.rpc.rootstock.io/login) and log in. After logging in, you can create an API key that will give you access to the RPC URL.
* Once the key is generated, you can use it to set up this variable, which allows your bridge to communicate with the blockchain.

```
NEXT_PUBLIC_EXPLORER=https://explorer.testnet.rootstock.io/tx
```

This variable contains the URL of your blockchain explorer. A blockchain explorer is a tool that allows you to view transactions, addresses, and other activities on the blockchain. Replace `<your_blockchain_explorer>` with this `https://explorer.testnet.rootstock.io/tx`

:::warning[Info]

Make sure to replace the placeholders with your actual values before deploying your application\!

:::

4. **Run the Development Server**:
To start the development server, use the command:

```
npm run dev
```

Once installed, this project can be used to claim airdrops via a decentralized application, adding another layer of utility to the Bitcoin ecosystem.

## **Frontend Integration Guide**

Once you have the application running locally, follow these steps to interact with the airdrop functionality:

1. **Connect Your Wallet:**

<img src="/img/resources/runes/airdrop/airdrop-dashboard.png"/>

* Click on the **"Connect Wallet"** button.
* This will prompt you to connect to your MetaMask wallet. Follow the on-screen instructions to complete the connection.
2. **Wait for Airdrops to Load:**
* After connecting your wallet, give it a few moments for the list of available airdrops to load. You can find these airdrops by scrolling down the screen.
3. **Choose Your Action:**

<img src="/img/resources/runes/airdrop/list-of-Airdrops.png"/>

* At this point, you have two options:
* **Create a new airdrop**, or
* **Claim available airdrops**.
4. **Understanding the Airdrop Card:**
* The first airdrop on the list is called **“Test”**. Here's a breakdown of what you’ll see on the airdrop card:
* **Progress bar** showing the status of the airdrop.
* **Amount to receive**, which indicates how many tokens you can claim.
* **Available to claim** section with the wallet address eligible for the airdrop.
* A **"Claim"** button.
5. **Claiming the Airdrop:**

<img src="/img/resources/runes/airdrop/claim-airdrop.png"/>

* Click the **"Claim"** button on the airdrop card.
* You will be directed to a screen where you can proceed to claim your tokens.
* Wait for a few moments for the transaction to complete.
6. **Viewing the Transaction:**
* After successfully claiming your airdrop, click on the **"View Transaction"** button.
* This will take you to the Rootstock explorer, where you can view the details of your transaction.

<img src="/img/resources/runes/airdrop/claimed-airdrop.png"/>
78 changes: 78 additions & 0 deletions docs/04-resources/08-runes/airdrop/deploy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
---
sidebar_position: 3
title: Deploying the Airdrop Machine Smart Contract Using Remix IDE
sidebar_label: Deploy Airdrop Machine
tags: [rsk, rootstock, resources, tutorials, runes, nft, Ethereum, dApps, smart contracts, airdrop]
description: "This guide will walk you through deploying the Airdrop Machine smart contract using Remix IDE. The Airdrop Machine is designed to distribute tokens across multiple addresses, supporting both standard and Merkle tree-based airdrops.
"
---
This section will walk you through deploying the Airdrop Machine smart contract using Remix IDE. The Airdrop Machine is designed to distribute tokens across multiple addresses, supporting both standard and [Merkle tree-based](https://www.investopedia.com/terms/m/merkle-tree.asp) airdrops.

By following these instructions, you'll learn how to clone the necessary repository, prepare the contracts, and deploy them in Remix IDE.

## **Step 1: Clone the Repository**

Clone the Airdrop template repository from the link below:
```
git clone https://github.com/rsksmart/airdrop-template.git
```

This repository contains all the smart contract code you need to deploy the Airdrop Machine. You’ll use this code to get the smart contract address required for your project.

> Basic knowledge of deploying and testing smart contracts in Remix IDE is required. If you’re unfamiliar, please refer to the [Remix Quickstart Guide](/developers/quickstart/remix/) for a detailed tutorial.

## **Step 2: Prepare the Contracts for Remix IDE**

1. Navigate to the cloned repository and locate the `contracts` folder.
2. Copy the code from both `AirdropManager.sol` and `Administrable.sol` contracts. These files are crucial because the `AirdropManager` contract imports functions from `Administrable.sol`.
3. Paste the contents of both contracts into Remix IDE.

<img src="/img/resources/runes/airdrop/prepare-contract-for-remix.png"/>

**Note:** If you're using the latest Solidity version, be aware that some Rootstock contracts may not be fully compatible. We recommend using Solidity version **0.8.20** for better compatibility.

## **Step 3: Compile and Deploy the AirdropManager Contract**

After pasting the contracts into Remix IDE, follow these steps to successfully compile and deploy them:

* **Select Solidity Version**

* Ensure the compiler version is set to **0.8.20** to maintain compatibility with Rootstock contracts.

* **Compile the AirdropManager.sol Contract**

* Click the **Compile AirdropManager.sol** button to compile the contract.
* Make sure there are no errors before proceeding to the next step.

* **Deploy the AirdropManager Contract**

* Go to the **Deploy & Run Transactions** tab in Remix.
* From the **Environment** dropdown, select the Remix VM (Cancun)
* In the **Accounts** section at the top of Remix, copy the first account address.
* Paste this address into the contract deployment input field.

:::tip[Important]
Make sure to enter the address inside square brackets, like this: `[0x5B38Da6a701c568545dCfcB03FcB875f56beddC4]`. If entered incorrectly
(e.g., without brackets), you will encounter the following error:

```
“creation of AirdropManager errored: Error encoding arguments: Error: expected array value (argument=null, value="0x5B38Da6a701c568545dCfcB03FcB875f56beddC4", code=INVALID\_ARGUMENT, version=abi/5.7.0)”.
```
:::

> Double-check that the account address is properly formatted with square brackets to avoid this issue.

<img src="/img/resources/runes/airdrop/Deploy-the-AirdropManager-Contract.png"/>

## **4\. Deploy the Contract**

* After correctly entering the address, click **Deploy**.
* This will deploy the `AirdropManager` contract, which manages the entire airdrop process, including both custom and Merkle tree-based airdrops.

## **5\. Copy the Contract Address**

<img src="/img/resources/runes/airdrop/Copy-the-Contract-Address.png"/>

* Once deployment is successful, copy the contract address of the deployed `AirdropManager`.
* This address will be required in your Airdrop UI project.

Loading