Skip to main content

· 7 min read

Today’s article is a quick word about tokens. At the heart of blockchain technology, tokens enable most of today’s applications.

Web3 is a decentralized world where software is run by the people who use it. It's made up of dApps (decentralized applications), apps that run on the blockchain, and what makes web3 so exciting is how the dApps run: they're decentralized, which means they don't rely on a central server. Instead, their code runs in a virtual machine (VM) on every node or computer, that's part of the network. The VM that runs the dApp is called a smart contract. A smart contract can be written in any language that compiles to EVM bytecode, like Solidity.

There are two main types of tokens used in smart contracts: fungible and non-fungible. Non-fungible tokens are unique—one token represents one piece of an asset or one user. Whereas fungible tokens are identical and uniform. They are the closest thing to currency as we know it.

Though fungible tokens and the concept of currency is very concrete, NFT is a concept that is still hard to grasp for some. In this article, you will learn the broad idea and contrasting aspects of the different tokens you can encounter on Web3.

What is a Token?

First of all, let’s address tokens. A token is a digital good that can be traded. It is an object with an associated value or quality.

Tokens are used to represent nearly everything of value. We use them in games to represent health (hit points) and money (gold pieces). We use them in our daily lives to represent loyalty points from credit card companies and airline miles. They represent stocks, loyalty rewards from retailers, intangible assets such as votes and shares, and much more.

On the blockchain, there are several types of tokens, we will explore Fungible and Non-fungible tokens.

Fungible tokens

Blockchains are "decentralized" because there is no central authority that controls them. Everyone has access to an identical copy of the blockchain's history. The list of transactions on the Ethereum blockchain is public information that anyone can view at any time.

Tokens are not exactly like currency, but they can be used to represent assets on the blockchain. They can also be exchanged for other tokens or for "fiat" currency—that is, real-world money such as USD or EUR.

Fungible tokens are owned by users and they make up the basic building blocks of this new decentralized financial system. When someone sends you ETH, they're sending a quantity of fungible tokens to your address which represent units of value.

Fungible tokens can be exchanged for other tokens or for fiat currency. You can send ETH to your friend over the Ethereum network and have them receive it right away instead of waiting 10 minutes for a confirmation (although confirmations do add security).

Fungibles can be split into smaller units, which means you can transfer just a fraction of your token to someone else, like sending 0.5 ether instead of 1 ether.

With Starton, you can deploy smart contracts for fungible tokens using ERC20-flavored smart contract templates. Read More.

Non Fungible tokens

Non-fungible tokens (NFTs) are digital items you can own. Unlike fungible tokens, which are interchangeable, each non-fungible token is unique and cannot be exchanged for other NFTs or divided. Non-fungible tokens can represent a physical asset such as a rare painting or a virtual collectible like an in-game skin for a character.

When minting an NFT, when the artist chooses between generating a unique copy or multiple identical editions of the content, they are called additions. This is one type of collection. Multiple digital items will be issued. They will feature identical content with a different, unique token ID for each NFT. Each Token has a unique ID that can be used to identify that particular token from all others.

NFT=content+tokenID

So if the entire point behind NFTs is that they are unique and rare so why are single NFTs called one of one?

In the digital art space, we often hear the term "non-fungible token," or NFT. When we use this term, most people probably think of a unique blockchain collectible object like CryptoKitties, CryptoPunks, or even ERC721 tokens. Each of these items is unique, and there is no way to create two identical items that both have value. The idea of non-fungible tokens is actually much broader than what we often see in crypto collectibles. In fact, it's possible to have non-fungible tokens even if there are multiple instances of the content that they contain—as long as they're all different in some very significant way.

NFTs consists of content on one hand and a serial number on the other. NFTs cannot have the same edition number, but their content can be identical.

When the creator of an NFT, the artist can choose whether to make a single edition (version) of it or multiple identical editions called additions. This is called a collection.

It enables more people to collect the artworks and support the artist at the risk of devaluating the NFT’s scarcity.

One of one NFTs

So as we’ve just seen, 1 of 1 NFT, is a Non Fungible Token of which a single edition exists. It is edition one out of a collection of one. The content of the NFT will be unique. You can mint several 1 of 1 NFTs with a common theme. This is one kind of NFT collection.

One-of-one NFTs are rare figures that are limited to only one edition. One-of-one NFTs are generally unique and cannot be duplicated, as they have been created through a minting process that will never be repeated. This is different from most tokens, which are not unique and can be minted in mass quantities.

