# Introduction to Linkdrop

The core of Linkdrop is **Claim Links.** These are the links that help you distribute any asset (NFT or ERC-20 tokens) without knowing the address of the receiver. You simply wrap your tokens into unique links using our Dashboard, download these links and share them to your audience. The link includes everything the end user needs to claim the asset, and could also be sponsored, so that he will pay nothing for the transaction.\
\
[**Linkdrop Dashboard**](/linkdrop-dashboard/creating-links-in-bulk) allows you to create Claim Links in bulk, wrap them into QR codes or distribute using as single dispensing application. Dashboard-based solutions can help you build sophisticated marketing campaigns for you company or brands. Consider them as one-to-many.

{% hint style="info" %}
If you are interested in integrating similar flow, but on a **peer-to-peer** basis, letting your users to create single Claim Links inside your app and share them, please jump to our latest product - [**P2P SDK**](/linkdrop-p2p-beta/p2p-sdk)
{% endhint %}


# Creating links in bulk


# Main guide


# Before you go


# Supported networks

Here are few tips for you to choose the optimal network for

#### **Polygon (**:thumbsup:**Recommended for most cases)**

Polygon is Ethereum layer 2, it works on Matic tokens and transactions there are practically free compared to Mainnet. Users still use their standard Ethereum address, but have to add Polygon network. At the claim, Linkdrop flow would suggest this action itself.

Even popular NFT collections such as Bored Apes & CoolCats do their drops to users on Polygon, as Mainnet would require too much expensive gas to pay for.

#### **Mainnet**

Mainnet mostly describes itself. It’s the most popular & all high volume bluechip NFT collections are on it. But for marketing reasons and building audiences from scratch, its transaction prices are wild and painful.

Although, claimable links on Mainnet could still come in handy for:

* gifting items to other people
* some low volume premium campaigns, where you need to distribute items
* you could also decide to distribute your whole NFT collection with Linkdrop!
* any other OG cases for those of your who don’t count ETH

Please refer to Polygon guide as the process is basically the same, with 2 differences: you have to be connected to Mainnet network & sponsorship pricing will be in ETH (please also refer to Pricing section here)

Please note: Only generating 100 links <mark style="background-color:yellow;">per campaign</mark> max could currently be done with our web interface. If you need more than that, you’d require a subscription (please contact us at **<hi+docs@linkdrop.io>**)


# Token standards

### NFTs:

1. **ERC721 tokens:** These are NFTs that represent unique digital assets, like rare collectibles or artwork. Each ERC721 token is distinct and cannot be directly exchanged for another, as they have their own unique value and characteristics. Examples include digital art pieces or virtual real estate in a metaverse. For example, imagine a video game, and there is a super sword, and it's the only one that exists in the game, it will be a unique token.<br>
2. **ERC1155 tokens** : ERC1155 is a mix of fungible and non-fungible tokens within a single smart contract. They're like a pack of trading cards that can be bought, sold, and traded together as a group or individually. \
   \
   For example, imagine a video game that has some identical items that you can find, like a healing potion, each bottle of this potion will look the same, but you can own more than one. Let's say you own 20 bottles of the potion. This way, the token ID will be recall to the type of the item - potion (and will be the same), and copies will recall to the quantity that you own. &#x20;

{% hint style="info" %}
For most of the marketing campaigns we suggest using 1155 token copies as they are easier to create in and manage in bulk.
{% endhint %}

### Non-NFTs:

1. ERC20 tokens: These are non-NFTs, or fungible tokens, which are like interchangeable coins. Each ERC20 token has the same value and function, making them easily exchangeable with one another. Examples of ERC20 tokens include digital currencies like DAI or USDC.


# Getting crypto to start

## Polygon campaigns

### Buying and bridging Matic to Polygon

\
In order to proceed you’d require to have some Matic tokens on your account, and have them transferred to Polygon network.

You could purchase Matic on a decentralized exchange here:<https://app.uniswap.org/#/swap?outputCurrency=0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0>. After purchasing, you would have Matic on the Mainnet, and you would still have to transfer it to Polygon.

Basically you’d need to go to<https://wallet.polygon.technology/bridge>, connect to your wallet on Mainnet, select tokens (Matic) to bridge, and initiate transactions.

Here you could find a pretty decent guide on how to bridge tokens to Polygon, if you’re experiencing problems:<https://youtu.be/4BWzYtsRHg0?t=138>

{% hint style="info" %}
**Please note:** If you don't have any tokens, you could buy Matic straight at <https://www.coinbase.com/>, but be sure to have on Polygon network and transferred to your non-custodial wallet such as Metamask to be able to use our Dashboard
{% endhint %}

## Ethereum mainnet campaigns

\
If you prefer Ethereum Mainnet,you will just need Ether. \
Just head to <https://www.coinbase.com/> to buy some ETH  there. <br>


# Minting 1155 NFTs on Polygon

Minting tokens to distribute

**🎥** *Screencast:* <https://youtu.be/dtUBJ6T3QBo>

Linkdrop does not have its own minter. For the example above, I minted with Opensea, but you could use any other minter or your own contract.

After filling all the data and pressing create, you’d have your item created on Opensea. Please note that sometimes the item will not appear in your profile instantly, it can take 2-5 minutes, before you could see it.

Important thing to note - OpenSea uses “lazy” minting, so, until any further blockchain transaction is processed, it won’t exist on blockchain, but only on OpenSea . To really physically mint the item on blockchain - I need to send it to myself to initiate blockchain transaction.

Any transaction will work here, but sending to yourself seems to be the easiest way.


# Misc

Few more details to exclude confusion

### Checking if the claim was successful

Sometimes OpenSea can require up to 1+ hours to update the ownership info. Their may not be quick for that.

