cryptodailytrading.com

Bitcoin vs Ripple — The Ultimate Comparison

  • Vera Thornpike
    📚 WikiCoin

    Both Ripple and Bitcoin are on the top of the crypto sphere, but have a lot of differences. This ultimate comparison will show you their strong and weak sides.


Bitcoin vs Ripple — The Ultimate Comparison
You may also like:
Contents

Just a year ago, Bitcoin was considered to be the sole king of cryptocurrencies: its enormous market cap and overwhelming price attracted investors. However, in 2018, it wasn’t the most desirable piece of cake: tables turned in favor of revolutionary altcoins with advanced blockchains behind them. Ripple has slowly but steadily turned into Bitcoin’s main competitor: it breathes down its neck and is predicted to cast Bitcoin from the throne.

How do Ripple and Bitcoin differ, and which cryptocurrency would be a better investment? This ultimate blockchain comparison is here to guide you through the mire of differences.

Bitcoin: The Backbone of Cryptocurrency

Bitcoin was the first cryptocurrency to gain popularity: it was introduced in 2009 by the mysterious Satoshi Nakamoto (still no one knows who this person or group of people are). This digital cryptocurrency is based on blockchain technology: data is stored in a distributed ledger and is spread across multiple nodes. It means that once information is registered in the chain of blocks, it cannot be erased or forged. The public ledger mostly serves to verify transactions and keep records. Bitcoin is maintained by a team of enthusiastic developers. This decentralized system is not governed by any third party, be it governments or banks.


Who is the mysterious Satoshi Nakamoto?
Who is the mysterious Satoshi Nakamoto?

Bitcoin can be mined. Miners contribute their processing power to verify the transactions and add them to the Bitcoin blockchain. Besides, they find new Bitcoins. At the dawn of Bitcoin development, one BTC cost a few cents, and mining was a no-brainer: those who mined or bought Bitcoin and held for a few years became very rich down the road (Roger Ver is a good case in point).

Today, Bitcoin is mostly viewed as a means of storing money. At the same time, it’s gradually becoming a real-life payment method. Many eCommerce websites and even brick-and-mortar businesses have introduced payments in Bitcoin.

Ripple: Blockchain For Bank Infrastructure

Ripple was developed by the Ripple company, founded in 2012. In 2015-2016, the company had offices in the UK, Australia, and Luxembourg. Right from the start, Ripple has been positioned as a system for banks and payment networks. It serves for payments settling, currency exchange, and international money transfers. The main idea behind Ripple is to provide a system for the direct transfer of any assets (digital money, gold, fiat, etc) that can be settled in real time and would be a cheaper and more secure alternative to transfer systems used by traditional bank systems (for instance, SWIFT).

Unlike Bitcoin, Ripple doesn’t use blockchain: instead, its distributed consensus ledger uses the network that validates server and the proprietary currency called XRP. Ripple is a token that’s used within Ripple network to drive money transfers between various cryptocurrencies. The existing banking systems use fiat currency like dollars and euro for performing conversion to other currencies, which takes a lot of time and incurs high exchange fees. Typically, transfers between banks take up to 1-3 days to be processed.

Therefore, Ripple has a lot of advantages:

  • It allows converting a lot of different currencies almost instantly

  • It reduces fees considerably (the cost of a transaction is a small fraction of cent).

  • It ensures the security of transactions.

Ripple has already received support from corporate investors and is being slowly integrated into international banks. For example, the Commonwealth Bank of Australia, Fidor Bank, Santander, and over 61 Japanese banks said they were preparing or already implementing applications that work on the Ripple Network payment system.

The list of Ripple supporters is growing month by month
The list of banks supporting Ripple is enormous

Note that Ripple is not a mineable asset. All the coins are already created: Ripple emitted 100 bln XRP at its inception to reward participants for providing computing power for the maintenance of the blockchain. According to statistics, during the first month of escrow, only 100 mln XRP was used, and 900 put back into escrow.