If you’re interested in creating a token that is unique and can never be duplicated, then you can use ERC721 flavored smart contract templates. These templates can help guide you through the process of creating your own 1 of 1 NFT. Read More.

One of many NFTs

So far, we've focused our attention on Non Fungible Tokens (NFTs) that only have one edition. This is where the "1 of 1" part comes in. But not all NFTs are one of one. Take, for instance, a real-life painting: each and every painting has different brush strokes and colors—which makes each one unique. Similarly, each digital card game that you collect can be thought of as an NFT—you're collecting an array of unique cards that you can use to play with other players.

If you want to mint more than one edition of your NFT, you'll need to create a smart contract using an ERC1155-flavored template. For now, here's how it works: let's say you want to create a digital collectible token for your favorite artist's album. You're offering limited-edition digital prints of the album art as well as a limited number of CDs containing the music. You could create 1 edition for the digital prints and 1 edition for the CDs, or you could create 2 editions for both pieces of content and 2 separate smart contracts: 1 for each edition.

When minting an NFT,  the artist makes multiple identical editions of the content they are called additions. This is one type of collection. Multiple digital items will be issued. They will feature identical content with a different, unique token ID for each NFT. In this case, you will have a unique token ID for each digital item issued with its unique data.

multi-copies NFT

With Starton, you can deploy smart contracts for 1 of many NFTs using our ERC1155 flavored smart contract templates. Read More.

· 10 min read

#Blockchain transaction lifecycle

Relayer illustration

Introduction

The Relayer is the heart of Starton regarding pre-chain management*. It allows you to send a large number of transactions with peace of mind and handles all the complexity, assuring that your transactions will be on-chain as soon as possible. But the blockchain is complex and sometimes you can encounter problems such as:

  • Lost transaction
  • Nonce issue
  • Gas price management
  • Automatic signature
  • Real-time status of your transaction

The Relayer’s role is to handle these errors when possible and otherwise to inform users of the transaction status so they can take action. Let’s follow a transaction step-by-step, from creation to publication on the blockchain, from Starton’s point of view for you to understand the power of our relayer.

Relayer illustration

Step 0 — Define

First, users have to define what they want to do. This can be tricky for newcomers as so many possibilities and use cases exist. Should I use ERC721? ERC1155? ERC20? Or even a simple transaction?

All along this article, we will explore a use case using an accessible example so that you get a better understanding.

Issues you can face:

  • Trouble expressing your use case
  • Answer this simple question: “Is blockchain suitable for my use case?”
  • Decide which type of smart contract I should use for my use case
  • Starton helps you by providing:
  • A list of use case examples
  • A set of documentation
  • A discord server to help you Example: To illustrate how the Relayer works, let’s take a concrete example. As a community manager, you want to reward your community. You decide to give them NFTs reflecting their engagement. You want to mint (create) 10k different NFTs and offer them to your community. For this use case, you choose to deploy an ERC721 template.

Step 1 — Compose

Your use case is defined? Ok, now comes the fun part (also known as the “nightmare phase” 😀 ). You need now to define the technical aspects of your use case. You often need to create mandatory files before even starting to build on the blockchain.

Issues you can face:

  • On which blockchain will I build?
  • What parameters does my smart contract need?
  • How can I test before going into production?
  • How much will it cost?
  • How can i host my NFT metadata?

Starton helps by providing you:

  • a bunch of smart contract templates with clear explanations
  • Tutorials and examples
  • Available testnet and test wallets on which you can test
  • IPFS service to host metadata
  • Again, a community and a team dedicated to helping you

Example: For your 10k NFTs mint, you will now need files, metadata, and… A smart contract. You decided to use Starton to mint your collection using an ERC721 smart contract as there will be a collection of 10k unique NFTs. You deploy your smart contract on your blockchain of choice and host your files on IPFS using Starton.

Step 2 — Transactions price

Then comes the time to decide how much you are willing to pay for your transactions. But as gas price is volatile, the price defined by the user can be too low or too high regarding the average prices. The transaction is then stuck waiting for the gas price to decrease or may cause the user to pay extra fees. It is critical to adapt the price to your usage. If you want an instant transaction, make it attractive for the miners* by paying more than others, if you’re willing to wait, save money and pay an average price.

