Wednesday, July 15, 2020

What Is a Digital Signature?

A digital signature is a cryptographic mechanism used to verify the authenticity and integrity of digital data. We may consider it as a digital version of the ordinary handwritten signatures, but with higher levels of complexity and security.
In simple terms, we may describe a digital signature as a code that is attached to a message or document. After generated, the code acts as proof that the message hasn’t been tampered with along its way from sender to receiver.
Although the concept of securing communications using cryptography dates back to ancient times, digital signature schemes became a possible reality in the 1970s - thanks to the development of Public-Key Cryptography (PKC). So, to learn how digital signatures work, we need to first understand the basics of hash functions and public-key cryptography.

Hash functions

Hashing is one of the core elements of a digital signature system. The process of hashing involves transforming data of any size into a fixed-size output. This is done by a special kind of algorithms known as hash functions. The output generated by a hash function is known as a hash value or message digest.
When combined with cryptography, the so-called cryptographic hash functions can be used to generate a hash value (digest) that acts as a unique digital fingerprint. This means that any change in the input data (message) would result in a completely different output (hash value). And that’s the reason cryptographic hash functions are widely used for verifying the authenticity of digital data.

Public-key cryptography (PKC)

Public-key cryptography, or PKC, refers to a cryptographic system that makes use of a pair of keys: one public key and one private key. The two keys are mathematically related and can be used for both data encryption and digital signatures.
As an encryption tool, PKC is more secure than the more rudimentary methods of symmetric encryption. While older systems rely on the same key to encrypt and decrypt information, PKC allows for data encryption with the public key and data decryption with its corresponding private key.
Other than that, the PKC scheme may also be applied in the generation of digital signatures. In essence, the process consists of hashing a message (or digital data) along with the signer’s private key. Next, the recipient of the message can check if the signature is valid by using the public key provided by the signer.
In some situations, digital signatures may involve encryption, but that isn’t always the case. For instance, the Bitcoin blockchain makes use of PKC and digital signatures, but unlike many tend to believe, there is no encryption in the process. Technically, Bitcoin deploys the so-called Elliptic Curve Digital Signature Algorithm (ECDSA) to authenticate transactions.

How digital signatures work

In the context of cryptocurrencies, a digital signature system often consists of three basic steps: hashing, signing, and verifying.

Hashing the data

The first step is to hash the message or digital data. This is done by submitting the data through a hashing algorithm so that a hash value is generated (i.e., the message digest). As mentioned, the messages can vary significantly in size, but when they are hashed, all their hash values have the same length. This is the most basic property of a hash function.
However, hashing the data is not a must for producing a digital signature because one can use a private key to sign a message that wasn’t hashed at all. But for cryptocurrencies, the data is always hashed because dealing with fixed-length digests facilitates the whole process.

Signing

After the information is hashed, the sender of the message needs to sign it. This is the moment where public-key cryptography comes into play. There are several types of digital signature algorithms, each with its own particular mechanism. But essentially, the hashed message will be signed with a private key, and the receiver of the message can then check its validity by using the corresponding public key (provided by the signer).
Put in another way, if the private key is not included when the signature is generated, the receiver of the message won’t be able to use the corresponding public key to verify its validity. Both public and private keys are generated by the sender of the message, but only the public key is shared with the receiver.
It’s worth noting that digital signatures are directly related to the content of each message. So unlike handwritten signatures, that tend to be the same regardless of the message, each digitally signed message will have a different digital signature.

Verifying

Let’s take an example to illustrate the whole process until the final step of verification. Imagine that Alice writes a message to Bob, hashes it, and then combines the hash value with her private key to generate a digital signature. The signature will work as a unique digital fingerprint of that particular message.
When Bob receives the message, he can check the validity of the digital signature by using the public key provided by Alice. This way, Bob can be sure that the signature was created by Alice because only she has the private key that corresponds to that public key (at least that’s what we expect).
So, it’s crucial for Alice to keep her private key in secret. If another person gets their hands on Alice’s private key, they can create digital signatures and pretend to be Alice. In the context of Bitcoin, this means someone could use Alice’s private key to move or spend her Bitcoins without her permission.

Why are digital signatures important?

Digital signatures are often used to achieve three results: data integrity, authentication, and non-repudiation.
·       Data integrity. Bob can verify that Alice’s message wasn’t changed along its way. Any modification in the message would produce a completely different signature.
·       Authenticity. As long as Alice’s private key is kept in secret, Bob can use her public key to confirm that the digital signatures were created by Alice and no one else.
·       Non-repudiation. Once the signature has been generated, Alice won’t be able to deny having signed it in the future, unless her private key gets somehow compromised.

