From Web2 to Web3 How developers can upskill and build with blockchain
original address:From Web2 to Web3: How developers can upskill and build with blockchain (opens new window)
Why web3 is here to stay and how developers can build killer dapps.
# SPONSORED BY RIPPLE
Coming off the heels of 2022, it may be difficult to assess where web3 technologies stand in 2023. Bitcoin rose to $47,000 and fell to $16,000 (opens new window). NFT trading volumes (opens new window) peaked at $17B in January 2022 and a year later collapsed to a mere $143M. “Blockchain” and “digital currencies” became everyday terms in the mainstream media. We saw the collapse of FTX (opens new window) and all its cascading consequences.
It was a tumultuous year in the world of web3—full of speculation, crashes, and scandals. But does this mean that web3 is dead and the underlying technologies made obsolete? Hardly.
Though mainstream enthusiasm for NFTs and cryptocurrency has ebbed and flowed, the community is still very much alive and actively invested in not just the technology, but in ensuring the promises of a decentralized internet are realized. The world at large is frustrated with the data collection practices of the tech industry heavyweights. The global reach of eCommerce needs trustworthy payment systems that can operate worldwide. While much of the discussion around NFT collectibles focused on high profile acquisitions and losses, NFTs themselves have only scratched the surface of what’s possible.
# Web3 is here to stay
We are still in the early days of blockchain. Keep in mind that we’ve been using the term “web 2.0” since 1999 (24 years ago!) but blockchain quietly entered the market as an underpinning technology for Bitcoin in 2008 (15 years ago). That difference of nine years may sound small, but consider that nine years ago most large companies were just starting to move to the cloud.
Today, blockchain technologies power much more than basic cryptocurrency transactions. Banking and finance applications support cross-border payments that settle in seconds, not days. Multi- and cross-chain transactions via DeFi applications allow for increased crypto liquidity and improved exchanges with fiat currencies. Blockchain developers can build their own customized sidechains (more on those later) to support integration with real-time, low-cost transactions in video games and other use cases. SDKs are available in nearly every popular language, making it easy for today’s web2 developers to take their existing coding capabilities and embrace decentralized technology.
Emerging applications of blockchain and crypto include:
- Cross-border payments
- Real-time tracking of goods in supply chain and logistics
- Electronic health record storage
- Energy supply transaction tracking, including renewable energy certificates
- Citizenship and credential tracking across borders
- Documenting legal agreements, such as real estate and carbon credits
Despite everything that’s been reported in the news about crypto and blockchain this past year, their potential is still largely untapped. Blockchain advances are bringing economic and technical utility to both users and developers. It’s truly an emerging technology with seemingly endless opportunity.
# The tech behind the headlines
The technology comprising a blockchain is rather sophisticated. In the most simplistic sense, a blockchain is a database: it stores data in an ordered fashion. However, a blockchain doesn’t act as a simple database with all data on a single server, but rather as a distributed ledger (opens new window): multiple computers across the world store redundant copies of all the data in the blockchain and share the work of confirming transactions, without needing a central authority or intermediary.
In a blockchain, each node has a copy of the blockchain ledger and participates in the transaction validation process. New transactions are broadcast to the network, and nodes work together to verify the transaction data and add it to the blockchain. This process is known as consensus, and it ensures that all nodes on the network agree on the state of the blockchain and that it remains secure and tamper-proof.
While some blockchains are centralized and managed by a single organization, most are open source and decentralized, meaning they are managed and maintained by a community of developers. For example, the XRP Ledger is a public, permissionless blockchain (opens new window), meaning anyone on the internet can set up a validator and join the network. The reference implementation (opens new window) of the protocol is open source and any developer can propose amendments to this software. Because of the XRP Ledger’s decentralized nature, no singular authority can make decisions for the network. Instead, network changes are determined by a specific subset of validators, who vote on behalf of the XRP Ledger’s best interest. That being said, in order for amendments to pass, at least 80% of the validator community has to vote “yes” and that minimum threshold must be maintained for at least two weeks. If both of those conditions are met, then amendment proposals can be passed.
Consensus protocols run cryptographic functions to ensure the integrity of the network and its ledger. These usually include:
- Hash functions: Create a unique digital fingerprint of each transaction on the blockchain. They are one-way functions that take an input (e.g. a transaction) and produce a fixed-length, unique output based on that input (SHA-256 is an example of a hash function). Hash functions ensure the integrity of data because any error in transmission or other change results in a totally different hash value. If you get the same output from the hash function, you know you have the same input data.
- Public-key cryptography: Used for enabling secure communication between nodes on the network. Each node on the blockchain has a public key and a private key. The public key can be shared with anyone, while the private key is kept secret. Digital signatures are for ensuring the authenticity and integrity of transactions on the blockchain. Each transaction on the blockchain is signed using the sender’s private key, which creates a digital signature that can be verified using the sender’s public key.
Validator nodes execute the consensus protocol and can often run on commodity hardware (depending on the energy and computation requirements for the specific blockchain). Different blockchains use different consensus protocols to compute the final state of a transaction on the ledger.
Because the XRP Ledger is open source, anyone can learn how it works (opens new window), contribute to the code base, and report issues. Or they can simply write and consume apps; mint, manage and otherwise interact with NFTs; and much more.
# Consensus algorithms, energy consumption, and transaction times
The two most popular consensus algorithms have long been Proof of Work (opens new window) (PoW) and Proof of Stake (opens new window) (PoS).
In PoW algorithms, every node on the network competes to solve cryptography problems in order to validate a transaction. That’s fine for small networks of a few dozen computers, but multiply this computational cost over 100,000+ nodes and it adds up very quickly. This is compounded by the fact that the fastest nodes to validate transactions often receive financial rewards, hence a competitive arms race to deploy thousands of powerful, electricity-hungry GPUs to solve these cryptographic puzzles faster than other nodes in the network.
PoW methods are what led China to ban cryptocurrency mining (opens new window) altogether, the White House to issue a press release (opens new window) about energy concerns, and the Ethereum community to push for and switch to the more energy-efficient PoS methodology in 2022.
In PoS algorithms, instead of solving a cryptographic puzzle on every node, nodes that hold a larger stake in the network (i.e. the greater the number of tokens, the greater the stake in the blockchain) are the ones to validate transactions. They still perform a cryptographic validation process, but it’s only a fraction of the nodes on the network with the biggest stake. The algorithms are no less complex and the validation mechanisms are similar to PoW, which is why PoS transactions can also take minutes or hours to be validated.
Ethereum moved to PoS “because it is more secure, less energy-intensive, and better for implementing new scaling solutions compared to the previous proof-of-work architecture.” It was a tremendous shift in how that chain operated and resulted in more than 99.9% reduction (opens new window) in electricity consumption. So tremendous, in fact, that they termed it The Merge (opens new window). According to CoinTelegraph (opens new window), Ethereum on PoW was using 112 TWh per year and on PoS is now using 0.01 TWh per year. For reference, Bitcoin is still using tremendous energy (opens new window)—more than many countries on earth.
There are many alternatives to PoS and PoW algorithms, with various tradeoffs to speed, centralization, and efficiency. Chains such as the XRP Ledger and Stellar use “federated consensus” or “proof of association” algorithms where a subset of nodes collectively build and agree on the next block of transactions. Other chains, such as Ignite, use hybrid systems that combine elements of federation and PoS. These systems are far more efficient than PoW and faster than both PoW and PoS because they eschew the wasteful work of competing to solve cryptographic puzzles. For example, transactions on the XRPL take[ 3-5 seconds](https://xrpl.org/xrp-ledger-overview.html#:~:text=XRPL uses a consensus protocol,transactions every 3-5 seconds.) to be validated, rather than minutes or hours.
Additionally, both PoW and PoS typically let the winning validator build a block however they like—which leads to miners and validators gaming the system to get the maximum extractable value (MEV) from each block. Federated consensus algorithms are typically less susceptible to these problems because they always arrange each block of transactions in a canonical order.
# Making developers’ lives easier with abstractions, dApps, and smart contracts
Web2 brought us rich application experiences, cloud computing, asynchronous communication, and plenty of centralization. It’s practically impossible to develop a web2 app without paying corporations and being subject to their privacy policies, terms and conditions, and fiduciary responsibility. Web3 gives developers the ability to write and run apps that are fully-independent, widely-available, and decentralized. No limits and no corporate dependencies.
To make this a reality, most major blockchains are working hard to attract and onboard developers to their platforms with easy-to-use SDKs and high-quality documentation (e.g. Solana (opens new window), Cardano (opens new window), XRPL (opens new window)). Open-source blockchains are widely available and provide fertile ground for innovation. Each has built-in support for financial transactions using their native tokens (e.g. SOL, ADA, XRP), ensuring that people can pay and be paid.
Many chains support the development of dApps—decentralized applications. They can be written in a variety of programming languages, depending on what the chains support. Generally speaking, the larger the developer community of a given chain, the more languages it supports. For example, Ethereum supports .NET, Go, Java, JavaScript, Python, Ruby, Rust, Dart, and Delphi. The XRPL supports Python, JavaScript/TypeScript, C++, Java, React.js and Ruby.
Some blockchain apps are backed by or written as smart contracts. Smart contracts are tamper-proof, immutable pieces of code that live on the blockchain and facilitate interactions or agreements between the app, the user, and the chain. Blockchains offer simple abstractions and SDKs so developers can get up and running quickly with app development. For example, Ethereum offers a variety of application development tools (opens new window) to help people experiment, build front ends, and test their dApps and smart contract implementations. The downside to smart contracts is that, since they’re immutable and shared online, if anyone finds a bug in the contract’s code, they can exploit it to their advantage, and the developer can’t easily patch the vulnerability away. This makes developing smart contracts a delicate task with higher stakes than many other projects.
The XRP Ledger supports programmability through a number of protocols and standards. It includes native transactors (opens new window) that provide out-of-the-box functions which are already battle-tested and standardized. The Hooks (opens new window) proposal would further extend programmability on the Ledger. Hooks are small, efficient pieces of code that allow for the quick and easy execution of logic before and after a transaction — all native to the Ledger. This is important because standard smart contracts can be complex and difficult to navigate, especially for developers that are new to web3.
Unlike other protocols, the XRPL also has native support (opens new window) for NFTs, which means developers don’t need to build or maintain a smart contract in order to bring their NFT projects to life. This lowers the barrier to entry for developers, creators, and anyone else who wants to interact with NFTs on the XRPL. Additionally, automatic royalties (opens new window) are enforced at the protocol level which helps ensure maximum value for creators and developers. Core operations such as minting and burning are native to the Ledger to promote ease-of-use regardless of experience level.
An upcoming amendment, XLS-30d (opens new window), proposes a native Automated Market Maker (AMM (opens new window)) on the XRPL. The proposal will include bid and vote features, allow for simple token swaps, and should create deep liquidity between token and currency pairs. The AMM’s functionality allows application developers to create interfaces for traders and liquidity providers (LPs) and introduces a novel auction mechanism that incentivizes arbitrageurs while reducing the impact of impermanent loss faced by LPs.
# Developers make the chain better—for everyone
The XRPL community is also currently testing sidechains. Sidechains allow developers to build and experiment with customized features in a sandbox-like environment—connected to, yet distinct from the mainnet—enabling innovation without disrupting or compromising the mainnet. Sidechain features could eventually be proposed as amendments and be merged into mainnet if voted on by the community. There is also ongoing development and testing of an Ethereum Virtual Machine (EVM) sidechain (opens new window) to bring Ethereum’s native Solidity (opens new window)-based smart contracts to the XRPL ecosystem.
As developers do more work on blockchains, we’ll inevitably see improvements in utility, security, scalability, cost and sustainability. The more adoption, the greater the improvements, and the greater the likelihood that more developers (and users) will further adopt this technology. The network effect and a fast-growing list of innovative features are already appealing to developers who want to move on from web2 conventions.
# How developers can upskill and start building
The innovations underpinned by blockchain and advantages over web2 are getting hard to ignore. Web3 protocols are making it easier than ever to build on decentralized technologies. Web3 tech isn’t just “an upgrade” or “a step up” from web2—it’s a whole new paradigm of working on applications. They’re decentralized, permissionless, scalable, and stable. Developers can use what they already know and upskill to web3 technologies. For once, they can have skin in the game with full ownership of their assets and intellectual property. Using the programming languages they already know, they can increase their domain expertise and take advantage of decentralization.
When choosing a chain to start on, developers should consider:
- Adoption: Do you want to build on a prime-time chain with lots of users, an up-and-coming chain with a growing user base, or get in early on something brand new?
- Ease of development: Is there sufficient documentation, fully-featured and supported SDKs, an ecosystem of existing dApps to explore, and low-friction onboarding?
- Ledger functionality and transaction time: How does consensus work? Is it efficient and quick?
- Environmental impact: Are energy consumption and sustainability priorities for the blockchain?
- Time to first dApp: How long does it take to build an app? Minutes? Hours? Weeks?
- Community: Is there a living, vibrant user and developer base? Are they passionate about the chain, its growth, and web3?
Blockchain and crypto have the power to enable a better future, and there is a vibrant community of developers that are building, testing and iterating on top of the technology to help uncover future use cases and applications. Ripple is just one contributor among many to the XRP Ledger; as members of this developer community we are deeply committed to helping it grow and thrive.
There are a number of programs like grants (opens new window) and bounties (opens new window) to help developers of all levels get started with the funding and resources they need to bring their web3 projects and applications to life. The XRP Ledger also recently launched an online learning portal (opens new window) where developers can learn more about the basics of crypto and blockchain, or dive straight into coding on the XRPL with courses in languages such as React.js (currently in beta) (opens new window).
For additional information or to join the community, check out the developer Discord (opens new window), view open source code and repos on GitHub (opens new window), and follow @RippleXDev on Twitter (opens new window) where we regularly share updates, projects, new features, and fixes from the XRPL community.