Issues you can face:

  • Have your transaction stuck due to weak attractiveness for miners
  • Overpaying a transaction, resulting in decreasing profitability

Starton helps you:

  • Use pre-estimated costs for your transaction
  • Define your own gas price strategy regarding a transaction

Example: You are now ready to mint all 10k NFTs at once. The blockchain network you selected is quite busy right now and you are not willing to pay full price because you don’t need your NFTs to be minted instantly, it can wait several hours (or days even). Then, you just have to define a price you are willing to pay using Starton and the transactions will be broadcast to the network waiting for the gas price to decrease enough for a miner to find it attractive and include it into a block.

Step 3 — Broadcast

To be available for miners, your transaction has to be propagated through the network. That is the role of mempools*. You can visualize the pending transaction cycle here: https://txstreet.com/v/btc-eth

Your transaction is defined and you set a price range that you are willing to pay based on your use case, now it’s time to spread it to the network and wait for it to be integrated into a block. The transaction is then sent to a mempool and broadcast to the deep network so that they are exposed to miners. The miners will then cherry-pick the most advantageous transactions to create a full block and mine it.

Issues you can face:

  • Mempools can be desynchronized so your transaction is never propagated to the network or your transaction can be dropped when the mempool is reaching its maximum capacity (currently 64 transactions per wallet)
  • Transaction errors due to nonce* gap/double nonce
  • Generic errors giving you no clue on what the problem is
  • Underpriced transactions
  • Invalid transactions

Starton helps you by:

  • Broadcasting transactions to many mempools, maximizing network broadcast.
  • Estimating if your transaction is compliant before attributing a nonce to it.
  • Managing nonce. If a nonce is missing, transactions from the same wallet are blocked. Starton will assign the missing nonce to the next transaction coming from the same wallet in order to unlock it.
  • Getting information and logs when a transaction is blocked.
  • Handling nodes for you. To broadcast your transactions to the network you no longer need to have your own.

Example: Your gas price strategy is set, and everything is now ready for your transaction to be sent to the network. Then, your transaction is sent by Starton to a bunch of nodes that broadcast it to the deep network. As you stated that you are willing to pay fees, lower than the current price, your transactions are waiting for the gas price to decrease enough for your transactions to be attractive to a miner.

Step 4 — Monitor

Then your transaction is waiting to be selected by a miner and integrated into a block that will be mined into the blockchain. But the complexity is not over. If one of your transactions is stuck, all the following transactions will be stuck until this one is mined.

Issues you can face:

  • Confusion on what is the actual status of your transaction
  • Dropped transaction
  • Gas price is now too low due to volatility
  • Missing nonce

How Starton helps:

  • Rebroadcasting transactions lost/dropped by the mempool
  • Unstuck transaction with a too low gas price. You can set your monitor preferences:
    • Would you like Starton to increase your gas price?
    • What is the maximum gas price you are willing to pay?
    • How long you would like the Relayer to wait before increasing it?
  • Unstuck missing nonce. You can customize the monitor the way you want:
  • Would you like Starton to reallocate a missing nonce?
  • How long you would like the Relayer to wait before we unstuck it? For more information please read our full documentation: https://docs.starton.com/connect/api-doc/relayer/project

Example: Your mint transaction is now on the network waiting to be included in a block. Unfortunately, the gas price increases and, you have not enough in your wallet to cover gas and pay for the transaction. Starton sends you a notification explaining that your transaction is in error due to insufficient funds. You add tokens to your wallet and send your transaction again. This time everything is ok, you get the “mined” status for your transaction, showing that a miner included it in a block.

Step 5 — Confirmation

We can imagine that once your transaction is picked by a miner and included in a block then you’ve reached the end of your journey and nothing else can happen now…Think again! Have you ever heard of forks? Not talking about big forks like Ethereum classic that happened in 2016, but talking about more subtle ones known as soft forks.

Because the blockchain is decentralized, different copies of the blockchain can exist at the same time on different nodes. The consensus mechanism of the blockchain decides on one copy and defines it as the truth that is then diffused to the whole network. But what happened to transactions that were included in a block that is rejected by the network?

Issues you can face:

  • Think your transaction is mined and confirmed but forget about forks
  • Don’t get notified of a fork
  • Your transaction is stuck due to a gas price increase
  • Starton helps you by:
  • Sending a “confirmed” status on your transactions, ensuring you that the risk of a fork is very low
  • Broadcasting your transaction to the network again
  • Notifying you if a transaction is stuck due to gas price