Use cases

Digital signatures can be applied to various kinds of digital documents and certificates. As such, they have several applications. Some of the most common use cases include:  
·       Information Technology. To enhance the security of Internet communication systems.
·       Finance. Digital signatures can be implemented to audits, expense reports, loan agreements, and much more.
·       Legal. Digital signing of all sorts of business contracts and legal agreements, including governmental papers.
·       Healthcare. Digital signatures can prevent fraud of prescriptions and medical records.
·       Blockchain. Digital signature schemes ensure that only the rightful owners of the cryptocurrencies are able to sign a transaction to move the funds (as long as their private keys aren’t compromised).

Limitations

The major challenges faced by digital signature schemes rely on at least three requirements: 
·       Algorithm. The quality of the algorithms used in a digital signature scheme is important. This includes the choice of reliable hash functions and cryptographic systems.
·       Implementation. If the algorithms are good, but the implementation is not, the digital signature system will likely present flaws.
·       Private Key. If the private keys get leaked or somehow compromised, the properties of authenticity and non-repudiation will be invalidated. For cryptocurrency users, losing a private key may result in significant financial losses.

Electronic signatures vs. digital signatures

Simply put, digital signatures relate to one particular kind of electronic signatures - which refer to any electronic method of signing documents and messages. Thus, all digital signatures are electronic signatures, but the opposite isn’t always true.
The main difference between them is the authentication method. Digital signatures deploy cryptographic systems, such as hash functions, public-key cryptography, and encryption techniques.

Closing thoughts

Hash functions and public-key cryptography are at the core of digital signature systems, which are now applied to a wide range of use cases. If properly implemented, digital signatures can increase security, ensure integrity, and facilitate the authentication of all kinds of digital data.
In the blockchain realm, digital signatures are used to sign and authorize cryptocurrency transactions. They are particularly important for Bitcoin because the signatures ensure that coins can only be spent by the individuals that possess the corresponding private keys.
Although we’ve been using both electronic and digital signatures for years, there is still a lot of room for growth. A great portion of today’s bureaucracy is still based on paperwork, but we will likely see more adoption of digital signature schemes as we migrate to a more digitalized system.


What Are Smart Contracts?

Nick Szabo first described smart contracts in the 1990s. Back then, he defined a smart contract as a tool that formalizes and secures computer networks by combining protocols with user interfaces. Szabo discussed the potential use of smart contracts in various fields that involve contractual agreements - such as credit systems, payment processing, and content rights management.
In the world of cryptocurrencies, we may define a smart contract as an application or program that runs on a blockchain. Typically, they work as a digital agreement that is enforced by a specific set of rules. These rules are predefined by computer code, which is replicated and executed by all network nodes.
In essence, blockchain smart contracts allow for the creation of trustless protocols. This means that two parties can make commitments via blockchain, without having to know or trust each other. They can be sure that if the conditions aren't fulfilled, the contract won't be executed. Other than that, the use of smart contracts can remove the need for intermediaries, reducing operational costs significantly.
Although the Bitcoin protocol has been supporting smart contracts for many years, they were made popular by the creator and co-founder of Ethereum, Vitalik Buterin. It's worth noting, though, that each blockchain may present a different method of implementing smart contracts. 
This article will focus on the smart contracts that run on the Ethereum Virtual Machine (EVM), which is an essential part of the Ethereum blockchain.

How do they work?
In simple terms, a smart contract works as a deterministic program. It executes a particular task when and if certain conditions are met. As such, a smart contract system often follows "if… then…" statements. But despite the popular terminology, smart contracts are not legal contracts, nor smart. They are just a piece of code running on a distributed system (blockchain).
On the Ethereum network, smart contracts are responsible for executing and managing the blockchain operations that take place when users (addresses) interact with each other. Any address that is not a smart contract is called an externally owned account (EOA). Thus, smart contracts are controlled by computer code, and EOAs are controlled by users.
Basically, Ethereum smart contracts are made of a contract code and two public keys. The first public key is the one provided by the creator of the contract. The other key represents the contract itself, acting as a digital identifier that is unique to each smart contract.
The deployment of any smart contract is made through a blockchain transaction, and they can only be activated when called by an EOA (or by other smart contracts). However, the first trigger is always caused by an EOA (user).

