A Platform-Agnostic ERC-1155 NFT Contract for Artists

An exercise in throttling the potential of an exciting protocol to do just what I wanted

kevin abosch
3 min readJan 4, 2021

--

My first non-fungible tokens, NFT’s $YLAMBO & $MDAV, created March 15, 2018 & March 27, 2018 respectively, were each unique works represented by indivisible ERC-20 tokens. Almost three years later the NFT landscape for artists is robust with numerous platforms dedicated to the management and marketing/sales of NFT artworks and collectibles (SuperRare, OpenSea, Rarible, KnownOrigin, Portion, Enjin, etc). Thousands of artists across the globe have chosen to present their work in NFT form. For artists who might be looking for a platform-agnostic option (your NFT not tied inextricably to a particular platform) and to save a bit of money on ETH gas when transferring multiple tokens, my approach might appeal to you.

A recent project led me to consider how I would produce an edition of NFT artworks today and I was faced with the decision of which protocol to use, the de facto NFT protocol ERC-721, or the newer kid on the block, ERC-1155. The latter’s development, which I have followed for the past couple years, seemed more elegant and with greater functionality. But upon its recent progression to final status (congrats to: Witek Radomski, CTO of Enjin), many of the popular NFT platforms and crypto-wallets have yet to integrate the protocol (this will change very soon).

For the gaming industry in particular, ERC-1155’s ability to mint both fungible and non-fungible tokens in a single contract is truly exciting, but for an artist interested in NFT’s, the ability to mint fungible tokens is of little consequence. For me, ERC-1155’s “killer feature” is the ability to batch transfer (safeBatchTransferFrom) any number of tokens to an address as if it were one token. There are cases when this can save a lot of time and money — for example, let’s say I want to send 20 NFT artworks to a gallery that in turn will sell and transfer the works to their clients, the ability to batch transfer is a boon.

Imagine an ERC-721 with batch-transfer capability — that would be nice, but it’s not possible. So, I started with an ERC-1155 contract, only calling functions to mint my tokens and allowing for batch-transfer of tokens, keeping it all non-fungible. The metadata (and image) for each work is still pulled in from the host of your choice via a server-hosted JSON file. I’m not of the school of thought that images and metadata need to be hosted on-chain via platforms like IPFS. I host mine on my own domain on my own server. There is an argument to be had for or against off-chain hosting of metadata. I am a blockchain purist, which is to say that most abstraction layers for me are impure. Enough said on that for now 🤪. Finally, in case a platform or wallet doesn’t support ERC-1155, we make it possible for the tokens to appear as if they were ERC-721.

For now, I feel this is an exciting option for artists who want to mint editions and have the ability to batch transfer. I’ve posted the Solidity contract on GitHub and you might also notice it’s all on a single flattened contract, not spread across multiple contracts. Just change the variables, link your metadata and you’re ready to compile on Remix and deploy. No need to get bogged down in Truffle/Ganache etc.

Hope this helps someone out there!

Twitter: @kevinabosch

Instagram: @kevinabosch

Website: kevinabosch.com

GitHub: GitHub.com/kevinabosch

--

--