👉MUST READ 5 Reasons to Invest in Ripple: How to Invest in XRP Most Profitable
5 Reasons to Invest in Ripple: How to Invest in XRP Most Profitable

Consensus Mechanisms

What makes the day-and-night difference between Bitcoin and Ripple is the underlying consensus mechanisms.

Bitcoin: Proof-of-Work

Bitcoin’s blockchain was the first to use the consensus mechanism. It was created by Bitcoin’s developer and is called Proof-of-Work. What the heck is this? Think of Proof-of-Work as a difficult calculation.

The Bitcoin network generates calculations that are too difficult for humans and require a lot of computational power to be solved. Such calculations take 10 minutes, and once it’s done, the Bitcoin transaction is confirmed as valid.

Proof of work is the drive of Bitcoin transactions
Here’s how the entire Bitcoin blockchain works

Who performs calculations? Every node connected to the Bitcoin network competes with others to be the first device to solve the calculation. The person who does it first is given a Bitcoin mining reward. The main drawback of the Proof-of-Work model is the need for a huge amount of electricity. One independent study has shown that Bitcoin mining consumes as much electricity as 159 individual nations!

Another problem with Bitcoin is that it Proof-of-Work and mining require very expensive hardware, which means the reward goes to the people who can invest more money into better ASICs and equipment.

Last but not least is the fact that the Proof-of-Work model has a lot of deficiencies, such as low transaction processing speed, low scalability, and high fees.

Ripple: Federated Byzantine Agreement

Ripple’s consensus mechanism, Federated Byzantine Agreement, serves to reach consensus between various nodes. In this system, every node is tied to a limited number of a few other nodes – together they form a so-called “Circle”. The Ripple network has a huge amount of circles, and they overlap, so there is a well-established connection between them.

Transactions are checked by Transaction Validators (this technology is deployed by banks): they are selected individually and are accredited before being able to engage in the activity of verification. That means banks won’t be willing to manipulate consensus as they might be serving their own transactions. But even if they did, all other transaction validators would see it and cancel the transaction.

Overlapping user circles in the Federated Byzantine Agreement
With the Federated Byzantine Agreement, users form circles that overlap

The FBA consensus mechanism isn’t made to solve complex calculations, so it requires much less electricity than Bitcoin. That makes the system more efficient and ensures that transaction fees are kept at the optimal level. As a rule, about 80% of validators need to reach the consensus for the transaction to be marked as valid.

Now that you know how both cryptocurrencies differ by the mechanism used, it’s time to take a closer look at the practical implementation of these assets.

👉MUST READ Every Ripple Price Prediction 2019 Says the Same Thing: XRP Price Might Reach 10$
Every Ripple Price Prediction 2019 Says the Same Thing: XRP Price Might Reach 10$

Where to spend both cryptocurrencies?

Bitcoin is quickly turning into a versatile means of payment. It’s not just a means of crypto trading: you can spend the digital currency in regular stores, too. The list of retailers accepting Bitcoin is large:

Store

What can you buy with Bitcoin?

Overstock.com

Online retailer for buying tech, furniture and any other stuff using cryptocurrency (BTC, ETH, Dash, LTC, and other assets are accepted).

Shopify

A versatile online store – you can buy anything

eGifter

Gift cards for different stores (Amazon, Home Depot, JCPenney, Sephora, etc).

Dish

Subscription-based TV provider

PizzaForCoins

Pizza delivery from different companies (Papa John’s, Domino, Pizza Hut)

Microsoft

Software, games, movies, and apps on Xbox and Microsoft store

CheapAir

Flight booking

The list of retailers accepting BTC can go on, and on, and on – their number is growing exponentially.

What about Ripple? In fact, Ripple was never designed to serve as a method of payment. There are a few online stores that accept XRP tokens, but things are changing quickly: some stores that used to handle Ripple payments once do not longer accept it. The primary aim of Ripple was a transfer of other currencies and commodities (such as oil or gold) over its proprietary network. The transaction fee is calculated in XRP, so it serves as fuel.

