Batch transfer token что это значит
ERC1155 is a novel token standard that aims to take the best from previous standards to create a fungibility-agnostic and gas-efficient token contract.
| ERC1155 draws ideas from all of ERC20, ERC721, and ERC777. If you’re unfamiliar with those standards, head to their guides before moving on. |
Multi Token Standard
The distinctive feature of ERC1155 is that it uses a single smart contract to represent multiple tokens at once. This is why its balanceOf function differs from ERC20’s and ERC777’s: it has an additional id argument for the identifier of the token that you want to query the balance of.
This is similar to how ERC721 does things, but in that standard a token id has no concept of balance: each token is non-fungible and exists or doesn’t. The ERC721 balanceOf function refers to how many different tokens an account has, not how many of each. On the other hand, in ERC1155 accounts have a distinct balance for each token id , and non-fungible tokens are implemented by simply minting a single one of them.
This approach leads to massive gas savings for projects that require multiple tokens. Instead of deploying a new contract for each token type, a single ERC1155 token contract can hold the entire system state, reducing deployment costs and complexity.
Batch Operations
Because all state is held in a single contract, it is possible to operate over multiple tokens in a single transaction very efficiently. The standard provides two functions, balanceOfBatch and safeBatchTransferFrom , that make querying multiple balances and transferring multiple tokens simpler and less gas-intensive.
In the spirit of the standard, we’ve also included batch operations in the non-standard functions, such as _mintBatch .
Constructing an ERC1155 Token Contract
We’ll use ERC1155 to track multiple items in our game, which will each have their own unique attributes. We mint all items to the deployer of the contract, which we can later transfer to players. Players are free to keep their tokens or trade them with other people as they see fit, as they would any other asset on the blockchain!
For simplicity we will mint all items in the constructor but you could add minting functionality to the contract to mint on demand to players.
| For an overview of minting mechanisms check out Creating ERC20 Supply. |
Here’s what a contract for tokenized items might look like:
Note that for our Game Items, Gold is a fungible token whilst Thor’s Hammer is a non-fungible token as we minted only one.
The ERC1155 contract includes the optional extension IERC1155MetadataURI . That’s where the uri function comes from: we use it to retrieve the metadata uri.
Also note that, unlike ERC20, ERC1155 lacks a decimals field, since each token is distinct and cannot be partitioned.
Once deployed, we will be able to query the deployer’s balance:
We can transfer items to player accounts:
We can also batch transfer items to player accounts and get the balance of batches:
The metadata uri can be obtained:
The uri can include the string which clients must replace with the actual token ID, in lowercase hexadecimal (with no 0x prefix) and leading zero padded to 64 hex characters.
For token ID 2 and uri https://game.example/api/item/ .json clients would replace with 0000000000000000000000000000000000000000000000000000000000000002 to retrieve JSON at https://game.example/api/item/0000000000000000000000000000000000000000000000000000000000000002.json .
The JSON document for token ID 2 might look something like:
For more information about the metadata JSON Schema, check out the ERC-1155 Metadata URI JSON Schema.
| you’ll notice that the item’s information is included in the metadata, but that information isn’t on-chain! So a game developer could change the underlying metadata, changing the rules of the game! |
Sending Tokens to Contracts
A key difference when using safeTransferFrom is that token transfers to other contracts may revert with the following message:
This is a good thing! It means that the recipient contract has not registered itself as aware of the ERC1155 protocol, so transfers to it are disabled to prevent tokens from being locked forever. As an example, the Golem contract currently holds over 350k GNT tokens, worth multiple tens of thousands of dollars, and lacks methods to get them out of there. This has happened to virtually every ERC20-backed project, usually due to user error.
In order for our contract to receive ERC1155 tokens we can inherit from the convenience contract ERC1155Holder which handles the registering for us. Though we need to remember to implement functionality to allow tokens to be transferred out of our contract:
We can also implement more complex scenarios using the onERC1155Received and onERC1155BatchReceived functions.
Preset ERC1155 contract
A preset ERC1155 is available, ERC1155PresetMinterPauser . It is preset to allow for token minting (create) — including batch minting, stop all token transfers (pause) and allow holders to burn (destroy) their tokens. The contract uses Access Control to control access to the minting and pausing functionality. The account that deploys the contract will be granted the minter and pauser roles, as well as the default admin role.
This contract is ready to deploy without having to write any Solidity code. It can be used as-is for quick prototyping and testing, but is also suitable for production environments.
Batch transfer token что это значит
ContinuedERC20 token currency transfer implementation and analysis
Principle of bulk transfer
We will explain the implementation of three airdrops, the first two are redeploying an airdrop contract, and the third is to write the airdrop code before the token code is deployed.
There are a lot of tokens that have been deployed on Ethereum. Once they are online, they can’t modify the code. Therefore, if these tokens are to be airdropped, they must redeploy an airdrop contract. Use an airdrop contract to transfer funds. This method mainly uses two functions in the ERC20 standard.
First way
We can use approve The function gives the airdrop contract address permission so that he can call the token in an address and then loop through the airdrop contract. transferFrom Make bulk transfers
Write a simple airdrop contract code first.
Defined batch The function performs an airdrop and accepts three parameters:
- Contract address
- Accept address list
- a list of airdrop values, one-to-one correspondence with the address list
Can be seen in the for loop transferFrom Function for bulk transfer
Deploy according to the steps of the previous deployment contract, enter on the command line airdrop
If you see the above picture, it means that your deployment is successful!
Next, use the contract for airdrops, which first needs to be utilized. approve Give certain permissions to the airdrop contract
For the above steps, a brief explanation, first we can see that the number of airdrop contract addresses can be called 0.
allowance Returning the airdrop contract address can mobilize the number of an address token
Unlock the address and use it approve Give permission, continue to view after mining, and find that the airdrop contract can be called eth.accounts[0] 20 tokens from this address
After giving permission, we started airing!
Some people will find that the above command is not directly executed. batch Method, but called sendTransactoin This is because I am at the command line, the default gas is very low, but the data of this transaction is a lot, so it will fail because the gas runs out, not directly called batch Is for the final parameter gas:300000 Set the gas a little higher. Of course you call directly batch The method is also ok, but don’t end it.
From above you can see that the bulk transfer is complete.
Second way
The first way we need to use approve Give the contract address a certain amount of authority, but if we treat the contract address as an account address and give him some tokens, then the airdrop contract can be transferred using the currency in the address.
Write a contract code that can do this first.
From the code, we can see that we are using the token in the contract address to trade. We deploy according to the steps of deploying the token before.
After the deployment is successful, transfer some tokens to the airdrop contract, and then call the airdrop contract method to carry out the airdrop. The implementation steps are similar to the first one, so I won’t go into details.
Third way
The first two methods are to redeploy a contract for airdrops outside the contract. The third way is to implement airdrops in the contract. The idea is actually the same as the previous method, but it is only collected in the contract.
Add the following code to the contract
Follow the previous steps to deploy to the geth private chain and view the contract.
It can be found that there is already a contract in the present batch Method, then trade it.
The three ways of airdrop contracts are realized. In fact, the principles are very simple.
ERC 1155 Vs. ERC 721 – Key Differences
Ethereum evolved as one of the prominent solutions for resolving the limitations associated with Bitcoin, the first-generation blockchain network. The primary idea behind Ethereum revolved around introducing an open-source blockchain network with the functionality for developing smart contracts. One of the most prominent use cases of Ethereum has been evident in token development.
As a result, the ERC 1155 vs ERC 721 debate has become a critical concern for everyone interested in Ethereum. Most important of all, these two token standards are quite significant for the emerging applications of non-fungible tokens. The popularity of ERC 721 and ERC-1155 token standards have been largely revolving around the growth of NFTs. Let us learn more about these two token standards and how they are different from each other.
Curious to understand the fundamentals of ethereum? Join Yearly/Yearly+ Plan and get free access to the Ethereum Development Fundamentals Course Now!
What are ERC Token Standards?
Before discussing the ERC 721 vs ERC 1155 differences, it is important to have a brief overview of ERC token standards. What is the significance of ERC token standards in the crypto landscape? ERC or Ethereum Request for Comments is basically a technical document that provides specifications for the methods, innovation, research, and traits for a specific group of users in the Ethereum ecosystem.
The ERC token standards like ERC-721 and ERC 1155 offer explanations for different rules pertaining to ERC tokens on Ethereum. Most important of all, the Ethereum community contributes to amendments in the rules of the token standards after a comprehensive review. As of now, the three most popular ERC token standards include ERC-20, ERC-721, and now, the ERC-1155.
Excited to learn the basic and advanced concepts of ethereum technology? Enroll Now in The Complete Ethereum Technology Course
Why Should You Think of ERC 721 vs ERC 1155?
Ethereum has grown into a massive ecosystem of decentralized applications and web3 trends. As a result, development teams have to come up with new token standards. The earliest instances of token standards, such as the ERC-20 token standard, helped in defining the functionalities of traditional tokens. On the other hand, the ERC-20 token emphasized associating every asset with fungibility, thereby offering the functionality of fiat currency.
On the other hand, ERC 721 has been gaining notorious levels of attention in recent times. Why? The primary reason for the increased adoption of ERC-721 token standards is the growing hype around NFTs. Non-fungible tokens are everywhere in the tech world, starting from social media to crypto research papers. The ERC-721 token standard offers the right foundation for creating a customized, non-interchangeable token. For example, you can create a unique collectible trading card with the ERC-721 token or a completely unique personal avatar.
Where does ERC 1155 come into the picture? The comparisons between ERC-721 and ERC-1155 are gradually becoming more significant for the future of crypto. You must notice how ERC-721 focuses only on non-fungible tokens. This is where the difference between ERC 1155 and ERC 721 becomes quite clearly evident.
The ERC-1155 token standard comes with a revised set of traits, which allows the mixed use of fungible and non-fungible tokens. Quite confusing, isn’t it? NFTs are gradually evolving as a major force in popular culture. Therefore, the token standards for creating and managing NFTs are obviously crucial aspects of their future. Developers can explore a wide range of options in the unique traits of the token standards for creating applications tailored to their needs.
Get familiar with the terms related to ethereum with Ethereum Flashcards
ERC-721 Token Standard
The first entry in an ERC 1155 vs ERC 721 comparison points at the latter. If you look closely, the ERC-721 token standard actually started off the NFT phenomenon. The standard was a first of its own kind and helped in creating unique tokens. While non-fungible tokens had been there for a long time, ERC 721 opened up the gates for the mainstream popularity of NFTs. ERC-721 standard played a vital role in introducing the unique NFTs to the public with CryptoKitties.
The developers of CryptoKitties, Dapper Labs, brought ERC-721 in 2017 with an Ethereum Improvement Proposal or EIP. The CryptoKitties is a set of unique, randomly generated kittens you can use as digital collectibles. You must note that the CryptoKitties are completely unique, and no one can replicate them. In addition, the transaction history offers a clear impression of the kitty’s ownership records since its creation.
Many of you must have grabbed some points for ERC 721 vs ERC 1155 comparison from these highlights of ERC-721. However, it is also important to note that ERC-721 tokens are not all about complete uniqueness. As a matter of fact, the ERC 721 token standard offers the following additional feature specifications.
- Flexibility for transferring NFTs between accounts alongside the facility of trading NFTs for other currencies.
- Easy options for finding out the owners of a particular asset.
- Effective identification of total supply for a specific set of NFTs on the network.
ERC-721 token standard has actually served as a formidable force in driving the popularity of NFTs by huge margins. Interestingly, many NFTs based on the ERC-721 token standard have dominated the crypto landscape. Some of the notable examples of projects based on the ERC-721 token standard include NFT artwork or avatars, PFP projects, and fractional ownership in virtual land parcels.
Start learning Ethereum with World’s first Ethereum Skill Path with quality resources tailored by industry experts Now!
ERC-1155 Token Standard
The second player in the ERC 721 vs ERC 1155 token standard debate offers a practical solution to the different setbacks evident with ERC-721. The origins of the project go back to the Enjin Project, which introduced the token standard in 2019. One of the most striking highlights of the ERC 1155 token standard is the fact that it includes the best of ERC-20 as well as the ERC-721 token standard.
Enjin project focused on challenges associated with the ERC-721, especially the lack of flexibility for batch transfers. In the case of ERC-721 token standards, you would need individual transactions for each NFT while transferring multiple NFTs. As a result, the transactions can end up imposing high costs for trading each NFT individually.
The most notable aspect is the difference between ERC 1155 and ERC 721 focuses largely on support for batch transfers. ERC-1155 allows encompassing multiple assets in one smart contract, thereby enabling their transfer with limited network congestion and lower transaction costs. The next significant highlight of the ERC 1155 token standard is the support for non-fungible as well as fungible tokens. How? ERC-1155 offers the ability to support multiple states on a single contract and address.
On top of it, ERC-1155 also stands higher in the ERC 1155 vs ERC 721 debate for the ability to create semi-fungible tokens. The semi-fungible tokens would basically serve as fungible tokens during trading, and they would become NFTs upon being redeemed. Another notable aspect pertaining to the ERC-1155 token standard is the facility for reverting token transfers.
Comparison between ERC 721 and ERC 1155