Key features
An Ethereum smart contract often presents the following characteristics:
Distributed. Smart contracts are replicated and distributed in all nodes of the Ethereum network. This is one of the major differences from other solutions that are based on centralized servers.
Deterministic. Smart contracts only perform the actions they were designed to, given the requirements are met. Also, the outcome will always be the same, no matter who executes them.
Autonomous. Smart contracts can automate all sorts of tasks, working like a self-executing program. In most cases, though, if a smart contract isn't triggered, it will stay "dormant" and won't perform any action.
Immutable. Smart contracts can't be changed after deployed. They can only be "deleted" if a particular function was previously implemented. Thus, we may say that smart contracts can provide tamper-proof code.
Customizable. Before deployment, smart contracts can be coded in many different ways. So, they can be used to create many types of decentralized applications (DApps). This is related to the fact that Ethereum is a Turing complete blockchain.
Trustless. Two or more parties can interact via smart contracts without knowing or trusting each other. In addition, blockchain technology ensures that data is accurate.
Transparent. Since smart contracts are based on a public blockchain, their source code is not only immutable but also visible to anyone.

Can I change or delete a smart contract?
It's impossible to add new functions to an Ethereum smart contract after deployed. However, if its creator includes a function called SELFDESTRUCT in the code, they are able to "delete" the smart contract in the future - and replace it with a new one. In contrast, though, if the function isn't included in the code beforehand, they won't be able to delete it.
Notably, the so-called upgradeable smart contracts allow developers to have more flexibility over contracts' immutability. There are many ways to create upgradeable smart contracts, with varying degrees of complexity.
Taking a simplified example, let’s imagine that a smart contract is divided into multiple smaller contracts. Some of them are designed to be immutable, while others have the 'delete' function enabled. This means that part of the code (smart contracts) can be deleted and replaced, while other functionalities remain intact.

Advantages and use cases
As programmable code, smart contracts are highly customizable and can be designed in many different ways, offering many kinds of services and solutions.
As decentralized and self-executing programs, smart contracts may provide increased transparency and reduced operational costs. Depending on the implementation, they can also increase efficiency and reduce bureaucratic expenses.
Smart contracts are particularly useful in situations that involve the transfer or exchange of funds between two or more parties.
In other words, smart contracts can be designed for a wide variety of use cases. Some examples include the creation of tokenized assets, voting systems, crypto wallets, decentralized exchanges, games, and mobile applications. They may also be deployed along with other blockchain solutions that are tackling the fields of healthcare, charity, supply chain, governance, and decentralized finance (DeFi).

ERC-20
Tokens issued on the Ethereum blockchain follow a standard known as ERC-20. The standard describes the core functions of all Ethereum-based tokens. As such, these digital assets are often referred to as ERC-20 tokens, and they represent a great portion of the existing cryptocurrencies.
Many blockchain companies and startups deployed smart contracts in order to issue their digital tokens on the Ethereum network. After the issuance, the majority of these companies distributed their ERC-20 tokens through Initial Coin Offering (ICO) events. In most cases, the use of smart contracts enabled the exchange of funds, and distribution of tokens, in a trustless and efficient way.

Limitations
Smart contracts are made of computer code written by humans. This brings numerous risks as the code is subject to vulnerabilities and bugs. Ideally, they should be written and deployed by experienced programmers, especially when involving sensitive information or large amounts of money.
Other than that, some argue that centralized systems can provide most of the solutions and functionalities offered by smart contracts. The main difference is that smart contracts are running on a distributed P2P network, rather than a centralized server. And because they are based on a blockchain system, they tend to be either immutable or very hard to change.
Being immutable can be great in some situations, but very bad in others. For example, when a Decentralized Autonomous Organization (DAO) called "The DAO" got hacked in 2016, millions of ether (ETH) were stolen due to flaws in their smart contract code.
Since their smart contract was immutable, developers were unable to fix the code. This eventually led to a hard fork, giving birth to a second Ethereum chain. Simply put, one chain "reverted" the hack and returned the funds to the rightful owners (this is part of the current Ethereum blockchain). The other chain decided to not interfere with the hack, stating that things that happen on a blockchain should never be changed (this chain is now called Ethereum Classic).
It's important to note that the problem didn't come from the Ethereum blockchain. Instead, it was caused by a faulty smart contract implementation.
Another limitation of smart contracts is related to their uncertain legal status. Not only because it's in a grey area in most countries, but also because smart contracts don't suit the current legal framework.
For example, many contracts require both parties to be properly identified and over 18 years old. The pseudonymity provided by blockchain technology, combined with the lack of intermediaries, may threaten those requirements. While there are potential solutions to this, the legal enforceability of smart contracts is a real challenge - especially when it comes to borderless, distributed networks.