Key differences between Bitcoin and Ripple

We've already understood that Bitcoin and Ripple have different natures. Let's underline the key points.

Level of decentralization

Bitcoin is an open-source network, and a highly decentralized one. It's the community that makes decisions and develops the network. To prevent irreversible splits, developers use so-called soft forks: backward-compatible changes to the system’s use that allows avoiding breaks in the network. Yet, half of Bitcoin power is used to prevent irreversible hard forks.

Ripple is developed by a private company, and its internal ledger is closed – no third party is allowed to change it. The company uses a consensus approach, which allows for quicker updates. Thanks to the amendment system, developers find consensus before changing the network. Typically, when an amendment gets 80% in two weeks, all future ledgers have to support it. 

 Bitcoin is a more democratic and decentralized cryptocurrency than Ripple
People accuse Ripple of being a very centralized blockchain

Many people blame Ripple for being highly centralized – the network is managed differently, and no third party has access to the code. But let's not forget that this asset was initially designed to be a commercial solution. Today, about 75% of customers implement it commercially. About 62% of the XRP supply belongs to the company staff. 

👉MUST READ Despite the Criticism, Ripple Arguably More Decentralised Than Bitcoin
Despite the Criticism, Ripple Arguably More Decentralised Than Bitcoin

Transaction time

From a speed standpoint, Ripple is definitely superior to Bitcoin. 

Bitcoin processes about 7 transactions per second. Due to lack of scalability, the transaction cost equals about $27, and each operation takes about 70 minutes to clear. That's too slow, though developers hope to solve the problem with the help of the Lightning Network

As for Ripple, it uses so-called "off-ledger" processing, so one transaction settles within a mere 4 seconds. Another unbeatable advantage is the fact that Ripple charges a 0,00001 XRP transaction fee to maintain the functioning of the network. Add to that the ability to handle 1,500 transactions per second, and you will see why Ripple has made its way to the top.

Reserve coins

Every self-respecting crypto project is expected to have reserve coins. Satoshi Nakamoto is reported to have 980,000 BTC, though it cannot be proven for sure. It’s just a hypothesis because the crypto community is sure the founder should have access to his coins to be confident in his creation.

Ripple is similar to Bitcoin in this relation: the company holds a huge amount of XRP. It’s said to possess 60% of the overall coin supply. Some claim it’s too much, but the company doesn’t release more coins.

Pros and Cons of Ripple and Bitcoin

To continue comparing Bitcoin and Ripple side by side, let’s observe the pros and cons of each cryptocurrency.

Bitcoin

Pros: Bitcoin is the largest crypto asset by market capitalization. It has gained acclaim during the 10 years of its existence and only continues gaining popularity. It sets the standard for the entire industry and, probably, has the largest crypto community supporting it.

Cons: Bitcoin’s got a very low transaction processing speed and limit, and is inferior to its analogs as a transactional currency. There are many blockchains that perform way better than Bitcoin and were created specifically for these purposes.

Ripple

Pros: Ripple is getting more popular among banks and it is set to revolutionize the international payments sphere, making the process efficient and quick. Ripple also has a strong backup – the list of its partners is growing at an exponential rate, and many global financial institutions are eager to implement it in their infrastructure. Therefore, Ripple will grow and increase its coverage.

Cons: Ripple has a lot of strong competitors – it has to compete with SWIFT, Visa, and banks to get to the top. Banks have well-established infrastructures that have been developed for decades, so many people prefer relying on the existing payment processing systems, and changing this habit would be difficult. Time will show whether global banks will adopt Ripple’s technology.

Bitcoin and Ripple from an investment standpoint

What about the exchange and trading opportunities? Here, both cryptocurrencies differ to a great extent, too.

Bitcoin

Investing in Bitcoin is a no-brainer: you can purchase it on any cryptocurrency exchange or even from usual people using any preferable payment method, from cash to credit cards and online payment wallets. Bitcoin is easily accessible for everyone.