The two popular ERC token standards in the crypto space right now have unique traits. However, the functionalities of the ERC-1155 standard showcase how it can overshadow the ERC 721 token standard. On the other hand, it is important to identify the situations where ERC-721 serves as a better fit than ERC-1155. Here is an outline of the differences between ERC-721 and ERC-1155.
Ease of Use
The first factor in a comparison of ERC 721 vs ERC 1155 refers to the ease of use. In the case of ERC-721, you would need a single operation for each transaction. On the other hand, ERC-1155 enables the facility for multiple operations within a single transaction. The best thing about ERC 1155 is that the smart contracts could offer support for an unlimited assortment of tokens. On the contrary, the ERC-721 token standard implies the need for new smart contracts for transactions with each type of token.
Batch Transfers
The second pointer in the difference between ERC 1155 and ERC 721 draws the limelight on flexibility for batch transfers. You can use the ERC-1155 token standard as vital support for facilitating batch transfers of tokens. The facility of batch transfers plays a crucial role in reducing the transaction costs and time associated with each transaction.
On the other hand, ERC 721 token standard implies the need for creating an individual smart contract for transferring each NFT or token. If you plan on sending multiple NFTs in an ERC-721 system, then you have to create transactions for individual NFTs. As a result, the load on the network increases by massive margins, thereby leading to congestion and increased transaction cost and time.
Support for Semi-fungible Tokens
Just as the world started experimenting with different uses of non-fungible tokens, everyone is gearing up to welcome semi-fungible tokens. The standard non-fungible and fungible tokens have become quite redundant with their own limitations. Semi-fungible tokens bring the best of both by enabling the conversion of fungible tokens into NFTs or vice versa. Interestingly, ERC 1155 token standard offers the flexibility for creating semi-fungible tokens. Most important of all, the ability to convert digital or real-world assets into NFTs or vice versa is a huge advantage for the ERC-1155 token standard.
Security of Assets
Another significant point of difference in the ERC 1155 vs ERC 721 comparison points at the features of security. Many crypto users have one common nightmare, i.e., sending their assets to the wrong address. The immutable nature of transactions on the blockchain is obviously one of the defining traits ensuring the safety of assets on the blockchain. However, the feature can be quite costly for an honest mistake.
With the ERC-721 standard, you don’t have the facility for reclaiming your assets if you transferred them to the wrong address. On the contrary, the ERC-1155 token standard offers a unique feature known as the ‘safe transfer’ function. The safe transfer function is a product requirement for evaluating a transaction’s validity and also enables hassle-free token transfers.
Bottom Line
The most crucial highlight of the difference between ERC 1155 and ERC 721 focuses on the way ERC-1155 addresses the limitations of ERC-721. While ERC-721 offered the foundation for non-fungible tokens, ERC-1155 offers the traits required for future NFTs. Once you begin exploring the definitions of both token standards, you can uncover many critical points of differences.
However, ERC-1155 presents an upper hand when it comes to long-term prospects for NFTs. The new token standard, introduced in 2019, has been phenomenal in introducing possibilities of semi-fungible tokens and batch transfers of NFTs. As a matter of fact, the ERC-1155 token standard can improve the usability of NFTs and remove the barriers to NFTs. Learn more about the token standards and their implications on the broader crypto landscape.