Criticism
Some blockchain enthusiasts see smart contracts as a solution that will soon replace and automate a great part of our commercial, and bureaucratic systems. While this is a possible reality, it's probably far from becoming the norm.
Smart contracts are certainly an interesting piece of technology. But, being distributed, deterministic, transparent, and somewhat immutable can make them less appealing in some situations.
Essentially, criticism relies on the fact that smart contracts are not a suitable solution for many real-world problems. In fact, some organizations are better off using conventional server-based alternatives. 
When compared to smart contracts, centralized servers are easier and cheaper to maintain, and tend to present a higher efficiency in terms of speed and cross-network communication (interoperability).

Closing thoughts
There is no doubt that smart contracts caused a big impact in the world of cryptocurrencies, and they certainly revolutionized the blockchain space. While the end-users may not interact directly with smart contracts, these are likely to power a wide range of applications in the future, ranging from financial services to supply chain management.
Together, smart contracts and blockchain have the potential to disrupt almost all areas of our society. But only time will tell if these groundbreaking technologies will manage to overcome the many barriers to large scale adoption.


Tuesday, July 14, 2020

A Beginner's Guide to Earning Passive Income With Crypto

What is passive income?

Trading or investing in projects is one way to make money in the blockchain industry. However, that typically requires detailed research and a substantial investment of time – but it still won’t guarantee a reliable source of income. 
Even the best investors can experience prolonged periods of loss, and one of the ways to survive them is to have alternative sources of income.
There are other methods than trading or investing that can help you increase your cryptocurrency holdings. These can pay ongoing income similar to earning interest, but only require some effort to set up and little or no effort to maintain.
This way, you can have several streams of income that, in combination with each other, can add up to a significant amount.
This article will go through some of the ways that you can earn a passive income with crypto.

What are the ways you can earn passive income with crypto?

Mining

Mining essentially means using computing power to secure a network to receive a reward. Although it does not require you to have cryptocurrency holdings, it is the oldest method of earning passive income in the cryptocurrency space.
In the early days of Bitcoin, mining on an everyday Central Processing Unit (CPU) was a viable solution. As the network hash rate increased, most of the miners shifted to using more powerful Graphics Processing Units (GPUs). As the competition increased even more, it has almost exclusively become the playing field of Application-Specific Integrated Circuits (ASICs) - electronics that use mining chips tailor-made for this specific purpose.
The ASIC industry is very competitive and dominated by corporations with significant resources available to deploy on research and development. By the time these chips arrive on the retail market, they are likely already outdated and would take a considerable amount of mining time to break-even.
As such, Bitcoin mining has mostly become a corporate business rather than a viable source of passive income for an average individual.
On the other hand, mining lower hash rate Proof of Work coins can still be a profitable venture for some. On these networks, using GPUs can still be viable. Mining lesser-known coins carries a higher potential reward, but comes with higher risk. The mined coins might become worthless overnight, carry little liquidity, experience a bug, or see themselves hindered by many other factors.
It is worth noting that setting up and maintaining mining equipment requires an initial investment and some technical expertise. 

Staking

Staking is essentially a less resource-intensive alternative to mining. It usually involves keeping funds in a suitable wallet and performing various network functions (such as validating transactions) to receive staking rewards. The stake (meaning the token holding) incentivizes the maintenance of the network’s security through ownership.
Staking networks use Proof of Stake as their consensus algorithm. Other versions of it exist, such as Delegated Proof of Stake or Leased Proof of Stake.
Typically, staking involves setting up a staking wallet and simply holding the coins. In some cases, the process involves adding or delegating funds to a staking pool. Some exchanges will do this for you. All you have to do is keep your tokens on the exchange and all the technical requirements will be taken care of.
Staking can be an excellent way to increase your cryptocurrency holdings with minimal effort. However, some staking projects employ tactics that artificially inflate the projected staking returns rate. It is essential to investigate token economics models as they can effectively mitigate promising staking reward projections. 
Binance Staking supports a wide variety of coins that will earn you staking rewards. Simply deposit the coins on Binance and follow the guide to get started.