But whether you need to purchase and invest in Bitcoin is another question. Of course, it is still one of the largest and oldest cryptocurrencies, but it lost about 60% of its value in 2018 and remains on the level of $3,000-4000 in the last few months. The crypto community doesn’t know whether it will rise ever again, or whether it will beat last year’s lowest threshold.

When should Bitcoin be considered a cryptocurrency for investment? Take a risk in the following cases:

  1. You’ve got money and can afford to lose it, if things go bad.

  2. You are an experienced trader who isn’t prone to panic selling.

  3. You keep an eye out for cryptocurrency prices 24/7 and can react quickly...

  4. ...Or you believe in Bitcoin’s potency and are ready to hold it for months, or even years.

The last reason to buy Bitcoin is to use it for online payments, for instance, when you want to preserve anonymity.

👉MUST READ Bitcoin Price Prediction in 202025: How Much Will Bitcoin be Worth?
Bitcoin Price Prediction in 202025: How Much Will Bitcoin be Worth?

Ripple

We witnessed the enormous growth of Ripple in 2017-2018 – it managed not just to survive through the bearish market wave, but even strengthen its positions and become the world’s 2nd largest cryptocurrency by market cap, drawing ahead of Ethereum.

Ripple attracts new customers, and the growing number of XRP tokens can trigger XRP price growth. However, XRP is not as easy to purchase as BTC. Many cryptocurrency exchange platforms have XRP as one of their offerings, but you cannot obtain it with fiat currencies – you have to buy Ethereum or Bitcoin first.

Pro tips for Ripple investors
The main recommendation for Ripple investors – be patient

Is Ripple a worthy investment? The vast majority of crypto experts agree it has a lot of potential and might be a wise investment with a high ROI. However, you should conduct your own research. Find more information about the technology and its use cases, and make your own decision.

Bottom Line

Now let’s take a closer look at the main differences between the two cryptocurrencies and blockchains.

Breakdown of Ripple vs Bitcoin comparison

 

Bitcoin

Ripple

What was it made for?

Regular payments that are made safe and transparent

Currency exchange, international transfers within banking infrastructure

Ownership

Public

Private

Transaction cost

$25-50

Less than $0.01

Can be mined?

Yes

No

Energy consumption per transaction

~250 kWH

Minor

Algorithm

Proof-of-work

Consensus

Speed

~1 hour

3-5 seconds

When you should invest in it?

When the crypto market expects a bull run, and you are ready to keep tabs on the prices regularly.

When you want to make a long-term investment.

Numbers*

Circulating supply: 17 493 100 BTC

Market cap: $62 595 770 506

Price: $3 578,31

Circulating supply: 41 040 405 095 XRP

Market cap: $13 098 461 863

Price: $0,319160

* as of 01/20/2019

Comparing Ripple and Bitcoin isn’t the best idea since they have completely opposite philosophies and principles, and were created with different aims. Ripple won’t be used in the way Bitcoin is, but it doesn’t diminish its value and doesn’t mean Bitcoin isn’t worth considering as a currency for holding.

Ripple has a strong backup from numerous partners, so there are a lot of bright prospects ahead. It has a solid foundation and can revolutionize the global payment sphere. XRP holders can reap huge benefits down the road.

As for Bitcoin, it doesn’t seem to lose its popularity on the cryptocurrency market – it still rules the industry. When developers manage to solve scalability issues and reduce transaction costs, we will witness a new wave of hype and growth. Increased adoption in the financial sector contributes to its further growth and real-time implementation.

Only the most important posts per day. Infographics, analytics, reviews & summaries. Join our Telegram channel!
👓 Recommended articles

How to Learn Solidity and Start Blockchain Programming

  • Eric Croix
    📚 WikiCoin

    If making an Ethereum-based dApp or creating an ERC20 standard token sounds compelling to you, than you need to learn the language called Solidity. In our tutorial we provide you with the foundation of coding smart contracts


