# Solana Dust Vacuum

Welcome to Solana Dust Vacuum! Our mission is to recycle your dust, freeing validators from storing useless accounts while rewarding users with the sol invested in the account rent.

Our main goal is to free the ever-increasing database that the validators have to store, allowing transactions to run smoothly, and lowering the requirements for new validators, which would ultimately speed up the network.

In the same way that recycling our trash helps the environment, closing old accounts helps the Solana ecosystem while returning the rent allocated. Closing accounts often show a care for the ecosystem and give financial returns, win, win!

## Why do we need a tool like Sol Dust Vacuum?

While is possible to close accounts manually, and is the preferable way to close one or two accounts, the process is time-consuming and requires some technical expertise.

With the actual state of Solana, where so many tokens are hitting the crazy market cap, while many more are sinking like a rock. It's a matter of time until we have our wallets with dozens of useless accounts.&#x20;

This led to Solana having a larger ledger than Ethereum, despite being in beta.&#x20;

Solana Dust Vacuum was born from a personal pain, to help others who are not tech-savvy, help the network, and most importantly reclaim that juicy rent that is allocated on all those accounts.

## The relation between accounts and network speed

The main difference between Solana and Ethereum is that Solana introduced the concept of **Account.** In short, you can think of it as a folder, where you can store some data. This new approach has a lot of advantages, like enabling developers to build amazing projects that wouldn't be possible, and having the speed of Solana while maintaining the transaction fees pretty low.

This approach comes with some drawbacks. For illustration, you can imagine that every time that you trade a new token a new wallet is created just to hold that new token that you have bought.

You can see that this gets big really quickly. To run a Solana validator you need at least 500GB to store just the account information. For comparison to run an Ethereum validator, you need around 400GB to store all the data of the network.

Every time that you send a transaction the validator needs to loop over all those accounts to find your account. More accounts, more time takes to find your account, and this can be the cause for most of your transactions not going through.&#x20;

## Account rent

Those accounts to be activated need to have rent allocated. This rent serves to pay for the allocation of the accounts. Unfortunately, we cannot escape from this rent, and for any new token that we buy, we must allocate this rent. The good news is that this rent is reclaimable at the moment that you close this account.

In the beginning, Solana used to allow us to define a rent period and pay just for that period. Solana also has the option of a rent exception that is the equivalent of 2 years of rent. Now Solana only allows rent exception operations. This is the origin of the value 0.0020392 that we often see in the transactions.

## Product Overview

Solana Dust Vaccum allows for a quick and easy closing process:

* **Close accounts**: uses the Solana Token Program, a standard Solana program, to assemble the burn and close instructions for the selected accounts in the backend. The whole process can be done with a few clicks.
* **Sweep all tokens**: (coming soon) allows you to trade a list of tokens in a single transaction. Useful for tokens that might still have market value. Using the Jupiter API we fetch the best routes for swapping the tokens, assemble the transaction, and send for signature.
* **Close NFTs:** (coming soon) used for burning NFTs and closing the respective account.

By implementing those solutions and facilitating the process of closing accounts, SDV aims to improve the ecosystem and reward users.


# Overview

Closing accounts offloads the validators, which makes the network run smoothly. Users are rewarded in SOL for closing unused accounts.

Closing accounts is a standard functionality of the Solana network, therefore we can leverage the power of the standard programs, more specifically the SPL (Solana Program Library).

The SPL program is a collection of instructions used for creating and managing tokens, both fungibles and NFTs. One of those instructions is the `closeAccount`.

## Closing Solana Accounts

