nft-contract.png
2022-01-20
By Az
Tip the author

NFTs on Arweave and Ethereum: Best Practices

So, you have an idea for an NFT project and you’ve decided to store it on Arweave. When it comes to storing your NFTs on Arweave, you can choose either a semi-automatic or manual method to get the files uploaded. The method will all depend on which blockchain you want to use to host your creations on.

If you want your NFTs to be available on the Solana network, you could go ahead and use Metaplex and their Candy Machine. You could easily make a minting dApp and get your creations to show up on a Solana NFT marketplace like Solsea using this method. But even though Solana has seen an increase in demand and supply (mostly supply) for NFTs, the fact for the time being remains this – the majority of buyers like their NFTs to live on Ethereum.

Maybe this is because it was the first place where NFTs lived. Or maybe it’s because massive profits were made from people who invested in Ethereum in its early days. 

Whether these people want to spend their tokens on a CryptoPunk or BAYC because of the fact they are considered status symbols, or want to diversify their investment portfolio, or even in some cases tax evade (unfortunately this can be an actual NFT use case for some), Ethereum is the hottest market for NFTs right now. And what better place to store your NFT’s assets and metadata than on Arweave’s permaweb.

When combining the Ethereum Blockchain and the Arweave permaweb, what should you look out for? Well let’s look at the case where you want to do so and all your art has been created off-chain beforehand. 

Creating the art

The way you create your art is entirely up to you. If you are creating “One of One” unique pieces then you simply export your drawing app’s project to an image file (jpg, png etc).

If you are creating generative art containing thousands, maybe even tens of thousands of collectibles, you can use code to programmatically create unique variations of different elements or layers you have created in your drawing app. The code should ensure that no one NFT is the same as another, maintaining uniqueness throughout. Unless your goal is to have multiples of some. 

For this, you could use Ruby with a library like ImageMagick or OilyPNG to script the generation of images given folders of layers. Or, you could use an NFT-specific solution like Hashlips.

You will also need Metadata files. These files are essential to NFTs and without them you cannot make an NFT. The Metadata file contains critical information about your NFT that the Ethereum network will be able to read, including the link to your actual image file. Metadata files are JSON-formatted lists of attributes, like this:

You can see how the NFTs are created to the ERC-721 standard in the Ethereum docs here. You can also browse the OpenSea docs to see more info on what the metadata files will look like and how they will be read by OpenSea.

Once you have your Image and Metadata files, it’s time to get them onto Arweave. 

Using Arweave for NFT storage

Arweave offers permanent storage for your files. On Arweave you can pay once and store your files forever. Getting your files onto Arweave can be really simple by using some of the tools currently available in the ecosystem. 

If you want to get technical and upload everything straight from your machine to Arweave then there are CLIs (Command Line Interfaces) you can use, like arkb. 

If you want a less technical way of doing this you might want to use ArDrive‘s Web App. Note that ArDrive does have a CLI as well.

To do any of this you will need the Arweave native token which is called AR in order to pay the fees, along with a wallet that can hold AR tokens. You can check where to buy AR tokens, in the USA and worldwide, here. When it comes to AR wallets one of the most popular ones right now is ArConnect. 

Ok, let’s dive in to the things to watch out for when using Arweave for your NFTs.

Firstly, once the files are queued for upload to the blockchain and waiting to be mined into a block by the Arweave nodes – the computers running the Arweave core software and storing the data – they initially get thrown into the mempool. 

When it comes to initially uploading your files to Arweave, you have to understand that the files will be initially cached in a pool of non-permanent storage called the mempool. This is only temporary.

Once your files get uploaded to the mempool they will have a certain amount of time to be mined into a block by the nodes on Arweave.

The Arweave nodes mine a block roughly every 2-3 minutes. Each block can contain 1000 transactions. Each transaction that gets thrown in to the mempool will stay queued there for 50 blocks. If it doesn’t get mined within the next 50 blocks it will be dropped. 

So the current time a file temporarily remains in the mempool before being dropped entirely and never being mined at all is roughly 100-150 minutes.

Note that when using certain CLIs and other uploading software, users sometimes have the option to use a multiplier on their fee. Essentially they offer the nodes a higher fee in order to be picked first from the mempool and front-run all other transactions that have a lower fee.

You can double check your file has been mined successfully by using a block explorer like ViewBlock. 

ViewBlock

Once your file has been sent to the mempool, you will receive a transaction ID for that upload. The way you are informed about the transaction ID depends on which software you are using to upload the files.

You can check the transaction status of your file by using the Arweave explorer on ViewBlock. Input your transaction ID into the search bar in the top right corner and you’ll get information back about that transaction. You will see how many confirmations the file has. This is the amount of nodes that have confirmed the block your file lives on. You will also be presented with a link to that file for ease of access. 

Bear in mind that pressing on the link will reveal your file even if it has not been mined yet. The reason for this is because your file has been cached as mentioned above in the mempool. 