How to Learn Solidity and Start Blockchain Programming
You may also like:
Contents

Blockchain programming has become one of the best paying and challenging software spheres during the recent decade. Although blockchains are language-agnostic and many of the existing languages, like C++ and JavaScript (JS), are used by blockchain engineers, there are some tasks that couldn’t be conveniently realized by existing languages, which opened up the demand for new, crypto-specific options. One such language is Solidity.

Solidity was born as a core part of the Ethereum ecosystem. It absorbed C++, JavaScript, and Python. It has many contemporary features like libraries and inheritance. Solidity is designed to write programs that interact with Ethereum accounts, which are called smart contracts. Smart contracts are executed on Ethereum Virtual Machine (EVM), enabling users utilizing them perform tasks like crowdfunding, blind auctions, voting, and many others in a decentralized manner. The most famous killer-app of smart contracts was decentralized funding in ICOs, which started the bull rally on the crypto markets in 2017.

👉MUST READ No Dice: Ethereum Loses dApps Race to EOS and Tron
No Dice: Ethereum Loses dApps Race to EOS and Tron

Whether you are an experienced developer or just starting out in crypto, it’s a good idea to start learning Solidity because smart contracts have become a crucial part of the blockchain ecosystem. Aside from being actively implemented by dApps, they are being actively integrated into infrastructure-layer blockchains and even in Bitcoin via providers like RSK. By knowing how to build smart contracts you will make your blockchain career more sustainable and be able to produce better quality solutions. Let’s not pull it off any longer and get our hands dirty with coding!

Understanding the basics of a smart contract

A smart contract account consists of three sections: balance, storage, and code. The balance represents how much Ethereum a smart contract has. Storage holds data like strings and arrays that are specific to an application. The code section has the raw machine code that is compiled from what we write in Solidity.

Unlike user accounts, smart contract accounts are not external to the respective networks. In other words, you can use your wallet with various networks like Kovan and Ropsten, but you can’t do this with a smart contract. Smart contracts are internal.

Each smart contract has a source, which is stored on an author’s device and instances, which are stored on the blockchain. In order to create an instance (account) of a smart contract, we need to deploy it to the network. It very much resembles the relationship between classes and instances in traditional object-oriented programming (OOP) and languages representing it (JS, Ruby). To give you a more visual representation, let’s create a class ‘Bike’ and add an instance of it.

Bike class & instance

Bike class & instance

Source: Image by U.Today

What we will be writing is a contract definition, which will then run through a compiler that will produce two files: bytecode and application binary interface (ABI). Bytecode is what will be actually fed to the EVM and ABI is a layer between bytecode and regular JavaScript code that allows building a user interface (UI).

👉MUST READ Blockchain Programming: How Many Programming Languages Do You Need for Blockchain?
Blockchain Programming: How Many Programming Languages Do You Need for Blockchain?

Choosing an IDE & version of Solidity

Before we start, we need a proper integrated development environment (IDE). In other terms, we need a convenient terminal with the necessary tools to write our code in. For the purposes of this tutorial, we will pick Remix, an IDE created by the Ethereum foundation that allows writing, testing, debugging, launching smart contracts and many more. You can use it either straight in the browser or download it locally if you would like.

Once you launch Remix, you will be presented with the code editor in the center, the file manager on the left, and a compiler on the right.

Initial Remix window

Initial Remix window

Source: Image by U.Today

There will be some pre-written code – we won’t need that. To create out first-ever smart contract let’s press on the little plus icon in the top-left corner of the terminal and give it a name.

Creating a new project in Remix

Creating a new project in Remix

Source: Image by U.Today

As we have the blank .sol document now, we should specify the version of Solidity that the compiler will run. At the time of this tutorial, the latest version is 0.5.7. If you are not sure which version to use, you can specify a range of versions.

2 types of specifying the version of Solidity