Lending

Lending is a completely passive way to earn interest on your cryptocurrency holdings. There are many peer-to-peer (P2P) lending platforms that allow you to lock up your funds for a period of time to later collect interest payments. The interest rate can either be fixed (set by the platform) or set by you based on the current market rate.
Some exchanges with margin trading have this feature implemented natively on their platform.
This method is ideal for long-term holders who want to increase their holdings with little effort required. It is worth noting that locking funds in a smart contract always carries the risk of bugs.
Binance Lending offers a variety of options that let you earn interest on your holdings.

Running a Lightning node

The Lightning Network is a second-layer protocol that runs on top of a blockchain, such as Bitcoin. It is an off-chain micropayment network, which means that it can be used for fast transactions that aren’t immediately transferred to the underlying blockchain.
Typical transactions on the Bitcoin network are one-directional, meaning that if Alice sends a bitcoin to Bob, Bob cannot use the same payment channel to send that coin back to Alice. The Lightning Network, however, uses bidirectional channels that require the two participants to agree on the terms of the transaction beforehand.
Lightning nodes provide liquidity and increase the capacity of the Lightning Network by locking up bitcoin into payment channels. They then collect the fees of the payments running through their channels.
Running a Lightning node can be a challenge for a non-technical bitcoin holder, and the rewards heavily depend on the overall adoption of the Lightning Network.

Affiliate programs

Some crypto businesses will reward you for getting more users onto their platform. These include affiliate links, referrals, or some other discount offered to new users that are introduced to the platform by you.
If you have a larger social media following, affiliate programs can be an excellent way to earn some side income. However, to avoid spreading the word on low-quality projects, it is always worth doing some research on the services beforehand.
If you are interested in earning passive income with Binance, join the Binance Affiliate Program and get rewarded when you introduce the world to Binance!

Masternodes

In simple terms, a masternode is similar to a server but is one that runs in a decentralized network and has functionality that other nodes on the network do not.
Token projects tend to give out special privileges only to actors who have a high incentive in maintaining network stability. Masternodes typically require a sizable upfront investment and a considerable amount of technical expertise to set up.
For some masternodes, however, the requirement of token holding can be so high that it effectively makes the stake illiquid. Projects with masternodes also tend to inflate the projected return rates, so it is always essential to Do Your Own Research (DYOR) before investing in one.

Forks and airdrops

Taking advantage of a hard fork is a relatively straightforward tactic for investors. It merely requires holding the forked coins at the date of the hard fork (usually determined by block height). If there are two or more competing chains after the fork, the holder will have a token balance on each one.
Airdrops are similar to forks, in that they only require ownership of a wallet address at the time of the airdrop. Some exchanges will do airdrops for their users. Note that receiving an airdrop will never require the sharing of private keys - a condition that is a telltale sign of a scam.

Blockchain-based content creation platforms

The advent of distributed ledger technologies has enabled many new types of content platforms. These allow content creators to monetize their content in several unique ways and without the inclusion of intrusive ads.
In such a system, content creators maintain ownership of their creations and usually monetize attention in some way. This can require a lot of work initially but can provide a steady source of income once a more substantial backlog of content is ready. 

What are the risks of earning passive income with crypto?

·       Buying a low-quality asset: Artificially inflated or misleading return rates can lure investors into purchasing an asset that otherwise holds very little value. Some staking networks adopt a multi-token system where the rewards are paid in a second token, which creates constant sell pressure for the reward token.
·       User error: As the blockchain industry is still in its infancy, setting up and maintaining these sources of income requires technical expertise and an investigative mindset. For some holders, it might be best to wait until these services become more user-friendly, or only use ones that require minimal technical competence.
·       Lockup periods: Some lending or staking methods require you to lock up your funds for a set amount of time. This makes your holdings effectively illiquid for that time, leaving you vulnerable for any event that may negatively impact the price of your asset. 
·       Risk of bugs: Locking up your tokens in a staking wallet or a smart contract always carries the risk of bugs. Usually, there are multiple choices available with various degrees of quality. It is imperative to research these choices before committing to one. Open-source software might be a good starting point, as those options are at the very least audited by the community.

Closing thoughts

Ways to generate passive income in the blockchain industry are growing and gaining popularity. Blockchain businesses have also been adopting some of these methods, providing services commonly referred to as generalized mining.
As the products are getting more reliable and secure, they might soon become a valid option for a steady source of income.