[Closing accounts](https://solana.com/developers/cookbook/accounts/close-account) enables you to reclaim the SOL that was used to open the account but requires deleting of all information in the account.

The process of closing an account is straightforward: generate the instructions using the SPL program; create and sign the transaction using the instructions created;&#x20;

The process is different when the account holds any data. In that case, we need to generate also a burn instruction to empty the account before closing it.

## Rewards

Since the conception of Solana, the devs had in mind this account system. The main reason for the system be called RENT and not TAX is that you just have to pay while you are using it. This incentivizes users to close their accounts, signaling to the network that those accounts are not used anymore and can be freed.

The price of renting an account is relative to the data stored on the account, but for fungible tokens, the usual price is **0.00203928.**

This value doesn't seem much. And in fact is very small. But the fact of it being so low and we barely can feel its impact makes so we never take it into account. But when you look at the number of tokens in your wallet and make the counts you see that you have a saving that you didn't know.

It's not hard to hit the hundreds of tokens in your wallet on Solana. The lower gas fee, the speed, and the developer experience facilitate that.  Just for comparison, 250 tokens cost \~0.5 SOL in rent.


# How it works

Solana Dust Vacuum works by retrieving the user's token accounts, looping through each account, and building a close instruction, on the accounts that still have balance a burn instruction will be added as well. From those instructions, we build the final transaction that is sent to the front end to be signed. It's important to note that aside from the initial request with your public address, this is the sole instance where your wallet becomes involved.

The process have a cost of 0.0003 SOL per account, which is reduced from your profit and bundled together at the end of the transaction. No upfront cost means that you can only gain SOL by using Solana Dust Vacuum.

{% hint style="info" %}
By default, all accounts that hold less than $0.10 will be selected for closing.
{% endhint %}

{% hint style="info" %}
Frozen tokens can't be closed. They aren't shown on Solana  Dust Vacuum to avoid confusion.
{% endhint %}

## Step-by-step

To be more precise, the flow of data is as follows:

* **User connects:** The user lands on our website and connects his wallet. Check out our security session for more information.
* **Request to backend:** SDV issues a request to the backend with your public address, so the back end is able to fetch all accounts related to your wallet.
* **Accounts fetching:** Our back end fetches all of your token accounts. This information is public and we don't need any extra authorization from your side. The list is returned to the user to select the desired tokens to close.
* **User selection: T**he user has the opportunity to remove any token that he wants to keep or add other tokens that weren't previously selected. As default, only tokens worth less than $0.10 will be selected. Frozen tokens cannot be closed and aren't shown to avoid confusion. When happy with the selection the user submits the list of tokens to close.
* **Transaction build:** Our back end receive the list of tokens and build the transactions needed for closing the accounts. The final transactions are returned to the user.
* **User signature:** The user just has to sign the final transaction and it is done. after a couple of seconds, the user should see the new balance.

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


# How to close accounts

To close your accounts head into Solana Dust Vacuum and connect your wallet.

You gonna see a list of your tokens. SDV selects all tokens that are worth less than $0.10, but you are free to add or remove any token that you wish. On the column, Your tokens will be displayed your tokens. The column Tokens to close, as the name suggests will display the tokens that gonna be closed.

When you are happy with your list you can press the **close accounts** button. Our back end will create the transaction for closing all accounts on the list and return it to you.

You gonna be asked to sign a single transaction. Double-check if there is any token that is not supposed to be burned. You are able to see all accounts that had balances and the amount that is being burned. You should see the final amount of SOL that you gonna receive with the transaction, with the fee already deducted. If it is everything as you wish you can confirm the transaction.

After a couple of seconds, you gonna see your balance updated.

The process has a cost of 0.0003 SOL per account, which is reduced from your profit and bundled together at the end of the transaction.&#x20;

That is it. With these few clicks, you can claim your rent back and help the network run smoothly.


# Risks

This section will cover the main risks of using the tool and how we are mitigating them.

We don't have any custom program, and all that our app is really doing is building default functions and sending them for you to sign. We don't handle any sensitive information, therefore we don't have any vulnerable spots.

## Is this a scam?

No, this is not a scam. This website was built by myself, [Alexandre Neto](https://alex-portfolio-alexandrecolauto.vercel.app/), a blockchain freelancer who is a passionate builder. The problem with building by myself is that I don't have large amounts of VC money to burn and make the project look shiny and cool. I barely have the time that I wish to dedicate to the project. After all, I work on this project in my free time.&#x20;

Since I can't make it as professional as I like, the guarantee that I can give is my career. I will leave my LinkedIn below in case anything happens, you can ensure that I will never find any job again in the area.

{% embed url="<https://www.linkedin.com/in/netoalexandre/>" %}

This is not also a 100x promise, nor a source of passive income. It's just a tool to automatize a process. No magic, no tricks.

## Wallet drains

Another big concern is the risk of wallet drain. This attack still has its source cause unknown. But is very likely, according to [investigations](https://figment.io/insights/the-solana-wallet-drain-exploit-what-happened-and-how-to-prevent-it/), that the cause was some kind of chain supply attack, where developers of a library used by Slope Wallet could have injected malicious code into the wallet, leaking private information.&#x20;

\`This is a very real danger, and we should be concerned with the apps that we connect to our wallet.&#x20;

The way that we are mitigating the risk of this issue is to avoid using npm packages at all. The node ecosystem is susceptible to this attack. For this reason, we are using Go Lang in our back end and pure HTML on the front end.&#x20;

By avoiding using the JavaScript libraries we avoid completely the risk of supply chain attack.

{% hint style="info" %}
It's important to mention that is impossible to be risk-free. There are always factors that introduce risks. We can only mitigate the risks and cannot eliminate them completely.
{% endhint %}


# SDK

With hardware wallets in mind, this SDK is designed for easy of use and to allow the user close accounts of multiple wallets at once.

Some of the key features are:

* Claim 0.002 SOL for every account closed.
* No gas fee is charged, wallets with no funds can use the tool.
* Close list of accounts or all accounts of a wallet.
* Close accounts of one or multiple wallets in a single function.
* Receive your rent of all accounts in a single address.
* Close accounts of all wallets in a folder.

Attention! To close a solana account, the account must be empty. Any remaning balance on the accounts will be burned on the closing process. Use the tool with caution, any miss use can lead to lost of funds.

The service has no costs. Sol Dust Vacuum only charges a small percentage on each account closed (0.0003 SOL).

### Quick start

#### install

```
npm install sol-dust-vacuum-sdk
```

```
yarn add sol-dust-vacuum-sdk
```

#### Closing solana accounts from one wallet

```javascript
import { SDV } from 'sol-dust-vacuum-sdk'
import { Keypair } from '@solana/web3.js'
import fs from 'fs'

async function main() {
    // your JSON wallet
    const jsonFile = fs.readFileSync(process.cwd() + "/wallet.json", 'utf8'); 
    const wallet = Keypair.fromSecretKey(new Uint8Array(JSON.parse(jsonFile.toString())));
    // you can specify your wallet path instead
    //const wallet = process.cwd() + "/wallet.json" 

    // Get your API key at https://soldustvacuum.app/sdk/keys
    const sdv = new SDV("YOUR_API_KEY_HERE")  
        
    // List of tokens to close.
    const tokens = ["rSzXH2jd6e6Mdro2MdRWHpRXA8QdZ8638AWi4fopump"]  

    const signature = await sdv.closeAccounts(wallet, tokens)
    console.log(signature)
}
main()

```

#### Use custom RPC endpoint

```javascript
import { SDV } from 'sol-dust-vacuum-sdk'
import { Keypair } from '@solana/web3.js'
import fs from 'fs'

async function main() {
    // your JSON wallet
    const jsonFile = fs.readFileSync(process.cwd() + "/wallet.json", 'utf8'); 
    const wallet = Keypair.fromSecretKey(new Uint8Array(JSON.parse(jsonFile.toString())));
    // you can specify your wallet path instead
    //const wallet = process.cwd() + "/wallet.json" 

    const RPC_URL = "<YOUR_CUSTOM_RPC_ENDPOINT>"

    // Get your API key at https://soldustvacuum.app/sdk/keys
    const sdv = new SDV("YOUR_API_KEY_HERE")  
    // List of tokens to close.
    const tokens = ["rSzXH2jd6e6Mdro2MdRWHpRXA8QdZ8638AWi4fopump"]  

    const signature = await sdv.closeAccounts(wallet, tokens, RPC_URL)
    console.log(signature)
}
main()

```

#### How to receive all funds in one address

```javascript
import { SDV } from 'sol-dust-vacuum-sdk'
import { Keypair } from '@solana/web3.js'
import fs from 'fs'

async function main() {
    // your JSON wallet
    const jsonFile = fs.readFileSync(process.cwd() + "/wallet.json", 'utf8'); 
    const wallet = Keypair.fromSecretKey(new Uint8Array(JSON.parse(jsonFile.toString())));
    // you can specify your wallet path instead
    //const wallet = process.cwd() + "/wallet.json" 

    const RPC_URL = "<YOUR_CUSTOM_RPC_ENDPOINT>"

    const receiver = "DUSTPnALb5327hRCfxQdzHutuxeh88J4EWaT7eqq1PWP"

    // Get your API key at https://soldustvacuum.app/sdk/keys
    const sdv = new SDV("YOUR_API_KEY_HERE")  

    // List of tokens to close.
    const tokens = ["rSzXH2jd6e6Mdro2MdRWHpRXA8QdZ8638AWi4fopump"]  

    const signature = await sdv.closeAccounts(wallet, tokens, RPC_URL, receiver)
    console.log(signature)
}
main()

```

### How to use

#### Closing solana accounts from one wallet

```javascript
import { SDV } from 'sol-dust-vacuum-sdk'
import { Keypair } from '@solana/web3.js'
import fs from 'fs'

async function main() {
    // your JSON wallet
    const jsonFile = fs.readFileSync(process.cwd() + "/wallet.json", 'utf8'); 
    const wallet = Keypair.fromSecretKey(new Uint8Array(JSON.parse(jsonFile.toString())));
    // you can specify your wallet path instead
    //const wallet = process.cwd() + "/wallet.json" 

    // Get your API key at https://soldustvacuum.app/sdk/keys
    const sdv = new SDV("YOUR_API_KEY_HERE")  

    // List of tokens to close.
    const tokens = ["rSzXH2jd6e6Mdro2MdRWHpRXA8QdZ8638AWi4fopump"]  

    const signature = await sdv.closeAccounts(wallet, tokens)
    console.log(signature)
}
main()

```

#### Closing all solana accounts from one wallet

```javascript
import { SDV } from 'sol-dust-vacuum-sdk'
import { Keypair } from '@solana/web3.js'
import fs from 'fs'

async function main() {
    // your JSON wallet
    const jsonFile = fs.readFileSync(process.cwd() + "/wallet.json", 'utf8'); 
    const wallet = Keypair.fromSecretKey(new Uint8Array(JSON.parse(jsonFile.toString())));
    // you can specify your wallet path instead
    //const wallet = process.cwd() + "/wallet.json" 

    // Get your API key at https://soldustvacuum.app/sdk/keys
    const sdv = new SDV("YOUR_API_KEY_HERE")  

    // List of tokens to keep, any other token will be closed.
    const tokensToKeep = ["rSzXH2jd6e6Mdro2MdRWHpRXA8QdZ8638AWi4fopump"]  

    const signature = await sdv.closeAllAccounts(wallet, tokensToKeep)
    console.log(signature)
}
main()

```

#### Closing solana accounts from multiple wallets

```javascript
import { SDV } from 'sol-dust-vacuum-sdk'
import { Keypair } from '@solana/web3.js'
import fs from 'fs'

async function main() {
    // your JSON wallet
    const cwd = process.cwd();
    const jsonFile1 = fs.readFileSync(cwd + "/wallet1.json", 'utf8');
    const wallet1 = Keypair.fromSecretKey(new Uint8Array(JSON.parse(jsonFile1.toString())));
    const jsonFile2 = fs.readFileSync(cwd + "/wallet2.json", 'utf8');
    const wallet2 = Keypair.fromSecretKey(new Uint8Array(JSON.parse(jsonFile2.toString())));
    // you can specify your wallet path instead
    //const wallet1 = cwd + "/wallet1.json" 
    //const wallet2 = cwd + "/wallet2.json" 

    // Get your API key at https://soldustvacuum.app/sdk/keys
    const sdv = new SDV("YOUR_API_KEY_HERE")  
    // List of tokens to close.
    const tokens = ["rSzXH2jd6e6Mdro2MdRWHpRXA8QdZ8638AWi4fopump"]  

    const signature = await sdv.closeAccountsBatch([wallet1, wallet2], tokens)
    console.log(signature)
}
main()

```

#### Closing all solana accounts from multiple wallets

```javascript
import { SDV } from 'sol-dust-vacuum-sdk'
import { Keypair } from '@solana/web3.js'
import fs from 'fs'

async function main() {
    // your JSON wallet
    const cwd = process.cwd();
    const jsonFile1 = fs.readFileSync(cwd + "/wallet1.json", 'utf8');
    const wallet1 = Keypair.fromSecretKey(new Uint8Array(JSON.parse(jsonFile1.toString())));
    const jsonFile2 = fs.readFileSync(cwd + "/wallet2.json", 'utf8');
    const wallet2 = Keypair.fromSecretKey(new Uint8Array(JSON.parse(jsonFile2.toString())));
    // you can specify your wallet path instead
    //const wallet1 = cwd + "/wallet1.json" 
    //const wallet2 = cwd + "/wallet2.json" 

    // Get your API key at https://soldustvacuum.app/sdk/keys
    const sdv = new SDV("YOUR_API_KEY_HERE")  

    // List of tokens to keep, any other token will be closed.
    const tokensToKeep = ["rSzXH2jd6e6Mdro2MdRWHpRXA8QdZ8638AWi4fopump"]  

    // if tokens to keep is not provided all tokens will be selected
    const signature = await sdv.closeAllAccountsBatch([wallet1, wallet2]) 
    //const signature = await sdv.closeAllAccountsBatch([wallet1, wallet2], tokensToKeep) 
    console.log(signature)
}
main()

```

#### Close solana accounts from all wallet in a folder

```javascript
import { SDV } from 'sol-dust-vacuum-sdk'
import { Keypair } from '@solana/web3.js'
import fs from 'fs'

async function main() {
    // will read all json wallets on the folder
    const walletFolder = process.cwd() + "/wallets"  

    // Get your API key at https://soldustvacuum.app/sdk/keys
    const sdv = new SDV("YOUR_API_KEY_HERE")  

    // List of tokens to close.
    const tokens = ["rSzXH2jd6e6Mdro2MdRWHpRXA8QdZ8638AWi4fopump"]  

    const signature = await sdv.closeAccountsFolder(walletFolder, tokens) 
    console.log(signature)
}
main()

```

#### Close all solana accounts from all wallet in a folder

```javascript
import { SDV } from 'sol-dust-vacuum-sdk'
import { Keypair } from '@solana/web3.js'
import fs from 'fs'

async function main() {
    // will read all json wallets on the folder
    const walletFolder = process.cwd() + "/wallets"  

    // Get your API key at https://soldustvacuum.app/sdk/keys
    const sdv = new SDV("YOUR_API_KEY_HERE")  
    // List of tokens to keep, any other token will be closed.
    const tokensToKeep = ["rSzXH2jd6e6Mdro2MdRWHpRXA8QdZ8638AWi4fopump"]  

    // if tokens to keep is not provided all tokens will be selected
    const signature = await sdv.closeAllAccountsFolder(walletFolder) 
    //const signature = await sdv.closeAllAccountsFolder(walletFolder, tokensToKeep) 
    console.log(signature)
}
main()

```


# Referral Program

The referral program allows you to earn 33% of all transactions made using your code. By default, Solana Dust Vacuum charges per account closed, 0.0003 SOL, out of which you will earn 0.0001 SOL. This amount will be directly deposited into your Solana wallet used to create the referral code.

The code is automatically set when the user visit the website using your referral link. No further action is required. After the users visit the website using your referral link, all subsequent claims will use your code automatically, and your share of the fee will be transferred to your wallet automatically.

The code will be used even on subsequent visits via any other URL.


# Team

The Solana Dust Vaccum project was idealized, planned, designed, developed, hosted, tested, published, and sponsored by the army of one man Alexandre Neto

<figure><img src="/files/ubOpxpZJ4xDVZvqqngBs" alt=""><figcaption><p>Me, Alexandre Neto.</p></figcaption></figure>

I'm a full-stack blockchain developer, I have worked professionally for 3 years in the field but I've been a technology lover long before.&#x20;

This project was born out of personal pain and the need for a fast and easy-to-use tool for closing my token accounts.&#x20;

I've put much love, and many hours of my free time into this tool and I hope that it can be useful to you.

If you wanna more information you can check my[ Linked-in.](https://www.linkedin.com/in/netoalexandre/)

Check out my [portfolio](https://alex-portfolio-alexandrecolauto.vercel.app) too.