2 types of specifying the version of Solidity

Source: Image by U.Today

Lastly, let’s give our smart contract a name, followed by a parenthesis.

Smart contract naming

Smart contract naming

Source: Image by U.Today

Writing your first smart contract

Once we have our canvas ready, it’s time to define the basic building blocks – variables. While experienced software engineers will have no issues understanding this concept, we will briefly introduce it to beginners. Variables are placeholders for chunks of information that are later referenced by a program that runs them.

👉MUST READ Blockchain Developer Salaries. Top Job Offers of Blockchain Companies
Blockchain Developer Salaries. Top Job Offers of Blockchain Companies

Let’s create a couple of variables: a string (a sequence of symbols) and an integer (a number). In Ethereum’s case, variables are stored in the blockchain along with the rest of parts of contracts and can, therefore, be accessed and updated from anywhere. Another key characteristic of Solidity variables is that you can make them private by writing ‘private’ next to the variables. Finally, for the integers, Solidity has two types: signed (can be positive & negative) and unsigned (can only be positive). To specify an unsigned variable, we should just put ‘u’ before it.

A private string and an integer

A private string and an integer

Source: Image by U.Today

Once we have the ‘name’ variable, we need to write out the methods of setting and getting it. This looks like a JS function. Remember that Solidity is statically typed, so we have to define variable types. Now any value we put in the ‘setName’ will define the ‘name’ string. For the getter, we will use ‘getName’ and specify what variable we expect to see. Now, it’s time to do the same for the ‘age’ variable. The method is constructed similarly to the ‘getName’.

Name/age setters and getters

Name/age setters and getters

Source: Image by U.Today

Let’s test our little chunk of code. Go to the ‘Run’ tab of the compiler and press ‘Deploy’ under your contract’s name. At the very bottom of the compiler, you will now see the ‘Deployed Contracts’ section that has our methods available. In order to pass a name to the ‘newName’ value, we need to make sure that our string is written in JSON, otherwise, the ‘getName’ will return nothing. For the ‘setAge’ just put your age without quotes. As you see, we can now set and receive the ‘name’ and the ‘age’ variables through our smart contract.

Compiler, with a name and an age

Compiler, with a name and an age

Source: Image by U.Today

Defining Wei and Gas

One of the most remarkable features of smart contrasts is that to deploy them to the Ethereum network you will need to initiate a transaction, which costs some amount of money that is paid in Ether. It’s crucial to understand how the fees are utilized in the system, as they will be deducted each time you interact with EVM.

What’s Wei?

Let us assume that reading this far into our tutorial you have used Bitcoin at least once. You probably made a small transaction that was way less than 1 BTC. In that case, you used Satoshis, which are something like pennies for a dollar. Wei is like a Satoshi – it’s the smallest part of 1 Ether. If we think of it in programming terms, it’s the lowest unsigned integer in the network. While interacting with the network, you will mostly encounter Gwei, which refers to Gigawei and equals 1 billion Wei.

👉MUST READ Vitalik Buterin Suggests Wallet Users Should Pay Higher Fees to Fund Devs
Vitalik Buterin Suggests Wallet Users Should Pay Higher Fees to Fund Devs

What’s Gas?

Gas is an essential part of the mechanism of smart contract execution. It has two values for each transaction: Gas consumed and its price. It’s worth mentioning that a user initiating a transaction defines these values. However, if the set value of Gas won’t be enough to process a specific operation, then the Gas will be consumed, but the transaction will fail. Moreover, if the price for Gas will be set too low for the network at a given time, the transaction will not be processed by the nodes, eventually making it unsuccessful. There are several services to check optimal values for your transactions, one of them being ethgasstation.info. To get a better understanding of Gas and why it costs any money, let’s code some of it by ourselves.

Get back to your Remix window and initiate a new file. In our example, we will call it ‘Gas’ and create a contract with the same name. Bear in mind that the more data we will require to store on the blockchain, the more Gas we will need. That being said, for the purpose of this tutorial we will create a cheap contract; the more you will add to it, the higher the fee will be.

