https://www.velotio.com/engineering-blog/introduction-to-blockchain-and-how-bitcoin-works Tell us more about your project Name*[ ]E-mail*[ ]Phone* [ ] Details about your project[ ] [Submit] Thanks! We'll be in touch in the next 12 hours Oops! Something went wrong while submitting the form. [5df298e437d24d66dfcc0b42_iconfinder] Velotio.com uses cookies to give you the best online experience. If you continue to use this site, you agree to the use of cookies. Please see our privacy policy for details. OK Subscribe to get the latest technology updates No Spam. Only expert insights. [ ][ ][ ]I agree to Velotio's Privacy Policy[Subscribe] Thanks! You've been subscribed! Oops! Something went wrong while submitting the form. X [6040dd0c86] 60+ Openings! | We are hiring across Web & Mobile App Development, DevOps, Kubernetes, QA, and Data Engineering. Apply Now! [614b23d4dd] [5d259f1] Services By Engagement Model [5d] Remote Engineering Team Hire remote developers (managed & in one location) [5d] Complete Product Development Take your product from concept to MVP and achieve scale [5d] Strategic Offshoring Set up your offshore engineering center in India with low-risk BOT model By Company Stage [5d] Early stage Build MVPs or a launch ready product [5d] High-growth Scale up your engineering efforts. Hire faster! Why Velotio? * - Experienced, high-caliber engineers * - Scale up as you like * - High employee retention * - Dedicated team leads * - Strong IP protection Expertise [5d1d142fe0] Web & Mobile App Development UI/UX Design Craft Products With Brilliant User Experience React development Fast and responsive React apps built with latest technologies Mobile App Development High-quality native and hybrid mobile apps for startups and enterprises Product Design & Architecture Build Intelligent products with robust technology Backend / Middleware Enterprise-grade backend systems that scales Front-end Expertise Quality front-end architecture that is responsive QA / Test Engineering End to End Test engineering services Backend / Middleware Enterprise-grade backend systems that scales. Maintenance Sustain and Enhance Legacy Products [5d1d143048] Cloud & DevOps CI/CD & Infrastructure Automation Setup Continuous Delivery pipelines with No-ops self-healing Cloud Infrastructure Kubernetes Adoption Accelerate your Kubernetes Adoption Application Modernization Re-architect legacy applications using microservices to meet new business requirements. Kubernetes & Container Strategy Architect and Implement self-managed Kubernetes solutions for modern workloads Cloud Expertise: AWS / GCP / Azure Better agility and lower costs with our cloud services. Serverless Applications Leverage Serverless services to build applications and ETL pipelines [5d1d143053] Machine Learning & Data Engineering Machine Learning & AI Machine Learning and AI to gather insights from your data Data Engineering & Pipelines Design and Implement Realtime ETL pipelines Chatbot Development Develop complex multi-channel chatbots Case Studies Company [5d] About Us Learn about our senior leadership and who we are [5f] Careers Join a team of problem solvers [5f] Golang & Kubernetes Accelerator Program Get hired and trained to become an expert cloud-native engineer [5d] Why Velotio? See why successful companies choose Velotio [5f] IP Protection Learn how we ensure complete security for your business [5d] Culture See how we work & what we value [5d] Contact Us Reach out & we would be happy to connect :-) Why Velotio? * - Experienced, high-caliber engineers * - Scale up as you like * - High employee retention * - Dedicated team leads * - Strong IP protection Resources [5d] Blog Technology blogs written by our engineers [5d] eBooks/White Papers Insights to help you get the best from your offshore software development Featured Blog A Practical Guide to HashiCorp Consul - Part 1 Read More Contact us Contact us x Blockchain 101: The Simplest Guide You Will Ever Read Blockchain allows digital information to be distributed over multiple nodes in the network. It powers the backbone of bitcoin and cryptocurrency. The concept of a distributed ledger found its use case beyond crypto and is now used in other infrastructure. What is Blockchain? Blockchain is a distributed ledger that powers bitcoin. Satoshi invented bitcoin, and blockchain was the key component. Blockchain is highly secured and works around a decentralized consensus algorithm where no one can own the control completely. Let's divide the word blockchain into two parts: block and chain. A block is a set of transactions that happen over the network. The chain is where blocks are linked to each other in a way that the next block contains hash of the previous one. Even a small change in the previous block can change its hash and break the whole chain, making it difficult to tamper data. Blockchain Example Image source Blockchain prerequisites: These are some prerequisites that will help you understand the concepts better. Public-key Cryptography- Used to claim the authenticity of the user. It involves a pair of public and private keys. The user creates a signature with the private key, and the network uses the public key of the user to validate that the content is untouched. Digital Signatures: Digital signatures employ asymmetric key cryptography. * Authentication: Digital signature makes the receiver believe that the data was created and sent by the claimed user. * Non-Repudiation: The sender cannot deny sending a message later on. * Integrity: This ensures that the message was not altered during the transfer. Cryptographic hash functions: * One way function: This is a mathematical function that takes an input and transforms it into an output. There is no way to recover the message from the hash value. * No collision: No two or more messages can have the same hash (message digest). This ensures that no two account transactions can collide. * Fixed hash length: Irrespective of the data size, this function returns the same hash length. Why Blockchain? There are a few problem statements that we can quickly solve using a distributed consensus system rather than a conventional centralized system. Let me share some blockchain applications: Consider an auction where people bet on artifacts, and the winner pays and takes out those artifacts. But if we try to implement the same auction over the internet, there would be trust issues. What if one wins the bet saying 10000$ and at the time of payment, he doesn't respond. We can handle such events easily using blockchain. During betting, a token amount will be deducted from an account and will be stored in the smart contract (business logic code deployed on Ethereum). Bid transactions use a private key to sign transactions, so this way, one can not revert by saying that those transactions never happened. Another simple but amazing solution we can develop using Ethereum is online games like tic-tac-toe, where both players will deposit `X` amount in the smart contract. Each move done by a player gets recorded on blockchain (each movement will be digitally signed), and smart contract logic will verify a player's move every time. In the end, the smart contract will decide the winner. And the winner can claim his reward. - No one controls your game - There is no way one can cheat - No frauds, the winner always gets a reward. Bitcoin is the biggest and most well-known implementation of blockchain technology. The list of applications based on distributed consensus systems goes on. Note: Ethereum smart contract is the code that is deployed over Ethereum blockchain. It is written as a transaction on the block so no one can alter the logic. This is also known as Code is Law. Check out some of the smart contract examples. Bitcoin is the base and ideal implementation for all other cryptocurrencies. Let's dig deep into blockchain technology and cryptocurrency. Let's reinvent Bitcoin: * Bitcoin is distributed ledger technology where the ledger is a set of transactions * No single entity controls the system * High level of trust We have to design our bitcoin to meet above requirements. 1) Consider that bitcoin is just a string that we will send from one node to the other. Here, the string is: "I, Alice, am giving Bob one bitcoin." It shows Alice is sending Bob one bitcoin. One node sending Bitcoin to another 2) Sam uses the fake identity of Alice and sends bitcoin on her behalf. A node is using fake identity during transaction 3) We can solve this fake identity problem using Digital signature. Sam can not use a fake identity. Digital signature solves fake identity problem But there is still one problem, double spending. This occurs when Alice sends one transaction multiple times. It's difficult to check if Alice wants to send multiple bitcoins or just retrying transactions due to high network latency or any other issue. 4) But a simple solution is to add a unique transaction ID to each transaction. Unique transaction id to handle double spending problem 5) It's time to add more complexity to our system. Let's check how we can validate the transaction between Alice and Bob. In cryptocurrency, every node knows everything (nodes are the systems where blockchain clients are installed, like Geth for Ethereum). Validate all transactions between two nodes Every node maintains a local ledger containing whole blockchain data. Here, Alice, Sam, and Bob know how much bitcoins everyone has. This helps validate all transactions happening over the network. As Bob receives an event from Alice containing a bitcoin transaction. He checks the local copy of the blockchain and verifies if Alice owns that one bitcoin that she wants to send. If Bob finds out that the transaction is valid, he broadcasts that to all networks and waits for others to confirm. Other peers also check their local copy and acknowledge the transaction. If maximum peers confirm the transaction valid then that transaction gets added to the blockchain. And everyone will update their copy of ledger now, and Alice has one less bitcoin. Note: In actual cryptocurrency, validation occurs at a block-level rather than validating one transaction. Bob will validate a set of transactions and creates one block from it and will broadcast that transaction over the network to validate. 6) Still, there is one problem with this approach. Here, we are using Bob as a validator. But what if he is a fraud. He might say that transaction is valid even if its invalid, and he has thousands of automated bots to support him. This way the whole blockchain will follow bots and accept the invalid transaction (Majority wins). Double spending use case In this example, Alice has one bitcoin. Still, she creates two transactions: one to Bob and another to Sam. Alice waits for the network to accept the transaction to Bob. Now Alice has 0 bitcoins. If Alice validates her own transaction to Sam and says it's valid (Alice has no bitcoin left to spend), and she has a large number of bots to support her, then eventually the whole network will accept that transaction, and Alice will double spend the bitcoin. 7) We can solve this problem with the POW (Proof of Work) consensus algorithm. Proof of Work consensus algorithm This is a puzzle that one has to solve while validating the transactions present in the block. Here you can see that the block has a size of around 1MB. So, you need to append any random number to the block and calculate hash, so that the hash value will have a starting string of zeros as shown in the image. Blockchain decides this number, and then the next block miner has to calculate a random number so that hash has that many zeros in the beginning. To solve this puzzle, the miner has to try Peta combinations to get the answer. As this is a very complex process, miners get rewarded after the validation of the block. But how can we solve the above problem using mining? Suppose the blockchain network has 10,000 active mining nodes with the same computational power. The probability that one can mine is only 0.01%. If one wants to do fraud transactions, he should have huge mining power to validate the block and convince other nodes to accept the invalid block. To do this, one needs to own more than 50% of computational power, that is very difficult. Now we have a prototype cryptocurrency model ready with us. Note: Each blockchain node follows the majority. Even if a transaction is invalid, but with more than 51% of nodes say it's valid, the whole network will be convinced and go rogue. This means that any group owns 51% of computational power(hash power), controls the whole blockchain network. This is known as a 51% attack. Blockchain-based services: * Golem: Distributed computing platform. * Iexec: Distributed computing platform. * Sia distributed storage: Distributed storage, SLA is managed over the blockchain. * Ethrise: Insurance platform developed on Ethereum ecosystem. * Maecenas: Blockchain-based Auction of file arts. * More than 2000 cryptocurrency platforms. Disadvantages of Blockchain: There are a few limitations to blockchain-based solutions. * Crime: Due to its encryption and anonymous nature, blockchain solutions influence crimes. * Data size: Full nodes stores all transactional data and requires over 100 GB disk space. * Throughput: Blockchain systems are very slow. Bitcoin can perform only 5 transactions per sec, while any financial bank can do more than 24000 transactions per sec. [5d8c638b4b] blockchain Bitcoin Crypto Cryptocurrency About the Author Shubham is a Software Engineer at Velotio. He is a certified Neo4J professional and works as a backend developer, mainly on Python and Golang. He is passionate about Blockchain and cryptocurrency. [5d52c5d6d4][5d52c5f32d] [60aad59f82][60aad68ccc512e0b4c819279_circ] Did you like the blog? If yes, we're sure you'll also like to work with the people who write them - our best-in-class engineering team. We're looking for talented developers who are passionate about new emerging technologies. If that's you, get in touch with us. Explore current openings About Velotio Velotio Technologies is an outsourced software product development partner for top technology startups and enterprises. We partner with companies to design, develop, and scale their products. Our work has been featured on TechCrunch, Product Hunt and more. We have partnered with our customers to built 90+ transformational products in areas of edge computing, customer data platforms, exascale storage, cloud-native platforms, chatbots, clinical trials, healthcare and investment banking. Since our founding in 2016, our team has completed more than 90 projects with 220+ employees across the following areas: * Building web/mobile applications * Architecting Cloud infrastructure and Data analytics platforms * Designing AI/ML-based solutions * Intelligent Chatbots Talk to us Subscribe to get the latest technology updates [ ][ ][ ]I agree to Velotio's Privacy Policy[Subscribe] Thanks! You've been subscribed! Oops! Something went wrong while submitting the form. Related Posts Building a WebSocket Service with AWS Lambda & DynamoDB Improving Elasticsearch Indexing in the Rails Model using Searchkick Test Automation in React Native apps using Appium and WebdriverIO Building Google Photos Alternative Using AWS Serverless Optimize React App Performance By Code Splitting Building a Collaborative Editor Using Quill and Yjs How to Use Pytest Fixtures With Django Models Getting Started With Golang Channels! Here's Everything You Need to Know Set Up Simple S3 Deployment Workflow with Github Actions and CircleCI Eliminate Render-blocking Resources using React and Webpack How to Test the Performance of Flutter Apps - A Step-by-step Guide Automating Serverless Framework Deployment using Watchdog Building Scalable and Efficient React Applications Using GraphQL and Relay Implementing Federated GraphQL Microservices using Apollo Federation Implementing Async Features in Python - A Step-by-step Guide Building Type Safe Backend Apps with Typegoose and TypeGraphQL UI Automation and API Testing with Cypress - A Step-by-step Guide An Introduction to React Fiber - The Algorithm Behind React Using DRF Effectively to Build Cleaner and Faster APIs in Django The 7 Most Useful Design Patterns in ES6 (and how you can implement them) Enable Real-time Functionality in Your App with GraphQL and Pusher Set Up A Production-ready REST API Server Using TypeScript, Express And PostgreSQL Building High-performance Apps: A Checklist To Get It Right Building a Progressive Web Application in React [With Live Code Examples] Node.js vs Deno: Is Deno Really The Node.js Alternative We All Didn't Know We Needed? Building Dynamic Forms in React Using Formik Building A Scalable API Testing Framework With Jest And SuperTest Publish APIs For Your Customers: Deploy Serverless Developer Portal For Amazon API Gateway Building Scalable Front-end With Lerna, YARN And React In 60 Minutes Implementing gRPC In Python: A Step-by-step Guide How To Use Inline Functions In React Applications Efficiently Micro Frontends: Reinventing UI In The Microservices World Cleaner, Efficient Code with Hooks and Functional Programming A Primer To Flutter Scalable Real-time Communication With Pusher MQTT Protocol Overview A Beginner's Guide to Python Tornado Build and Deploy a Real-Time React App Using AWS Amplify and GraphQL Idiot-proof Coding with Node.js and Express.js The Ultimate Cheat Sheet on Splitting Dynamic Redux Reducers Understanding Node.js Async Flows: Parallel, Serial, Waterfall and Queues Creating GraphQL APIs Using Elixir Phoenix and Absinthe An Introduction to Asynchronous Programming in Python A Beginner's Guide to Edge Computing Deploy Serverless, Event-driven Python Applications Using Zappa Web Scraping: Introduction, Best Practices & Caveats API Testing Using Postman and Newman Surviving & Thriving in the Age of Software Accelerations Node.js - Async Your Way out of Callback Hell with Promises, Async & Async/Await What is Gatsby.Js and What Problems Does it Solve? A Step Towards Simplified Querying in NodeJS Building Your First AWS Serverless Application? Here's Everything You Need to Know Game of Hackathon 2019: A Glimpse of Our First Hackathon Automation Testing with Nightwatch JS and Cucumber: Everything You Need to Know How to Implement Server Sent Events Using Python Flask and React How to Make Asynchronous Calls in Redux Without Middlewares Introduction to the Modern Server-side Stack - Golang, Protobuf, and gRPC [611cd2c7ad][611cd2ca38][6116a6c5e1][611cd2cba016890b] [617bed24f1456230] Services By Company Stage Early Stage Startups High-growth Startups High-growth Startups Enterprise By Engagement Model Remote Engineering Team Product Development Outsourcing Strategic Offshoring Expertise Full Stack Development UI/UX Design Backend / Middleware QA / Test Engineering Cloud & DevOps CI/CD & Infrastructure Automation Kubernetes Adoption Machine Learning & Data Engineering Machine Learning & AI Data Engineering & ETL Pipelines Chatbots Company About Us Culture Careers FAQ Contact Us Resources Engineering Blog (c) 2021 Copyright Velotio. All Rights Reserved. | Privacy Policy [5d1743108e][5d1743a4f6][5d1743b16a][5d19cde5f6] *