Sunday, January 30, 2022

What Is a Blockchain?

What Is a Blockchain?



A blockchain is a distributed database that is shared among the nodes of a computer network. As a database, a blockchain stores information electronically in digital format. Blockchains are best known for their crucial role in cryptocurrency systems, such as Bitcoin, for maintaining a secure and decentralized record of transactions. The innovation with a blockchain is that it guarantees the fidelity and security of a record of data and generates trust without the need for a trusted third party.

One key difference between a typical database and a blockchain is how the data is structured. A blockchain collects information together in groups, known as blocks, that hold sets of information. Blocks have certain storage capacities and, when filled, are closed and linked to the previously filled block, forming a chain of data known as the blockchain. All new information that follows that freshly added block is compiled into a newly formed block that will then also be added to the chain once filled.

A database usually structures its data into tables, whereas a blockchain, like its name implies, structures its data into chunks (blocks) that are strung together. This data structure inherently makes an irreversible timeline of data when implemented in a decentralized nature. When a block is filled, it is set in stone and becomes a part of this timeline. Each block in the chain is given an exact timestamp when it is added to the chain.

Is Blockchain Secure?

Blockchain technology achieves decentralized security and trust in several ways. To begin with, new blocks are always stored linearly and chronologically. That is, they are always added to the “end” of the blockchain. After a block has been added to the end of the blockchain, it is extremely difficult to go back and alter the contents of the block unless a majority of the network has reached a consensus to do so. That’s because each block contains its own hash, along with the hash of the block before it, as well as the previously mentioned time stamp. Hash codes are created by a mathematical function that turns digital information into a string of numbers and letters. If that information is edited in any way, then the hash code changes as well.

Let’s say that a hacker, who also runs a node on a blockchain network, wants to alter a blockchain and steal cryptocurrency from everyone else. If they were to alter their own single copy, it would no longer align with everyone else’s copy. When everyone else cross-references their copies against each other, they would see this one copy stand out, and that hacker’s version of the chain would be cast away as illegitimate. 

Succeeding with such a hack would require that the hacker simultaneously control and alter 51% or more of the copies of the blockchain so that their new copy becomes the majority copy and, thus, the agreed-upon chain. Such an attack would also require an immense amount of money and resources, as they would need to redo all of the blocks because they would now have different time stamps and hash codes. 

Due to the size of many cryptocurrency networks and how fast they are growing, the cost to pull off such a feat probably would be insurmountable. This would be not only extremely expensive but also likely fruitless. Doing such a thing would not go unnoticed, as network members would see such drastic alterations to the blockchain. The network members would then hard fork off to a new version of the chain that has not been affected. This would cause the attacked version of the token to plummet in value, making the attack ultimately pointless, as the bad actor has control of a worthless asset. The same would occur if the bad actor were to attack the new fork of Bitcoin. It is built this way so that taking part in the network is far more economically incentivized than attacking it.

FeatureBanksBitcoin
Hours openTypical brick-and-mortar banks are open from 9:00 am to 5:00 pm on weekdays. Some banks are open on weekends but with limited hours. All banks are closed on banking holidays.No set hours; open 24/7, 365 days a year.
Transaction Fees•Card payments: This fee varies based on the card and is not paid by the user directly. Fees are paid to the payment processors by stores and are usually charged per transaction. The effect of this fee can sometimes make the cost of goods and services rise. •Checks: can cost between $1 and $30 depending on your bank. •ACH: ACH transfers can cost up to $3 when sending to external accounts. •Wire: Outgoing domestic wire transfers can cost as much as $25. Outgoing international wire transfers can cost as much as $45.Bitcoin has variable transaction fees determined by miners and users. This fee can range between $0 and $50 but users have the ability to determine how much of a fee they are willing to pay. This creates an open marketplace where if the user sets their fee too low their transaction may not be processed.
Transaction Speed•Card payments: 24-48 hours •Checks: 24-72 hours to clear •ACH: 24-48 hours •Wire: Within 24 hours unless international *Bank transfers are typically not processed on weekends or bank holidaysBitcoin transactions can take as little as 15 minutes and as much as over an hour depending on network congestion.
Know Your Customer RulesBank accounts and other banking products require "Know Your Customer" (KYC) procedures. This means it is legally required for banks to record a customer's identification prior to opening an account.Anyone or anything can participate in Bitcoin’s network with no identification. In theory, even an entity equipped with artificial intelligence could participate.
Ease of TransfersGovernment-issued identification, a bank account, and a mobile phone are the minimum requirements for digital transfers.An internet connection and a mobile phone are the minimum requirements.
PrivacyBank account information is stored on the bank’s private servers and held by the client. Bank account privacy is limited to how secure the bank's servers are and how well the individual user secures their own information. If the bank’s servers were to be compromised then the individual's account would be as well.Bitcoin can be as private as the user wishes. All Bitcoin is traceable but it is impossible to establish who has ownership of Bitcoin if it was purchased anonymously. If Bitcoin is purchased on a KYC exchange then the Bitcoin is directly tied to the holder of the KYC exchange account.
SecurityAssuming the client practices solid internet security measures like using secure passwords and two-factor authentication, a bank account's information is only as secure as the bank's server that contains client account information.The larger the Bitcoin network grows the more secure it gets. The level of security a Bitcoin holder has with their own Bitcoin is entirely up to them. For this reason it is recommended that people use cold storage for larger quantities of Bitcoin or any amount that is intended to be held for a long period of time.
Approved TransactionsBanks reserve the right to deny transactions for a variety of reasons. Banks also reserve the right to freeze accounts. If your bank notices purchases in unusual locations or for unusual items they can be denied.The Bitcoin network itself does not dictate how Bitcoin is used in any shape or form. Users can transact Bitcoin how they see fit but should also adhere to the guidelines of their country or region.
Account SeizuresDue to KYC laws, governments can easily track people's banks accounts and seize the assets within them for a variety of reasons.If Bitcoin is used anonymously governments would have a hard time tracking it down to seize it.

Excel as database in 4 lines of JavaScript

Is there any way to read an Excel File using Javascript?

Yes, there is a way to read the file in CSV format which is similar to Excel. And this method works 100%.

First, let's see what is a CSV?

A CSV (comma-separated values) file is a text file that has a specific format that allows data to be saved in a table structured format.
This is how a .csv file looks when you open it.

This is how a .csv file looks when you open it in VS Code.



Note that all the values are separated by commas.

Ok enough of the Intro, now let's see how to read a CSV file using Javascript.

Firstly we need Papa parse to make our job done easy. See the official link for more information.

Step 1.

<script src="http://cdn.jsdelivr.net/npm/papaparse@5.3.1/papaparse.min.js"></script>

Copy and paste the above script inside the head tag in your HTML file.


Step 2.

Make your own .csv file or download this sample data file and paste it to your project directory.

Download data.csv file

Step 3.

Paste this in the HTML page inside the script tag.

    <script>

        Papa.parse("data.csv", {

        download: true, header: true,  skipEmptyLines: true,

        complete: function (data) {

        console.log(data)

        }})

    </script>

Step 4.

Open the index.html file in the browser and open the console. To open the console press F12 and at the top, you will see a console that displays all the elements in the csv file




Cool button hover animation using CSS

Want a Cool button hover animation in CSS like this ??