There will be a function that returns an integer that is a sum of two inputs. To make it as lightweight as possible, we will specify that our contract will store nothing on the blockchain, and for that we will put ‘pure’ next to the function.

Cheap contract

Cheap contract

Source: Image by U.Today

Now you can deploy it in the compiler and input any two numbers to get the integer ‘c’. To check the price of our transaction we should take a look at the terminal located beneath the code section. There is a transaction cost and an execution cost. The first one refers to how much data a transaction has. The second one refers to how much of EVM’s power was required by the transaction.

Cheap contract’s cost

Cheap contract’s cost

Source: Image by U.Today

This is an extremely basic transaction that costs almost nothing for the network. In writing meaningful smart contracts you will add more details, which will increase their weight and therefore transaction fees.  

Creating & deploying your own ERC20 token

Let’s face it, the majority of the blockchain developers that are just starting out are eager to play big and create their own blockchains and tokens. While this is an extremely difficult topic that attracted some of the best software engineers from other spheres, building a basic ERC20 token isn’t rocket science.

First, we need to create another file in Remix and uploading the ERC20 interface, which is the following:

ERC20 standard

ERC20 standard

Source: Image by U.Today

The ‘totalSupply’ function lets us see how many tokens we have in total. The ‘balanceOf’ function is used to get amounts of tokens on specific addresses. The ‘transfer’ function allows users performing transactions between each other. The ‘transferFrom’, ‘allowance’ and ‘approve’ functions are there to allow people to let some other users initiate transactions on their behalf. Events are the logging tools for the ledger.

In addition to the interface itself, we will need a separate .sol file for our new token. Here we will import the ERC20 interface and specify our token’s symbol, name, and decimals.

uToday token

uToday token

Source: Image by U.Today

Before we compile it, we need to specify constraints.

  • Let’s start with the total supply – it’s a constant integer variable that we will make private. The total supply of our tokens will be 1 million, we also write a function to return this value.

  • Second, we need to store our token somewhere. For this, we will need to outline the mapping that will return a balance for any address specified.

  • Third, there should be a function for token transfers, which will essentially have an address of a receiver and an amount of token transferred. This function should also be able to check whether or not a sender has enough tokens on their balance, which can be realized through a simple if/then statement. In addition, we will set conditionals for ‘_value’ in a way that blocks users from sending transactions with 0 tokens as this would only flood the network with junk.

  • Fourth, we should create the mapping for the remainder functions, which is a mapping of mapping to an integer.

  • Then we will specify a few checkers in the ‘approve’ and ‘allowance’ functions and put conditions for the ‘transferFrom’.

  • Finally, not all the tokens will be available on the market. Some of the tokens are usually left out for teams, foundations, advisors and other purposes. Hence, it’s essential that we make it clear how many tokens will be circulating. As we created the tokens, the circulating supply equals our balance.

uToday token constraints

uToday token constraints

Source: Image by U.Today

The code is ready, so let’s test it. Proceed to the ‘Run’ tab of the compiler and deploy our token contract. You will see that we have our token data along with the total supply, balances, and allowances. Congratulations, you deserve a pat on the back!

To make our token actually function on the network, we need to deploy the smart contract (note that this is different from deploying it for testing in Remix). For the sake of this tutorial, we will use Remix and Metamask, but there other ways of doing so. Metamask is a simple but efficient Ethereum wallet program with a nice UI that integrates as an extension to some of the most popular browsers. In our case, we will use Opera. Firstly, go to metamask.io and download the extension. Once it’s done, you will see a fox icon in the top right of your browser.

Downloading Metamask & location of the icon

Downloading Metamask & location of the icon

Source: Image by U.Today

Press on the icon and proceed through the offered instructions to create a wallet. Do not forget to store the secret phrase! When you have your wallet, press on the Metamask icon and change the network to ‘Ropsten’ because we don’t want to mess with Ethereum’s mainnet.