You’ll know your file is on the Arweave permaweb once the little icon at the top of the block explorer page turns from a little grey clock to a coloured symbol. There are different symbols depending on what type of transaction you are viewing on ViewBlock, but in the case of file storage you want that symbol to turn into a little stack of orange circles. 

This will happen once your file has at least 15 confirmations. If you see 15 or more confirmations and an orange symbol, you know that your file is now on Arweave. 

Let’s look at another aspect of using Arweave when uploading more than one file.

Bundlers

Using a bundler (like Bundlr Network) surely falls under one of the most important things to do for our use case. If you want to upload more than one file at a time it is in your best interest. 

What a bundler does is what the name suggests. It takes all your files and bundles them up into one transaction. This way either all your files successfully get mined and your NFT project’s mint won’t be corrupted by dropped data. Also, using this method means you will pay only one transaction fee, albeit a higher one. If your files are just a few kb in size (less than 256kb), you will still be charged for a 256kb file. That’s the size upon which the minimum fee is calculated. So if you have thousands of files at 1kb each, most likely the size of our metadata files, it is a no-brainer to use a bundler. Otherwise you will be paying a fee that is 256 times higher than it should be.

And checking all transactions’ status in one go is extremely important in the case of large NFT collections with thousands of files. Checking 10,000 transaction IDs individually to make sure everything was uploaded correctly would be extremely tedious and time consuming.

Read more about bundlers in this Arweave News article.

The smart contract

Once everything has been successfully uploaded to the Arweave network you will then be making your smart contract on Ethereum.

The smart contract will allow people to mint the NFT. Minting involves the creation of a token. This token is the NFT itself. This article of ours describes what an NFT really is, a little bit more in depth than we will right now.

Essentially the token contains info that points to your Metadata file. Then the Metadata file points to your image file.

So you have to tell the Smart Contract where these files exist. You will need the Arweave links to your files. Your smart contract will have to include these links in order for them to be included in the tokens’ information. 

This is where a one really important key piece of information comes in

Making sure the link never dies and is readable by apps and platforms (like the NFT marketplace OpenSea) that currently exist, and ones that will exist in the future. OpenSea states in their documents that in order for their platform to read and display an NFT that exists on Arweave, you need to format your link a certain way. The format they require is “ar://<TXID>” where you would replace the <TXID> part with the (successfully mined) transaction ID of your file. OpenSea formats the “ar://<TXID>” link in the background to be used with a gateway. 

A gateway is essentially a point of access to information stored on the Arweave Network. The most popular gateway right now used by most is “arweave.net”.  The problem here is that if “arweave.net” were to ever shut down, such a link would not work anymore. And the fact that the link is hardcoded into your NFT means that your NFT will no longer work either (Oh, hi there 404 error).

However, OpenSea has been known to be a little picky when it comes to Arweave links, and sometimes it is best to serve it a full link that includes the gateway. So we now have a dilemma. To use a link without the gateway in the format of “ar://<TXID>” that will be future proof, or to use one that includes the gateway, that currently works nicely with OpenSea, in the format of “arweave.net/<TXID>”?

You could overcome this dilemma by adding a switch into your smart contract that could change between the two. Here is an example of such a switch in the ERC-721 based Smart Contract of the “Mr Tulip’s Interplanetary Solar System Fiesta” NFT collection (Disclaimer: This collection is my own):

 

 

Or you could even add a function to your smart contract that would allow you to change the link as and when you please. 

The slight issue that comes up with using the latter method is that it is completely in your power to add a random link that points to nowhere. Now, you may not even have considered doing something like this – after all this would mean your NFTs would be rendered unusable – but the buyer does not know what your future intentions might be. Unfortunately the buyer most likely doesn’t even know you. So the issue of them trusting a stranger with their purchased asset arises. 

So using a switch might be best in this case. It is most likely that any future marketplace that comes along will also re-format an “ar://<TXID>” link to use a working gateway. 

What are the options?

Arweave is a place to store your NFTs for life, and then some. Ethereum is where the big NFT players are at right now. Combining them might just be the winning formula. However let’s not forget, Solana saw an increase in NFTs in 2021 shortly after the popularity surge of them on the Ethereum Network. Note that Solana backs its entire ledger to Arweave.

We are also seeing a lot of NFTs created on Polygon, ImmutableX and Enjin. Enjin have even created Efinity that aims to be a big NFT and Metaverse player. But we can’t talk about NFTs and Arweave without mentioning Atomic NFTs.

Atomic NFTs aim to be the all-in-one solution for NFTs on Arweave. If you want your smart contract and all your NFT assets to live in one place – on Arweave – look no further than Atomic NFTs. 

If people want their NFT assets to be permanent, and those NFT assets will be used in the Metaverse, and the Metaverse might also live on Arweave, maybe Atomic NFTs will provide the game changing future of both…


Join our
Telegram / Discord / Twitter

In NFTs
Tagged with In No tags

Az

Author and blockchain enthusiast.

Sign up for newsletter

Sign up here to get the latest news and updates delivered directly to your inbox.