Example: You minted all your NFTs, they are ready for transfer to your users. You received a “mined” status but, as you read carefully the Starton’s documentation, you know that mined status is not the final one. You wait a little longer to get the “Confirmed” status on your transactions ensuring you that the soft fork risk is now minimal. Then you can start sending NFT to your users.

In conclusion, our goal at Starton is to enable as many builders as possible to integrate blockchain technology into their products. Our relayer is one of the services dedicated to this purpose. Its main purpose is to handle a maximum of transactions by itself, using your own parameters, so that you can focus on your business, not on technology.

About Starton:

Starton is a Web3 developer suite that brings resilience, performance and scalability to any blockchain integration. Accessible through a dashboard and a REST API, Starton enables you to deploy smart contracts, make transactions, monitor events on blockchain networks and host files in a decentralized manner.

Glossary:

Pre-chain management: all states through a transaction can transit before it is added to a block

Mempool (contraction for memory & pool): a mempool can be seen as a waiting room. Once a mempool has received enough transactions, it spreads them to other nodes that propagate the transactions through the network waiting for them to be picked up by a miner.

Gas price: gas refers to the unit that measures the computational effort to execute action on the blockchain. Then, the gas price is the cost of a unit of gas at a given moment. This price fluctuates and the busier the blockchain, the higher the gas price.

Miners: Miners are nodes in the network that add transactions to the blockchain. As this process is resource-demanding, they get rewarded for their work. That explains why miners will select the most rewarding transactions to compose their block.

Nonce: a very important notion to understand the blockchain and its mechanism. A nonce is an incremental number representing the amount of transaction that occurred in a single wallet address and involved in transaction hash calculation. Each transaction have a unique nonce that should be increased one by one. If a nonce is missing, all transactions with superior nonce will be stuck until a transaction

Note: This article is inspired from this one made with talent by blocknative.

· 3 min read

Starton Web3auth

Use Case: We wanted to build a DApp that allows users to transfer Starton tokens to other users. He wants to make the transfer process as easy and cost-effective as possible by using meta transactions.

What is a meta transaction? Meta-transactions are a type of transaction on the blockchain that allow users to initiate transactions without needing to pay gas fees or have Ether in their wallets. Instead, the gas fees are paid by a relayer or a third-party that submits the transaction to the network.

To achieve this, we decided to use Web3Auth, a library that allows users to sign transactions using their Web3 wallets without needing to pay for gas fees. He also chooses to use Starton, a token built on the blockchain, for his DApp.

To build the solution, we followed three steps:

Instanciating Web3Auth using the integration builder

We started by installing the Web3Auth library and instantiating it in his front-end code. We then created a button that will trigger the Web3Auth authentication modal when clicked. The modal will prompt the user to connect with their social login.

To integrate Web3Auth, you can use the Integration builder by making sure you select the W3A modal.

Once the user is connected, we use the Web3Auth wallet to sign the transaction wrapped in the meta-transaction later, to ensure the transaction is valid and authorized by the user's wallet.

To retrieve the Starton token balance of the user, we also created a function that calls the Starton smart contract and returns the user's token balance.

Building a server-side to protect your API key

On the server side, we created two routes to handle the request for funds and the execution of meta transactions.

The requestFunds function will accept the user's address and the number of funds they wish to receive. We used a route that calls this function and returns the requested funds to the user.

The executeMetaTransaction function will accept the signed meta transaction from the user's Web3 wallet and execute it on the network. We then used a route that calls this function and executes the meta transaction on the network.

Creating a Front-End Integration

To integrate the functionality into the front end of his DApp, we created buttons and models that connect to the functions on the server side.

When the user clicks the Request Funds button, the front end will call the requestFunds route on the server side, which will return the requested funds to the user.

When the user clicks the "Send MetaTransaction" button, a modal window will open, prompting the user to enter the recipient address and amount to transfer. The front end will then sign the transaction using Web3Auth and send it to the server side for execution using the executeMetatransaction route.

By following these steps, we were able to build a Meta-Transaction site using Web3Auth and Starton. His users can now transfer Starton tokens to other users using meta transactions, making the process more efficient and cost-effective.

Want to use our project? Go to our tutorial section, CREATING METATRANSACTIONS WITH WEB3AUTH AND STARTON