However, the data on [Polygonscan](https://polygonscan.com/) is accurate and shows if the item was actually transferred.

You can change [<](https://polygonscan.com/address/0x2476fcf1e26703c6f97ef727e61e557ab56b3f91)youraddress> here to the one you're reviewing and follow the link: \
[https://polygonscan.com/address/\<youraddress>](https://polygonscan.com/address/<youraddress>)

Check out the screencast below for more info on how to use Polygonscan **🎥** *Screencast:*<https://drive.google.com/file/d/1KrQIcM8JKz7ux39n4o3u3EfvIIRQIdGF/view?usp=sharing>

### Misc: i**tem visibility after claim**

As far as the item appears on OpenSea - it will appear in "Hidden" tab. It’s just the way marketplaces render items from blockchain and isn’t connected with any item data itself. To make the items visible in Collected tab, you simply need to press “...” button on it, select “Unhide” and approve this action in Metamask.


# Setting up a campaign

The general guide on how to create links

The V2 Dashboard is pretty straightforward, we tried to make the interface as simple as we could, excluding confusion on each step. \
\
You can also view this video guide for 1155 tokens on Polygon as an example, and read a few notes below, describing some settings that could be complicated to understand.&#x20;

{% embed url="<https://youtu.be/AfnxP7gOdDU>" %}

## Minding the network

All the data that you will see on the further steps will correspond to and validate according to the network of the wallet that you've used to connect to the dashboard. Please make sure that you've connected on desired network. Currently we support Polygon and Mainnet. Read more about networks [here](/linkdrop-dashboard/creating-links-in-bulk/main-guide/before-you-go/supported-networks).&#x20;

## Contract selection (step 1)

On this step you need to give a name to your campaign and select the type of the tokens and the contract (equals to collection for NFTs) that you'd like to distribute. \
\
First, select the correct tab - **NFTs** or **Tokens.** \
\ <mark style="background-color:yellow;">If you have selected NFTs</mark>, you will see a input with dropdown. You can simply click on the dropdown to see a list of collections that you can create the links for (the ones you own) and the quantities of tokens that you own within a particular collection.&#x20;

You can also start typing the contract name directly into the input, this you will start searching through the collections and collections shown in the dropdown will change. \
\
If you cannot find the collection in the dropdown list, you can type in manually. As soon as you will reach the 42 symbols, the collection address in the dropdown will change from grey to black and you will be able to click on it to add. \
\ <mark style="background-color:yellow;">If you have selected Tokens</mark>, you will see an input. You can paste in the contract address of the ERC-20 token that you would like to distribute. In example, if you would like to distribute USDC tokens on Ethereum, the address will be 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48<br>

## Claim pattern

#### Mint or transfer.&#x20;

For *most use cases* you would need to have your NFTs **preminted** and exist on blockchain to use Linkdrop and create links. This way during the claim process, tokens will be transferred from your account to the account of receiver. Such claim pattern is the most basic and used one and is called **"Transfer "**. We recommend it, because it's best fit to create zero-coding experiences.\
\
There is also an option to use **"Mint" pattern.** It is suitable for advances users who can create their NFTs deploying their own contract. This way, your NFTs will not be *pre-minted,* but can be minted *at claim, when user will follow the claim link.*&#x20;

{% hint style="info" %}
Mint pattern is only available for subscription plans.\
To use mint patterm please refer to [Mint pattern requirements](/linkdrop-dashboard/creating-links-in-bulk/main-guide/mint-pattern-requirements) and contact us.
{% endhint %}

## Distribution&#x20;

### Manual or SDK.&#x20;

For all the DIY cases you'd like to choose manual. In case you would like to automate link creation and claiming, integrating Linkdrop into your product, [head to the SDK section to learn more](/linkdrop-dashboard/dashboard-sdk-and-api) about it.

### Gasless claiming&#x20;

One of the great features of Linkdrop is that users could claim NFTs to the empty totally new wallets, because our proxy contract can initiate the transaction and cover gas costs. \
\
We call it "gassless claiming" or sponsorship. If you would prefer your links to be sponsored, you need to checkmark it. In the brackets you'd see the total amoint that will be secured from your wallet to support sponsorship.&#x20;

{% hint style="info" %}
Read important details concerning gasless claiming (sponsorship) [here](/linkdrop-dashboard/creating-links-in-bulk/sponsorship-nuances)
{% endhint %}

## Filling token IDs

### ERC1155 tokens

There is a dropdown that shows all the tokens that you own and their quantities.&#x20;

Select the token in dropdown, click on it and it will be added with **all copies of the token selected**, 1 copy per link,  in example:

<figure><img src="/files/7ZWu3FusjLDfQPQB8rgx" alt=""><figcaption></figcaption></figure>

To change the quantity - press on **Edit** and enter the number of tokens that you'd like to distribute. \
To delete the token from the campaign press the trash bin icon\
\
You can add different tokens with selected quantities within a single campaign.

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

There is also an option to "Select all" - by pressing this button, the dashboard will automatically add all tokens with all available quantities. <mark style="background-color:yellow;">However, please note, that in this case only 100 recently used tokens and their available copies will be added.</mark>

### ERC 721 tokens

There is a dropdown that shows the <mark style="background-color:yellow;">last 100 tokens of the contract</mark> that you own. \
Select the token in dropdown, click on it and it will be added. \
\
There is also an option to "Select all" - by pressing this button, the dashboard will automatically add <mark style="background-color:yellow;">100 recently used tokens.</mark><br>

{% hint style="info" %}
Please contact us at **<hi+docs@linkdrop.io>** if you would like to use more than 100 tokens to upgrade your plan
{% endhint %}

### ERC 20 tokens&#x20;

There are 2 inputs on each line, the first one stands for token amount, the second one for the number links you would like to generate with such amount of tokens\
\
Here is an example:&#x20;

| Token amount | Number of links |
| ------------ | --------------- |
| 0.1          | 10              |

If I use the settings above, I will have total of 10 links generated. Each link will allow to claim 0.1 of selected token.&#x20;

{% hint style="info" %}
To learn more about differences between token types on Ethereum (and EVM-based blockchains), please [read here. ](/linkdrop-dashboard/creating-links-in-bulk/main-guide/before-you-go/token-standards)
{% endhint %}

{% hint style="info" %}
You can also add links uploading a CSV.  \
Please refer to [this guide](/linkdrop-dashboard/creating-links-in-bulk/main-guide/using-csv-to-add-tokens) to use this option
{% endhint %}

### Adding native tokens to each link

It's a misc feature that you can see on the final screen of creating a campaign or a link batch. The entered amount will be included as an **extra to each link** that you create. I can be added to links of any token types (ERC1155,ERC721 or ERC20)\
\
In example, you have created 10 links on Polygon for the ERC721 tokens, and then in the input "MATIC to include" in the end, you enter "0.5". A the campaign launch, you will also be secured an extra 5 MATIC (for 10 links)\
\
When the end user will follow one of the links that you have created, he will receive: \
1 NFT + 0.5 MATIC&#x20;

### Preferred wallet

This setting affects the way the claim application will look for user. In the claim application, when user decides to recevie the token by connecting a wallet, he should press "Connect" button to see all options and a list of wallets he could use. \
\
The wallet that has been selected as **preferred** during link creation, will be shown on the *first place in the app*, and will also have a "recommended" label. \
\
It's a good way to suggest your audience to use specific wallet of your choice for the claim. Some wallets may have better onboarding and you might want to select them as preferred ones, to let your new-to-crypto audience install the one faster and onboard easier. \
\
Please note, that all other claiming options will be still available in the same way, this feature only affects the order.&#x20;


# Mint pattern requirements

You can choose this pattern to allow your users to mint items at claim

{% hint style="info" %}
This option is suitable **for advances users** who can create their NFTs deploying their own contract.  \
\
This way, when you will use the contract that follows the requirements below and select "Mint" pattern when[ setting up a campaign](/linkdrop-dashboard/creating-links-in-bulk/main-guide/setting-up-a-campaign), your NFTs will not be *pre-minted,* but can be *minted at claim, when user will follow the claim link.*
{% endhint %}

## NFT requirements to use mint pattern

In order to be able to use the “mint at claim” pattern the NFT **contract** in addition to standard ERC721/1155 ABIs, contracts should have the functions based on OpenZeppelin Access pattern (<https://wizard.openzeppelin.com/#erc721>).

### **ERC721 Mintable ABI:**

```
interface IERC721Mintable {
  function safeMint(address to) external; // increments token ID for each minted token incrementally starting from 1
  function grantRole(bytes32 role, address account) external;
  function hasRole(bytes32 role, address account) public view returns (bool)
}
```

Please note that `safeMint` function doesn’t have `tokenURI` parameter, so metadata for ERC721 tokens should be uploaded to all tokens in advance and `tokenURI` function should automatically compute metadata URL by concatenating `baseURI` and \`tokenId together.You can see an example ERC721 Mintable Contract implementation here -<https://polygonscan.com/address/0xc5271d9Df75c0FBE241730F2Fbc9e2480359Cf77#code>

### **ERC1155 Mintable ABI:**

```
interface IERC1155Mintable {
 function mintTo(address account, uint256 id, string calldata tokenURI, uint256 amount) external;
 function grantRole(bytes32 role, address account) external;
 function hasRole(bytes32 role, address account) public view returns (bool)
}
```

When claiming ERC1155 token, Linkdrop Escrow contract will call the NFT contract's `mintTo` function and empty string will be passed as  tokenURI. \
Metadata for each token id should be prepared before claim by minting 0 tokens and passing correct tokenURI for that token id. The NFT contract should respect that logic, please refer to the [Thirdweb ERC1155 implementation](https://portal.thirdweb.com/solidity/base-contracts/erc1155base) to learn more.&#x20;

### Please also note

`safeMint` for ERC721 and `mint` for ERC1155 contracts should both respect MINTER\_ROLE, which is computed the following way:\
`bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");`


# Using CSV to add tokens

Instead of adding each token ID manually using the inputs in the interface, you could add IDs by uploading the CSV file Instead.

#### Blank CSV file to use

The blank CSV file that you could fill can be downloaded below:

[ERC1155.csv](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/cf989ed9-2559-429c-b687-d0af9610b083/1155_token_standard.csv)

[ERC721.csv](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/2551d110-1841-4095-a9dc-2d4cb6205443/721_token_standard.csv)

[ERC20.csv](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/77fccc5f-8716-4111-adcc-271ab1946cb4/ERC20_tokens.csv)

The file has one row with titles. **Keep this line**, and add your IDs below.

(titles for ERC1155 token standard)

```jsx
Token ID,Token amount,Links amount
```

(titles for ERC721 token standard)

```jsx
Token ID
```

(titles for ERC20 token standard)

```jsx
Token amount,Links amount
```

#### E**xample of the correctly filled file with IDs**

**For the ERC1155 token IDs**

```jsx
Token ID,Token amount,Links amount
1222, 1, 10
1223, 5, 10
1714, 1, 10
1715, 1, 10
```

Token amount stands for number of 1155 token copies which you would like to include in each link

Link amount is the overall number of links you would like to generate for the particular token ID

So, in the example above, for the token with ID 1223, you will generate 10 links, with 5 copies in each link. Totally 50 copies of this token ID will be distributed.

***

**For the ERC721 token IDs**

```javascript
Token ID
10
20
30
31
32
33
```

For the ERC721 token IDs, simply fill each line of the CSV with the token ID you’d like to include

**For the ERC20 tokens**

```jsx
Token amount,Links amount
0.1, 10
1, 15
```

Token amount stands for the amount of token distributed in each link

Links amount is the overall number of links you would like to generate

So, in the example above, you will generate 10 links with 0.1 token in each link, and 15 links with 1 token in each link. Totally 16 tokens will be distributed in 25 links.

#### Making sure you’ve uploaded the CSV correctly

After uploading the correctly filled CSV, links will appear in the interface the same way as if the were input manually, i.e.:


# Managing a campaign


# Adding batches to campaign

After [creating the the campaign](/linkdrop-dashboard/creating-links-in-bulk/main-guide/setting-up-a-campaign), there is a possibility to add more links to the same campaign. To do that you will need to:&#x20;

1. Find the campaign in Campaigns section
2. Press "Manage"
3. Press "+ Add Batch"
4. On the "Campaign Setup" and "Claim pattern" steps you will see the same info that you've entered at the initial campaign setup, but you cannot edit any information here. You just need to pres Next to reach "Distribution" step.
5. On the "Distribution" step you are able to select new tokens to generate links for. You token contract has been already approved, so you just need to select new IDs and press Continue to go to the final step.&#x20;
6. Select the extra token adding and preferred wallet options on final step and press Launch campaign button to generate new links and add them as a batch to the campaign.&#x20;
7. Once the transaction is mined on the blockchain, you can go back to Campaigns, find your campaign in the list, press Manage and see the added batch in the list with the "Download button next to it"


# Pausing campaign

There is an option to pause your campaign for a while to prevent users from claiming tokens.&#x20;

To pause the campaign:&#x20;

1. Find the campaign in Campaigns section
2. Press "Manage" and enter campaign
3. Press three dots button on the top right corner next to Campaigns title (<img src="/files/Mei5OwCla1cmFNBs6kjF" alt="" data-size="line">)
4. In the dropdown menu select "Pause"
5. Sign transction with your wallet

View video guide here:&#x20;

{% embed url="<https://youtu.be/a7NouksIWPA>" %}

| <p>When the campaign is paused, <br>your users will see the following message on the screen when they follow the claim link: <br><br></p> | ![](/files/vfDqZdD7jNxEuLwD6UQh) |
| ----------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------- |


# Refunding unused tokens

{% hint style="info" %}
Refunding unused tokens is only possible for **sponsored** campaigns that have been **paused**. Please [read more about sponsorship here](/linkdrop-dashboard/creating-links-in-bulk/sponsorship-nuances)
{% endhint %}

\
We secure 0.3 MATIC or 0.02 ETH per link to cover gas on the basic (free) plan. The difference between the actual gas cost per particular link claim and this amount can't be refunded. \
\
You can only refund the amount of tokens secured to cover the gas for the unclaimed links and distributed tokens. \
\
I.e. you have created 10 links on Polygon and secured 0.3\*10 MATIC to our contract at creation. 8 links were claimed by your users. 2 links are unused. You can refund 0.6 MATIC.&#x20;

#### To refund tokens, you need to:&#x20;

1. Pause the campaign, [refer here](/linkdrop-dashboard/creating-links-in-bulk/managing-a-campaign/pausing-campaign)
2. In the same dropdown menu where you've selected "Pause", select "Refund". This button will become active after pausing a campaign.&#x20;
3. Sign the transaction, wait for it to get mined and receive your tokens

{% hint style="warning" %}
If you **refund** the sponsorship tokens and **then unpause** the campaign again, your users will still be able to claim assets in the links. However, they will see the screen that there is not enough tokens to cover the gas and be suggested to pay for the transaction themselves (see screenshot below)
{% endhint %}

| <p><mark style="background-color:yellow;">Here is what your users will see if you'd <strong>unpause</strong> the campaign <strong>after refunding</strong> the sponsorship tokens</mark><br><br></p> | ![](/files/h60vZFsf5U3fKqqmVKqA) |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------- |


# All distribution options

Here you can find the ways you can distribute tokens with Linkdrop

As a result of generating claimable links, you can download a CSV that contains the following columns:&#x20;

* **Claim codes**
* **Claim links**

You could use them with the following options of sharing claim experience to your users:

### 1. **Share claim codes and the link to the claim application** **-** [**claim.linkdrop.io**](https://claim.linkdrop.io)**.**&#x20;

When users will open the page, they will see the input where they need to enter the claim code. If the code is correct, the code is correct, the Continue button will become active and they could go next to claiming the particular NFT that's related to the code<br>

<figure><img src="/files/7sLbLHSBet6KxQZouJz5" alt=""><figcaption></figcaption></figure>

### 2. **Share full links from the CSV file.**&#x20;

The full link will lead user straight to claiming  claiming the particular NFT that's related to the link&#x20;

<figure><img src="/files/5Lq9AhL5BP69lnByi37k" alt=""><figcaption></figcaption></figure>

### 3. **Share individual QR codes.**&#x20;

You will need to [generate QR codes and connect them](/linkdrop-dashboard/creating-links-in-bulk/individual-qr-codes/viewing-and-generating-qrs) to your claim links. The *connected* QR codes lead straight to claiming the particular NFT that's related to the link, the same way as the full link.&#x20;

<figure><img src="/files/QATsXSeoZkoF4Jf15Hvm" alt=""><figcaption><p>Each QR is unique and leads to claiming a particular token</p></figcaption></figure>

{% hint style="info" %}
Linkdrop QR proxy allows you to generate QRs and start using them before having any NFTs and claim links that you'd like to use that QRs with. \
\
This helps to split the process, and connect the claim links to QRs when everything is ready to go.  \
\
When QRs lead to claim links we call them ***connected**.* \
When QR is newly generated and does not point to any claim link, we call in ***unconnected***. \
\
Learn more about connecting QRs to claim links [here](broken://pages/euS39f4naQgFOcBZKWJK)
{% endhint %}

{% hint style="info" %}
All the distribution types do not exclude each other, so you could use multiple ways of distribution at the same time, letting your user choose the most convenient way for him.&#x20;
{% endhint %}

#### **3.1. Proxy links from QR sets**

Technically, it's not a separate option, but we want you to know how you could use it, because it adds extra flexibility to running a campaign with Linkdrop.&#x20;

You could use QR manager to generate QR sets. Inside the the particular QRs set, there is always an option not just to download QRs as images, but also "Download (as CSV)" \
\
If you press it, you will download a CSV with links that point to proxy. These are the links that the QRs include. You could distribute these links to your users instead of distributing *full links* if you need the *proxy functionality.*

{% hint style="info" %}
By **proxy functionality** we mean that you can distribute these proxy links right away and take time to prepare the NFT collection and connect it to your links later. Meanwhile, these links will lead to an info web page saying "QR not mapped"
{% endhint %}

### 4. **Multi-scannable QR code.**

With this feature you can distribute your tokens using just one multi-scannable QR code. You can share this QR to your users and let them scan it, the [Dispenser Application](/linkdrop-dashboard/creating-links-in-bulk/multi-scannable-qr-code) will dispense a new asset to user.&#x20;

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

\
It's particularly useful for conferences and some public events where you would like to share some commemorative stuff or onboard user to your app. &#x20;

Learn more how to create a multi-scannable QR code [here](/linkdrop-dashboard/creating-links-in-bulk/multi-scannable-qr-code)

{% hint style="info" %}
Scans are limited by wallets and browsers, however as it's a public way to share assets, a motivated user will be able to overcome these restrictions and claim more than one asset.&#x20;
{% endhint %}


# Individual QR codes


# Viewing and generating QRs

Please view this guide for a general instruction on how to generate QR codes

{% embed url="<https://youtu.be/6aJYXZhAtXE>" %}

Below you could find details that could be confusing:&#x20;

### Reading the list of created QR sets

#### Claim links column shows the connection status of QR codes:

**"Not uploaded"** means that QRs (and the proxy links that they're generated from) were not connected to the claim links. Such QRs should be considered as a container for future claim links, while the links were not yet added. QRs will lead to the page stating "QRs not mapped"\
\
"**Uploaded"** means that QRs (and the proxy links that they're generated from) were successfully connected to the claim links. If you scan such a QR code - you will open the claim application and can start the claiming process.&#x20;

#### Status column shows the status of the QR codes

The status could be manually set using the dropdown on the particular QR set page. \
\
Status mainly serves as a note for you to distinguish different QR sets, and does not affect any logic, except the fact that once you select "Sent to printer" and further statuses, you will not be able to change the amount of QRs in a set (the button will be deactivated. \
\
You could still select the status back to do it though.&#x20;

### Downloading QRs&#x20;

#### Downloading as images.

Press Download button, select the desired size. Size refers to the possible printing output with minimal loss in quality, that means if you select 2 inch, you should be able to print such QRs in a good quality in a actual size not larger than 2 inches. \
\
Maximum size is limited by 5 inches.

#### Downloading as proxy links in CSV

Press Download as CSV to download a file with a list of proxy links instead the QR code images. These are the links that we turn to QR codes when you select to download QRs as images. They could be used for distribution themselves. [See Distribution for more details ](/linkdrop-dashboard/creating-links-in-bulk/all-distribution-options)

Connecting QR codes&#x20;

<br>


# Connecting QRs to claim links

The QRs that you create, are **by default not connected** to any claim links. \
\
So, such QRs should be considered as a container for future claim links, while the links were not yet added. Such QRs will lead to the page stating "QRs not mapped". \
\
**Connecting QRs** (or the proxy links that they're generated from) allows you to switch them to point to the actual claim links. Once your QRs are connected, by scanning them - you will have the claim application opened and can start the claiming process.

{% hint style="info" %}
Such flow enables you to generate a batch of QRs quickly to start arranging their physical printing and distribution. Meanwhile, you can work on the NFT collection, and when you're ready - create claim links and connect them
{% endhint %}

#### To connect QRs to claim links you will need to:

* *Prerequisites:* create the Campaign, and download the CSV file with links. The quantity of links in the CSV file should be equal to the number of QRs you want to connect them to&#x20;
* Press the "Upload file" button in the "Connect to claim links" section. Select the file and press "Upload" on the pop-up screen. If you have uploaded the file in the incorrect format, you will see an alert "Invalid file. File should be downloaded from campaigns page"

{% hint style="info" %}
Once the QRs are connected, you will no longer be able to change the QR quantity in a set. Users who have those QRs can start claiming tokens.&#x20;
{% endhint %}

\
\ <br>


# Multi-scannable QR code

Guide on creating a Dispenser App, loading it with claim links and sharing in a multi-scannable QR code

A multi-scannable QR code allows you to distribute tokens using just one multi-scannable QR code.

<figure><img src="/files/695rDJKypLxDNuVdedwu" alt=""><figcaption></figcaption></figure>

To create such a QR you need first to deploy a Dispenser App. This could be done using our Dashboard and takes less than a minute.  Please follow the guide below:&#x20;

1. Go to the Dispenser App tab in the side menu
2. Press "Create New"&#x20;
3. Fill in all the required info:
   * **Title** - give you app a name, it will not be seen to users, but will make it easier for you to identify in among other apps in future
   * **Start date and time** - enter the day and time your dispenser will start working, before that user will see a note that the campaign is not active yet. Please note that time is set up in **UTC+0**
   * **Duration** - how many minutes will users be able to claim an asset from your QR code, after that time the app will be deactivated and users will see a note that campaign is over.&#x20;
4. Press Create
5. Now you can see a link to your dispenser app and a button Download PNG - that will download it as a multi-scannable QR code. You can already share it, but the app will not work and it's not loaded with claim links yet
6. Create claim links (use[ this guide](/linkdrop-dashboard/creating-links-in-bulk/main-guide/setting-up-a-campaign) as a reference)
7. Return back to you Dispenser App, in the section "Connect to claim links" on the right side press **Upload file**, select a CSV file with you Claim Links that you've dowloaded on the final step of creating the claim links. Press Upload.&#x20;
8. Now you will see the status of the Dispenser changed to Ready. Once you'd approach to the start time, it will change to active and your users will be able to start claiming your assets!&#x20;

{% hint style="info" %}
**Misc**: in the right corner you can also see a button with three dots, by pressing it, in the dropdown menu you can select edit to edit and update the campaign settings set up in #3
{% endhint %}

### Adding more links to Dispenser

You can load more links to the existing Dispenser by pressing **Upload file** button once again and uploading a new CSV.  Links from the new CSV file will be added to the ones that were uploaded before. You will see the Statistics block update the "Total links" number.

### Redirecting

There is an option to redirect to a new Dispenser or any other web link. It is  particularly useful if you want to continue distributing tokens once your dispenser is expired (has "finished" status) or if you would like to land users to some web page after your token distribution is over.&#x20;

<figure><img src="/files/y5L0v793QlVM3XIgVucD" alt="" width="563"><figcaption></figcaption></figure>

To enable redirecting, you need to turn the corresponding toggle button on, add and confirm the redirect link.

### Statistics

There is a block sharing main statistics of your Dispenser:

* Total links - total links loaded in the dispenser
* Scanned - links scanned by users
* Links left - links left in the dispenser (undistributed)
* Claimed - token claims using dispensed links\
  \
  You can also press **"Download report"** to download the detailed list of the token claims using your particular Dispenser.


# Using Testnets

If you want to check the whole process of creating claim links, codes or QRs and claiming them with Linkdrop in test mode before using production networks, there is a possibility to do that at <https://testnets.linkdrop.io/>. \
\
Our test dashboard works on Goerli network.&#x20;


# Sponsorship nuances

Sponsorship allows you to pay gas for the transaction instead of user, that enables a better conversion to claim because receiving the token becomes totally free for end user.&#x20;

To enable sponsorship, you should select this option when [setting up a campaign](/linkdrop-dashboard/creating-links-in-bulk/main-guide/setting-up-a-campaign). The fixed amount per link will be secured from your wallet to cover gas. \
\
Usually it's 0.3 MATIC or 0.02 ETH depending on the network, but that amount can change dynamically because of the state of the network, so you could see the exact amount in the summary when creating links. \
\
Below are a few specific cases related to sponsorship that we want you to know about

#### Sponsoring only works for the gas price below 150 gwei

As the amount that you secure to sponsor each link is fixed, we can only provide sponsoring the transactions when gas price is below 150 gwei. <br>

| <p>If the price is more than that (usually happens when there are some price surges caused by some popular drop or other extraordinary market activity) the user will see a special warning, suggesting him to wait until the price will go back down, or to cover the gas himself. <br><br>When the user decides to cover gas himself, he will need to initiate the transaction and pay for it as if it was not a sponsored one<br></p> | ![](/files/Fseu7cpNuWUAz78pKd8h) |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------- |

#### Unused tokens secured for sponsorship can be refunded

If some of the links were not claimed and you want to stop the campaign, you can refund the assets secured for those unclaimed links. For more details on how to do that please refer [here](/linkdrop-dashboard/creating-links-in-bulk/managing-a-campaign/refunding-unused-tokens)


# Use cases


# Add NFTs to your physical products

<figure><img src="https://cdn-images-1.medium.com/max/1600/1*o17xoNXstV895wVZoQcd7g.png" alt=""><figcaption></figcaption></figure>

1. **Create a QR set** in QR manager
2. **Download those QRs and send them to print**, and then include them to your physical product. So, at this step QR code will not be connected to the NFT, but it could be already printed and connected on the next step.
3. Create a Campaign and **generate Claimable links** within it.
4. Go back to the QR manager, **connect Claimable Links to QRs**.

Now when users unpack your product, they can scan QR and follow to the Claim app to **claim your NFT** (see Claiming your NFT below).


# Distribute NFTs in emails.

<figure><img src="https://cdn-images-1.medium.com/max/1600/1*935LdK7C0er02FGfEMjw8Q.png" alt=""><figcaption></figcaption></figure>

1. Create a Campaign and **generate Claimable links and codes** within it.&#x20;
2. Download the CSV file. The links where users can claim, will look like claim.linkdrop.io/redeem/FGC5XX1D, the FGC5XX1D — is the claim code
3. Distribute the links themselves in emails or send the start page link claim.linkdrop.io/redeem and claim codes (such as FGC5XX1D) separately.&#x20;
4. If the user follows the full claim link — they will be forwarded straight to claim. If they go to the start page link (claim.linkdrop.io/redeem), they see a page with input where they need to enter the code to get forwarded to claim


# Distribute NFTs with your logic

<figure><img src="https://cdn-images-1.medium.com/max/1600/1*7WFOzRrqBemyYuwDg5nP9g.png" alt=""><figcaption></figcaption></figure>

We have updated the **SDK in Linkdrop V2** to work smooth and in connection with the Dashboard, and you could easily use it to:&#x20;

* Trigger claim link generation when you need it
* Trigger link claim when you need it

**How to use SDK:**&#x20;

1. Create a Campaign and on the Distribution step select SDK
2. Set up the Campaign following the steps on the Dashboard, and launch it.&#x20;
3. The final screen will have all the keys that you need
4. Head to the SDK Documentation to read how to install the SDK and check out all the available SDK methods. If you’ve installed any other SDKs, it should not take more than 5 minutes. Use the keys that have been generated on the Dashboard.

You can always open your campaign on the Dashboard to check out the keys, and in addition to that, all the link batches and links generated with the SDK will be available for the manual download there as CSVs.

> Integrate Linkdrop to your product: build complicated experiences that lead to claim link generation, and then allow your users to claim NFTs whenever you need it. It’s a whole new universe of creativity that we open for you


# Run NFT based referral invite campaigns

Bring new audience to your product and control its growth

We’ve built the new flow, originally for Zerion, and now available for anyone by request. \
\
The main idea is that you provide your users with invite links that are Linkdrop claim links that allow them to claim NFTs, and then these users:&#x20;

* receive some perks or access from you product based on token-gated mechanics
* get their own invites they could share, engaging new users&#x20;

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

Prerequisites for you to build such ccampaign are the following:&#x20;

* You have a whitelist of addresses to start the invite campaign
* You have the NFTs that could be used with Linkdrop Dashboard (mostly any standard contract or the custom one that support [mint pattern](/linkdrop-dashboard/creating-links-in-bulk/main-guide/mint-pattern-requirements) if that's the case)
* You can build some token-gated experience on your own, granting users any kind of perks

\
If everything above fits your case, then the following steps would be needed to run the campaign:&#x20;

1. You **generate Claim Links via Linkdrop Dashboard,** collect a whitelist of addresses, manually drop those two files to us as CSVs
2. You **use our**[ **Invite API** ](https://gist.github.com/eektheeek/34a0a345d9b7dd9f696ac74eb4c021e3)**to retrieve Claim Links** and display them in your interface, along with the claim statuses, i.e. 3 invites per address
3. **Every address who claims the NFT also gets his own 3 (or N) invites**, enabling the exponential growth of participants. This does not require any actions on your end, as we track the claims and add new users to the whitelise utilizing the hook that we've built.&#x20;
4. NFT owner connects to your platform and grabs his perk, in case of Zerion it was Extension access (not built by Linkdrop).

The Dashboard no-code interface for this feature is currently in progress and going to be live in the upcoming months, but we have already built this flow for a few clients and can easily support it by request&#x20;

{% hint style="info" %}
[ *<mark style="color:green;">**Contact us**</mark>*](https://www.linkdrop.io/contact-us) <mark style="color:green;">**to build an effective and engaging invite campaign!**</mark>&#x20;
{% endhint %}


# Claim application

View all claim options

There are 3 basic ways the user can receive a token using Linkdrop:&#x20;

1. Full link with code. This ways all you need to claim is just to connect your wallet or claim by entering you address or ENS name (if the link was sponsored, learn more about sponsoring links **here)**
2. Short, or entry link. This link will lead you to the correct campaign, but will lack the claim code to receive the NFT. In this case, you should have also received the claim code somewhere (i.e. in email from campaign creator). You'd need to enter the claim code and then you'll get forwarded to the full link.<br>


# Claiming with wallet

Options to claim your NFT or ERC 20 token

You could claim an NFT using the wallet dApp browser, and use Metamask for this case, or use Walletconnect to select the wallet of your choice. \
\
Please select the preferred way to view detailed guide.&#x20;


# Using Metamask

If you’d like to claim using MetaMask wallet

To claim your asset with Linkdrop, please follow the instructions below:

1. Open the link that you’ve been provided (or scan the QR if you got a QR)
2. Wait for the NFT preview to load and click “Claim NFT” button
3. You will see the wallet selection screen
   * Click Use Metamask (a default option)
4. You will see an alert “Open in “MetaMask”? ”, press “Open” —> you will be forwarded to the to the dApp browser in MetaMask, wait for the dApp to load, you will see the NFT preview and Claim NFT button again
5. Press “Claim NFT”
   * If your wallet was set to the network that does not appear to be the same network as the NFT that you are about to claim (i.e. wallet set to Mainnet, NFT is on Polygon), you will get a prompt, such as “To get an NFT you need to add Polygon network”
     * Press “Add Polygon” button
     * You will get a prompt from MetaMask “This site would like to switch the network”, press “Switch Network”
     * Wait for the dApp to load
     * Press “Claim NFT” once again
   * If you were on the same network as the claimable NFT (i.e. wallet set to Polygon, NFT is on Polygon too), you will not need this step, and will appear on step 6 right away
6. You will see “Transaction is processing” screen with loader. You are almost there. Just wait for the blockchain to mine the transaction
   * press “See details on Explorer” to switch to the web page showing the status of transaction on block explorer
7. When the transaction would be successfully mined, you will see the NFT preview with the text “You claimed NFT” + the button “View token on OpenSea” to check your NFT on OpenSea.

   * You are all set now, proudly owning a new NFT!


# Other (Walletconnect)

If you’d like to claim with other wallets

To claim your asset with Linkdrop, please follow the instructions below:

1. Open the link that you’ve been provided (or scan the QR if you got a QR)
2. Wait for the NFT preview to load and click “Claim NFT” button
3. You will see the wallet selection screen
   * Click “Have another wallet”
   * Сlick WalletConnect icon (first in the row)
   * You will see the icon of MetaMask changed to WalletConnect in the center of the screen
   * Click “Connect”, WalletConnect pop-up with wallet selection will appear
   * Select wallet of your choice
4. You will be forwarded to the wallet, requesting connection
5. Press “Connect”, you will be forwarded back to the browser, wait for the dApp to load, you will see the NFT preview and Claim NFT button again
6. Press “Claim NFT”
   * If your wallet was set to the network that does not appear to be the same network as the NFT that you are about to claim (i.e. wallet set to Mainnet, NFT is on Polygon), you will get a prompt, such as “To get an NFT you need to add Polygon network”
     * Press “Add Polygon” button
     * You will be forwarded to a wallet and get a prompt suggesting to switch network, approve that by pressing the correct button in your chosen wallet
     * The network should be changed and you will be forwarded back to the browser, wait for the dApp to load, you will see the NFT preview and Claim NFT button again
     * Press “Claim NFT” once again
   * If you were on the same network as the claimable NFT (i.e. wallet set to Polygon, NFT is on Polygon too), you will not need this step, and will appear on step 7 right away
7. You will see “Transaction is processing” screen with loader. You are almost there. Just wait for the blockchain to mine the transaction
   * press “See details on Explorer” to switch to the web page showing the status of transaction on block explorer
8. When the transaction would be successfully mined, you will see the NFT preview with the text “You claimed NFT” + the button “View token on OpenSea” to check your NFT on OpenSea.
   * You are all set now, proudly owning a new NFT!


# Claiming by ENS or address

Simplified claim process for advanced users

Claiming with ENS of 0x address is only available for the campaigns that were sponsored by creator. Read more about sponsored campaigns [here](/linkdrop-dashboard/creating-links-in-bulk/main-guide/setting-up-a-campaign)\
\
In "Show more options" on the screen that you will see after pressing "Connect", you can choose "Enter ENS or address". \
\
Then you'd see an input, where you could enter the ENS or 0x address. After pressing claim on this step, the transaction will be initiated. &#x20;

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

{% hint style="info" %} <mark style="background-color:green;">You can only use</mark> <mark style="background-color:green;"></mark><mark style="background-color:green;">**ENS or Address claim**</mark> <mark style="background-color:green;"></mark><mark style="background-color:green;">for links that have been</mark> <mark style="background-color:green;"></mark><mark style="background-color:green;">**sponsored**</mark>.\
\
&#x20;If the link is unsponsored, the user will *not* see this as an option on the connection screen (at the start of the flow)
{% endhint %}


# Troubleshooting

Each error that you will see in the claim should refer to a particular problem, please check our the table below to undestand what may happened:&#x20;

| Title                        | Expected error                                                                                                                                                                                                                |
| ---------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Wrong request                | Incorrect code parameter. Please recheck the code and try again                                                                                                                                                               |
| Asset does not exist         | Code not found in database. Either the code (and claim link) does not exist or you are mistyping it                                                                                                                           |
| QR not mapped                | Link not connected to that code in database. You are opening the unconnected QR, [connect QRs](/linkdrop-dashboard/creating-links-in-bulk/individual-qr-codes/connecting-qrs-to-claim-links) when you're ready and try again. |
| Couldn't get data            | Server not responding. Contact support at <hi+support@linkdrop.io> or try again later.                                                                                                                                        |
| Seems you're offline         | Network error (offline)                                                                                                                                                                                                       |
| QR Server error              | Server error. Contact support at <hi+support@linkdrop.io> or try again later.                                                                                                                                                 |
| Couldn't reach server        | Server not responding. Contact support at <hi+support@linkdrop.io> or try again later.                                                                                                                                        |
| Claim server error           | Server error. Contact support at <hi+support@linkdrop.io> or try again later.                                                                                                                                                 |
| Transaction failed           | Claim transaction failed.                                                                                                                                                                                                     |
| Link has expired             | Expired link. The campaign is no longer available, contact sender.                                                                                                                                                            |
| Link deactivated             | Link has been deactivated. Link is no longer available, contact sender.                                                                                                                                                       |
| Campaign is paused           | Campaign is paused. Claim is temporary unavailable, contact sender.                                                                                                                                                           |
| Campaign is over             | Campaign is over (expired). The campaign is no longer available, contact sender.                                                                                                                                              |
| All tokens have been claimed | All NFTs/ERC20s claimed (no tokens left), contact sender.                                                                                                                                                                     |
| Cannot sponsor claim         | Not sponsorship MATIC or ETH left on the contract to sponsor transaction, contact sender or pay for gas yourself                                                                                                              |
| Gas price too high           | Gas price is higher than the standard limit set for transaction (busy network). Wait or or pay for gas yourself. For more details refer [here](/linkdrop-dashboard/creating-links-in-bulk/sponsorship-nuances)                |


# Dashboard SDK & API


# Keys and installation

#### Supported networks

Currently, Linkdrop supports the following networks:

* Ethereum Mainnet
* Polygon Mainnet

Testnets:

* Goerli (Ethereum testnet)
* Mumbai (Polygon testnet)

We can add support of any EVM-based chain by request. Please contact us If you need to use Linkdrop on other networks.

#### Getting Started

To start using the SDK you will first need to[ create a campaign](/linkdrop-dashboard/creating-links-in-bulk/main-guide/setting-up-a-campaign), with specific settings on the Distribution tab:&#x20;

1. Set up the "Distribution" to SDK.<br>
2. If you select to "Sponsor claim transactions" in Transaction sponsorship, you will see one more appear below - **"Specify number of NFTs"**. \
   \ <mark style="background-color:yellow;">You should enter the  amount of tokens that you would like to distribute with SDK for us to initially secure the tokens needed for sponsorship. You can enter the approximate amount of tokens here.</mark>\
   \ <mark style="background-color:yellow;">Don't worry you will then be able to manually send the sponsorship tokens to the contract if you would like to generate more links with SDK or refund the unused tokens (see</mark> [Refunding unused tokens](/linkdrop-dashboard/creating-links-in-bulk/managing-a-campaign/refunding-unused-tokens))<br>
3. Сontinue to the final step and launch campaign
4. On the final screen you will see the "Campaign parameters" section. This is the sensitive data and you should not share it publicly.&#x20;
5. Press on the eye icon to see your <mark style="background-color:orange;">signing key</mark> and <mark style="background-color:orange;">encryption key</mark>.

#### Install the SDK to your project using Terminal&#x20;

```
yarn add linkdrop-sdk
```

#### Initializing SDK

First, import SDK into your code:

```
import LinkdropSDK from 'linkdrop-sdk'
// or
// const LinkdropSDK = require('linkdrop-sdk').default
```

To use SDK on a testnet:

```
// initializing Linkdrop SDK on a testnet (Goerli or Mumbai)
const sdk = new LinkdropSDK({ mode: 'testnets' });
```

To use SDK on a production network (Ethereum Mainnet or Polygon):

```
// initializing Linkdrop SDK on a production network 
const sdk = new LinkdropSDK({
  claimHostUrl: 'https://claim.linkdrop.io/'
});
```

*claimHostUrl: '<https://claim.linkdrop.io/>'* is our default public claim host. If you are using business or enterprize plans and have received the customized claim application, you should enter its host instead of *<https://claim.linkdrop.io/>* if you intend to use SDK

{% hint style="info" %}
You can also find all SDK methods here: <https://github.com/LinkdropHQ/linkdrop-sdk>
{% endhint %}


# Create & manage campaigns

{% hint style="warning" %} <mark style="color:orange;">**IMPORTANT! FOR BACK-END USE ONLY!**</mark> Managing campaigns requires secret keys that should never be exposed to public. Use campaign methods on a back-end and never within a front-end app.
{% endhint %}

### Basic concepts

There are few basic concepts that you should be aware to generate claim links with Linkdrop SDK

***Links*** are stored in ***batches***, which are themselves a part of the ***campaigns***. Campaign can have several batches, and you can also add more links into different batches within the campaign.

1. You should first create a campaign using Dashboard, see [Keys and installation](/linkdrop-dashboard/dashboard-sdk-and-api/keys-and-installation), and save your **campaignId**, **signerKey** and **encryptionKey**
2. Get a campaign by using **campaignId**, **signerKey** and **encryptionKey**
3. **Create a new batch.** You will also see in the Dashboard and be able to download links in CSV there
4. Use **batch.addLinks** to add more links to a batch&#x20;

### Managing Campaigns

{% hint style="warning" %} <mark style="color:orange;">**IMPORTANT! FOR BACK-END USE ONLY!**</mark> Managing campaigns requires secret keys that should never be exposed to public. Use campaign methods on a back-end and never within a front-end app.
{% endhint %}

After you have created a campaign using Linkdrop Dashboard, you can use SDK to manage the campaign. Using SDK you can:

* fetch campaign data
* create a new batch of claim links
* add claim links to an existing batch
* fetch created claim links
* activate or deactivate links

**Getting Campaign**

To be able to do all that, first you need to fetch initialize campaign object

```
const campaign = await sdk.getCampaign(
  campaignId: string,
  signerKey: string,
  encryptionKey: string
)
```

Get all params from the campaign page on Dashboard:

* `campaignId`: ID of the campaign that you want to retrieve information about.
* `signerKey`: private key used to create claim links. <mark style="background-color:orange;">**(NEVER EXPOSE SIGNER KEY PUBLICLY)**</mark>
* `encryptionKey`: private key used to encode and decode sensitive data stored on server <mark style="background-color:orange;">**(NEVER EXPOSE ENCRYPTION KEY PUBLICLY)**</mark>

{% hint style="warning" %} <mark style="color:orange;">**IMPORTANT! FOR BACK-END USE ONLY!**</mark> Managing campaigns requires secret keys that should never be exposed to public. Use campaign methods on a back-end and never within a front-end app.
{% endhint %}

The returned `campaign` object has campaign data and addtional methods to manage the campaign.

```
console.log(campaign.data)
```

### Creating claim links

**Creating new batch**

To create a batch of claim links for the campaign, use the `campaign.createBatch` method

```
const batch = await campaign.createBatch(
  [{ 
    id: string,
    amount: string,
    links: string,
    weiAmount?: string // optional parameter, The default value is `0`.
  }],
  // optional parameters
  {
    batchDescription: string,
    shortCodeLength: number,
    shortCodeMixRegister: boolean,
    expirationTime: string
  }
)
```

It takes two parameters:

* `linkData`: This is a required array of objects that contain information about the links to be created. Each object in the array must have the following properties:
  * `id`: token ID for ERC721/ERC1155 campaigns. For ERC20 campaigns, id is not provided.
  * `amount`: amount of tokens per link for ERC20/ERC1155 campaigns. For ERC721 campaigns, amount is not provided.
  * `links`: number of links to create.
  * `weiAmount`: amount of network tokens (ETH/MATIC) to be sent to receiver on claim. Campaign contract should have enough network tokens before claim. Top up the campaign contract in advance manually. The default value is `0`.
* `options`: This is an optional object that can contain the following properties:
  * `batchDescription`: This is an optional string property that specifies the description of the batch. The default value is "Created by SDK".
  * `shortCodeLength`: The length of claimCode. The default value is `12`.
  * `shortCodeMixRegister`: Should the claim code contain uppercase and lowercase symbols. The default value is `true`.
  * `expirationTime`: Timestamp for the link expiration date. The default value is `1900000000000`.

The returned `batch` object contains information related to the specified batch and methods to manage it.

**Getting Batches**

To retrieve all batches associated with the campaign, call the `campaign.getBatches` method:

```
const batches = await campaign.getBatches()
```

**Getting Batch**

To manage a batch, first you need to retrieve it by ID:

```
const batch = await campaign.getBatch(
  batchId: string
) 
```

The returned `batch` object contains information related to the specified batch and methods to manage it.

### Batch methods

**Adding Links to an existing batch**

To add claim links to an existing batch, call the `batch.addLinks` method:

```
const links = await batch.addLinks(
  [{ 
    id: string, 
    amount: string, 
    links: string, 
    weiAmount: string // optional parameter, The default value is `0`.
  }], {
    // optional parameters
    shortCodeLength: number,
    shortCodeMixRegister: boolean,
    expirationTime: string
  }
) 
```

&#x20;It takes two parameters and returns an array of link IDs:

1. `links`: An array of link objects that contain the following properties:

* `id`: The token ID (required for ERC721/ERC1155 campaigns).
* `amount`: The amount of tokens per link (required for ERC20/ERC1155 campaigns).
* `links`: The number of links to be created.
* `weiAmount`: The amount of native tokens that should be sent to the proxy contract address manually. The default value is `0`.

2. `options`: This is an optional object that can contain the following properties:

* `shortCodeLength`: The length of claimCode. The default value is `12`.
* `shortCodeMixRegister`: Should the claim code contain uppercase and lowercase symbols. The default value is `true`.
* `expirationTime`: Timestamp for the link expiration date. The default value is `1900000000000`.

**Getting Links**

To fetch all links created for that batch, use the `batch.getLinks` method:

```
const links = await batch.getLinks()
```

### Deactivating / reactivating links

{% hint style="info" %}
Individual link deactivation is only available when using the SDK. If the user will follow the link that has been deactivated, he will see a corresponding message "Link deactivated"
{% endhint %}

**Deactivate Link**

To deactivate link:

```
const success = await campaign.deactivate(
  claimCode: string
)
```

Parameters:

* `claimCode`: The `claimCode` parameter from the claim link URL.

**Reactivate Link**

To reactivatate previosly deactivated link:

```
const success = await campaign.reactivate(
  claimCode: string
) 
```

Parameters:

1. `claimCode`: The `claimCode` parameter from the claim link URL.


# Claim methods

The following methods of SDK can be used both in a back-end and a front-end applications, as they don't require providing sensitive campaign keys to invoke them.

**Redeeming Link**

```
const txHash = await sdk.redeem(
  claimCode: string,
  destination: string
)
```

The `redeem` method is used to redeem a claim link, transferring the specified tokens to the recipient address.

Parameters:

1. `claimCode`: The `claimCode` parameter from the claim link URL.
2. `destination`: The recipient address of the tokens.

The redeem method returns tx hash for the claim transaction.

**Getting Link Params**

To get claim link params via claim code:

```
const linkParams = await sdk.getLinkParams(
  claimCode: string
)
```

To get claim link params via link ID:

```
const linkParams = await sdk.getLinkParams(
  linkId: string
)
```

**Getting Link Status**

To retrieve link status and some other info via claim code:

```
const	{ 
  status,
  recipient,
  linkId,
  txHash,
  claimedAt,
  createdAtBlock,
} = await sdk.getLinkStatus(
  claimCode: string
)
```

You can also retrieve status by link ID as well:

```
const	{ 
  status,
  recipient,
  linkId,
  txHash,
  claimedAt,
  createdAtBlock,
} = await sdk.getLinkStatus(
  linkId: string
)
```

Returns an object with the following properties:

* status: string - The status of the link. Possible values are:
  * `"CREATED"` - The link has been created but has not yet been claimed.
  * `"PENDING"` - The link is waiting for the transaction to be confirmed on the blockchain.
  * `"CLAIMED"` - The link has been successfully claimed.
  * `"FAILED"` - The claim transaction has failed.
  * `"DEACTIVATED"` - The link has been deactivated by the campaign creator.
  * `"EXPIRED"` - The link has expired and can no longer be claimed.
* recipient: string - The Ethereum address to which the tokens have been sent.
* linkId: string - The ID of the link.
* txHash: string - The transaction hash of the claim transaction.
* claimedAt: number - The UNIX timestamp at which the link was claimed.
* createdAtBlock: number - The number of the block in which the link was created.

{% hint style="info" %}
Individual link deactivation is only available when using the SDK. If the user will follow the link that has been deactivated, he will see a corresponding message "Link deactivated"
{% endhint %}


# API

**GET claim-links/:link\_id**

```
Fetches claim links params by link ID. Link ID is derived from the Link Key. 
  Params:
    - link_id - ID of link
  Return:
    - success: boolean, indicating whether the operation was successful
    - data: 
      - creator_address - address of the user created the campaign
      - sponsored - did creator sponsor campaign (boolean)
      - chain_id - chain id
      - campaign_number - a sequential number for each proxy contract generated by client. For every user starts from 1 and sequentially updated (like a counter) for each new user campaign.  
      - token_address - contract address of the token
      - token_standard - token standard type (erc-721, etc.)
      - symbol - token symbol
      - wallet - default wallet application for claim (metamask, etc.)
      - claim_pattern - the way token will be transfered to user (mint or transfer)
      - token_id - token id for the link (always null for ERC20 campaigns)
      - token_amount - amount of tokens for the link (always null for ERC721 campaigns) 
      - sender_signature - signature obtained by signing link id with the signer key (null if the link is not active)
      - proxy_contract_version - proxy contract version    
      - wei_amount - amount of native tokens attached to the link (0 by default)
      - expiration_time - UNIX timestamp corresponding to the latest datetime to claim the link
      - active - boolean, if link can be claimed. 
```

**GET claim-links/:link\_id/status**

```
Gets link's data: status, recipient address, claim transaction hash and when it was claimed.
  Params:
    - link_id - ID of the link
  Return:
    - success: boolean, indicating whether the operation was successful
    - data: 
      - link_id - ID of the link
      - status - claim status of the link, can be one of the following: "CREATED", "PENDING", "CLAIMED", "FAILED", "DEACTIVATED", "EXPIRED" // #TODO add  "CAMPAIGN_PAUSED", "CAMPAIGN_STOPPED"
      - recipient - address of the recipient, present only if status is CLAIMED, PENDING, or FAILED
      - tx_hash - claim transaction hash, present only if status is CLAIMED, PENDING, or FAILED
      - claimed_at_block - block number, when the link was claimed, present only if status is CLAIMED
      - created_at - UNIX timestamp, when the link was created
```

**POST claim-links/:link\_id/claim**

```
Initiates claim transaction on behalf of a receiver.
  Params:
    - link_id - ID of the link
  Body:
    - receiver_address - Ethereum address to redeem the tokens to
    - receiver_signature - ECDSA signature, obtained by reciever by signing the receiver address with the link key. 
  Return:
    - success: boolean, indicating whether the operation was successful
    - data: 
      - tx_hash - claim transaction hash

Errors:
   - If claim link is deactivated, the request returns success: false (422 http code error) - "The claim link is deactivated"
   - If claim link is not sponsored, the request returns success: false (422 http code error) - "The claim link is not sponsored"
```


# P2P SDK

Linkdrop P2P enables token transfers through Linkdrop claim links, which can be created directly within your app

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

Our first partner to integrate this flow is Coinbase Wallet, and it is currently available for testing in the CB Wallet using USDC on Base or Polygon. You can learn more on the dedicated website <https://pay.linkdrop.io/>\
\
You can integrate the same flow into your app using our Linkdrop P2P SDK. It will be publicly available in Q1, 2024. \
\
For more information about integration options, please contact us at **<hi@linkdrop.io>.**\
\
&#x20;