Changing Metamask to Ropsten

Changing Metamask to Ropsten

Source: Image by U.Today

The last step is to generate some Ether (unfortunately, you won’t be able to use these for any real purchases, but they are necessary for testing). Head over to faucet.metamask.io and request 1 Ether.

Now you are all set. Return to your Remix window and change the environment to ‘Injected Web3’ in the compiler. Take a look at the account tab too – your address should be the same as that of what you generated with Metamask. Select the smart contract you want to deploy, which is your token contract and not the ERC20 interface and press on the respective button. A Metamask window will pop up with a transaction, its details, and options to interact with it. Submit the transaction, and our token will come into life.

Metamask popup

Metamask popup

Source: Image by U.Today

You can now play around with all the functions we specified earlier. Let’s look at our contract from another side to verify that it works properly. Like any other blockchain, Ethereum has multiple block explorers which serve the essential purpose of monitoring what’s happening on the network. In our case, we will stick to etherscan, though there is a handful of other great alternatives. Note that if you just go to etherscan, you will see the Main network. As we need to see the Ropsten network, you will need to put ‘ropsten.’ before the website’s address. Search for your address and you will see two transactions – one is for free Ether you received, and another is for deploying the contract.

User’s address in Etherscan

User’s address in Etherscan

Source: Image by U.Today

To find the address of your contract, press on the TxHash and navigate to the ‘To’ field. Here you can check your smart contract’s transactions, code, and events. At this point, we need to verify and publish our contract. Go to the ‘Code’ section and click on the ‘Verify and Publish’ link. Here you will need to again specify the name of your token, the version of the compiler (in our case the latest version of Solidity we used was 0.5.7, so we will stick to the related compiler version). Now you should copy the token’s smart contract code along with the ERC20 interface code from your Remix window to etherscan and press ‘Verify and Publish’ at the bottom of the screen.

Verifying the smart contract

Verifying the smart contract

Source: Image by U.Today

It’s time to go back to your contract’s address. The code in the ‘Code’ tab will now be verified. In addition, you will now have two more tabs: ‘Read contract’ & ‘Write contract’. In the reading section, we can check the functionality of our token. Input your (not the contract’s) address into ‘balanceOf’ field to see how many tokens you have; it should show 1 million that we hard coded as the total supply and gave it circulating to our wallet. That means that our token is now correctly working on the testnet.

Receiving the balance

Receiving the balance

Source: Image by U.Today

Summary

If you are looking to start a career in the crypto industry, you need to understand that despite its relative simplicity in basics, blockchain has incredible deepness to it. Since 2017 blockchains have evolved significantly and their use cases went beyond just financial transactions. With the advent of Ethereum, a whole new layer of networks appeared that hosts various dApps and blockchain-based solutions. The tool behind this evolution was a smart contract, and if you want to make your experience more valuable and future-proof, you should know how one works.

👉MUST READ Top 16 Ethereum Wallets 2019
Top 16 Ethereum Wallets 2019

While you can code smart contracts using other languages, Solidity is a better fit for such a purpose. Moreover, if you want to become an Ethereum developer, or create an ICO/ERC20 token for your project, this is your go-to choice. If you had some experience with C++ or JavaScript, coding on Solidity should be relatively easy. You will have to understand some differences between the client-server and decentralized models of launching software, though. Thanks to Ethereum Foundation and some third-party organizations, developers are presented with a set of convenient tools like Remix and Etherscan to code and deploy smart contracts.

We hope that our tutorial helped you with getting around the majority of Solidity’s concepts to be able to start your blockchain journey. Remember that you can always check with the latest documentation on Solidity. We wish you good luck and will be happy to use some of your dApps someday!

https://www.freepik.com/free-photo/working-from-bed_789592.htm
Only the most important posts per day. Infographics, analytics, reviews & summaries. Follow us on Facebook!
👓 Recommended articles