*Disclaimer: The article should not be taken as, and is not intended to provide any investment advice. Claims made in this article do not constitute investment advice and should not be taken as such. 101 Blockchains shall not be responsible for any loss sustained by any person who relies on this article. Do your own research!
About Author
James Howell is a blockchain educator and crypto advisor. He has been an advocate of blockchain technology since 2016. James has 15+ years of experience in technologies ranging from Blockchain, IoT, Artificial Intelligence, and Augmented Reality. He is committed to helping enterprises, as well as individuals, thrive in today’s world of fast-paced disruptive technological change.
Batch Transfer function in ERC-1155 standard
![]()
You might have heard of the Batch Transfer (or Multi-Transfers) concept mentioned in this article https://blog.enjincoin.io/erc-1155-the-crypto-item-standard-ac9cf1c5a226 written by Enjin CTO Witek Radomski (co-author of ERC-1155), it basically allows the user to transfer multiple ERC-1155 tokens in a single transaction. All ERC-1155 smart contracts must support safeBatchTransferFrom function https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1155.md#batch-transfers. However, as of this writing, Enjin wallet hasn’t supported batch transfer feature yet. Since we know the safeBatchTransferFrom function signature, we could directly interact with Enjin’s ERC-1155 smart contract to batch transfer tokens using Web3.js library.
Batch Transfer ERC-1155 tokens via enj1155.com
For those who are not familiar with the website, enj1155.com is a community-made site and has no affiliation to Enjin. You may have visited the website https://enj1155.com before using your desktop/mobile browser. What you might not be aware of is if you visit the website using Enjin wallet DApp browser or Chrome desktop browser (with Metamask plugin installed), you will discover some hidden features which are only available to DApp browser. Since Jun 2019, enj1155.com has already supported batch transfer feature for ENJ backed ERC-1155 tokens.
Here are the steps to batch transfer ERC-1155 tokens on enj1155.com using DApp browser.
- Visit https://enj1155.com using Enjin wallet DApp browser or Chrome browser with Metamask plugin installed. Other DApp browsers should work as well, but I mainly tested the features on these browsers so far.
- Press “View assets on your wallet” link near the top of the page.
- Press the “Send” link.
- There are 2 transfer modes. You may choose to send multiple tokens to a single address or send one fungible token to multiple addresses.
Mode 1: Send multiple items to single address
In this mode, you will be able to send multiple items to a single address, also known as batch transfer.
- Choose the items you want to transfer by marking the checkbox of the items. For the items which are not transferable (e.g. A Turret’s Life: Founders Token), checkboxes will not be shown so that you won’t accidentally send a non-transferable item as the transaction will always fail.
- Once you selected the items that you want to send, scroll down and review what you have selected. For fungible token, you could change the amount you want to send, provided you have more than one.
- Transfer Fees: If the items you want to send require transfer fees, you will need to approve Enjin ERC-1155 smart contract to transfer ENJ from your wallet to pay for the transfer fee. When you send the token which require transfer fee using Enjin wallet, Enjin wallet will do this step for you automatically. You may check your transaction history on EnjinX, it actually creates 3 transactions whenever you send an item which requires transfer fee.
- When sending items with transfer fees via https://enj1155.com, you will need to explicitly do the approval step on the Settings page. Press the “Settings” link to open the Settings page. This step is not required if you are not sending items which require transfer fees or you have already done the approval previously and the remaining allowance is still enough to cover the transfer fees.
- On the Settings page, touch the slide-toggle. Set the allowance that you want to approve. The default value is 999 ENJ. What it means is you approve Enjin ERC-1155 smart contract to transfer up to 999 ENJ from your wallet to pay for the transfer fee. You may set it to a lower number as long as it is enough to cover for the transfer fee. I know, this approval step seems complicated, but that’s how it works when ENJ is used to pay for transfer fee. Note: As of this writing, whenever you send an item with transfer fee using Enjin wallet, this allowance will be reset to 0. It might sound familiar to those who used to trade on CryptoFights trading site. 😛
- Since this step is an on-chain operation, Enjin wallet will prompt you a confirmation dialog box to create the transaction. I would recommend you to use the default transaction fee suggested by the wallet. If the transaction fee is too low, the transaction might be pending for hours!
- Press “Pay” button, enter your password to create the transaction. Just wait for the transaction to be confirmed or you may go back to the “Send” page to choose the items that you want to transfer.
- Now, again on the “Send” page, select the items that you want to transfer. Enter the target address that you want to send to, and then press “Send” button.
- Enjin wallet will then prompt you to create the transaction. Click the “Pay” button and enter the password to create the transaction. You may view the transaction details on EnjinX by clicking the “View transaction details on EnjinX” link. If EnjinX says it couldn’t find the transaction, it might be due to the network propagation delay. Try refresh it again after few seconds should be able to get it work.
Mode 2: Send a fungible token to multiple addresses
Use this transfer mode when you want to distribute a fungible token to multiple users for a raffle, contest, giveaway or you just want to send your newly minted token to your friends.
As you can see in the picture above, you can only select 1 token type (radio button instead of checkbox), and you can’t select non-fungible token.
The remaining steps should be intuitive enough. You just need to paste the the target addresses (1 address per line). Press “Send” button to create the transaction.
Transfer ERC-1155 tokens out from your hardware wallet
If you accidentally transferred some ERC-1155 tokens to your hardware wallet e.g. Ledger Nano S, there was no way to transfer the tokens out from your hardware wallet unless you import your wallet into Enjin wallet using your 24-word recovery phrase. Actually, I did. I accidentally sent a few ERC-1155 tokens to my hardware wallet.
Now you can transfer the tokens out from your hardware wallet by following the steps below.
So far, this is only tested with Google Chrome + Metamask + Ledger Nano S.
Batch transfer token что это значит
ContinuedERC20 token currency transfer implementation and analysis
Principle of bulk transfer
We will explain the implementation of three airdrops, the first two are redeploying an airdrop contract, and the third is to write the airdrop code before the token code is deployed.
There are a lot of tokens that have been deployed on Ethereum. Once they are online, they can’t modify the code. Therefore, if these tokens are to be airdropped, they must redeploy an airdrop contract. Use an airdrop contract to transfer funds. This method mainly uses two functions in the ERC20 standard.
First way
We can use approve The function gives the airdrop contract address permission so that he can call the token in an address and then loop through the airdrop contract. transferFrom Make bulk transfers
Write a simple airdrop contract code first.
Defined batch The function performs an airdrop and accepts three parameters:
- Contract address
- Accept address list
- a list of airdrop values, one-to-one correspondence with the address list
Can be seen in the for loop transferFrom Function for bulk transfer
Deploy according to the steps of the previous deployment contract, enter on the command line airdrop
If you see the above picture, it means that your deployment is successful!
Next, use the contract for airdrops, which first needs to be utilized. approve Give certain permissions to the airdrop contract
For the above steps, a brief explanation, first we can see that the number of airdrop contract addresses can be called 0.
allowance Returning the airdrop contract address can mobilize the number of an address token
Unlock the address and use it approve Give permission, continue to view after mining, and find that the airdrop contract can be called eth.accounts[0] 20 tokens from this address
After giving permission, we started airing!
Some people will find that the above command is not directly executed. batch Method, but called sendTransactoin This is because I am at the command line, the default gas is very low, but the data of this transaction is a lot, so it will fail because the gas runs out, not directly called batch Is for the final parameter gas:300000 Set the gas a little higher. Of course you call directly batch The method is also ok, but don’t end it.
From above you can see that the bulk transfer is complete.
Second way
The first way we need to use approve Give the contract address a certain amount of authority, but if we treat the contract address as an account address and give him some tokens, then the airdrop contract can be transferred using the currency in the address.
Write a contract code that can do this first.
From the code, we can see that we are using the token in the contract address to trade. We deploy according to the steps of deploying the token before.
After the deployment is successful, transfer some tokens to the airdrop contract, and then call the airdrop contract method to carry out the airdrop. The implementation steps are similar to the first one, so I won’t go into details.
Third way
The first two methods are to redeploy a contract for airdrops outside the contract. The third way is to implement airdrops in the contract. The idea is actually the same as the previous method, but it is only collected in the contract.
Add the following code to the contract
Follow the previous steps to deploy to the geth private chain and view the contract.
It can be found that there is already a contract in the present batch Method, then trade it.
The three ways of airdrop contracts are realized. In fact, the principles are very simple.