Web2 and Web3 developers don’t always have the kindest view of one another. They think Web3 is all scams and we think Web2 is stuck in the stone age with a technology that doesn’t take advantage of the distributed technology landscape. Both of these are unfair: any hype cycle draws unethical opportunists and technology isn’t better just because it’s newer.
But it’s time to call a truce and explore the real differences, the pros and cons. Much of the divide comes from a misunderstanding of the underlying technology and a focus on the negative headlines that ignore the meaningful businesses being built at scale. That’s why we’ve created the XRP Ledger Learning Portal, which helps Web2 builders transition to Web3. Discover the Web2-to-Web3 course to bridge the hole and begin making use of blockchain ideas to your tasks. Uncover how these worlds complement one another!
This text will discover the place the 2 applied sciences share similarities, how Web2 devs can bridge that information hole, and the place blockchain applied sciences can profit Web2 tasks.
Your common Web2 developer appears to be like at their stack and sees, roughly, frontend code, backend companies, APIs, and databases. They management the situation and upkeep of many of those items, however there are many them that they don’t—APIs, cloud storage, database companies, and so forth. You could have authentication the place you retailer login and entry data, however simply as incessantly you’ll useOAuth2 or one thing comparable, which means you rely a minimum of partially on a third-party.
Web3 functions have many of those identical options. The blockchain is basically only a database, albeit distributed throughout friends. Transactions to the blockchain retailer information, which may then be searched through acquainted API calls. The information there belongs to anybody who makes use of the ledger, however it might’t be tampered with (until you one way or the other modify each copy of the info saved on all servers related to that chain).
Whereas many Web2 devs are used to straightforward CRUD apps—create, learn, replace, and delete—blockchains are append only. When you ship one thing to the ledger, it’s there endlessly, no take-backsies. Everybody who makes use of a given chain can retailer information on that very same chain, and all information is seen to everybody else (until the info is hashed or in any other case encrypted). Safety by means of obscurity is an anti-pattern in software program engineering, why isn’t it in monetary companies?
The way in which you work together with the blockchain (and any sensible contracts therein) are by means of APIs. Anybody who has constructed fashionable net apps is aware of that a lot of the backend happens by means of APIs, whether or not these are in-house or third-party. However the request/response dynamic of APIs works the identical when the API is related to a blockchain. Ultimately, it’s only a POST request.
With commonplace APIs and cloud-based companies, you’d should authenticate and move entry tokens along with your requests. With a Web3 app, the pockets handles the auth course of. As a substitute of tokens, you’ll must signal each transaction along with your pockets. Signing into your pockets can use different auth strategies together with OAuth2, however your pockets controls entry to the ledger.
The rationale that every one auth runs by means of the pockets is that transactions on the ledger value forex to execute—lower than bank card transactions, however not nothing. Most hosted databases have some form of price for information switch, however these databases don’t focus on executing and storing transactions. Monetary transactions normally undergo some form of API that takes a proportion of the full worth. XRP Ledger (XRPL) transactions value a fraction of these charges—in comparison with each conventional monetary APIs and different Web3 choices—and will not be managed by a single entity, because the ledger is open-source and decentralized.
Whereas there are numerous analogs that make it straightforward to know map Web3 to Web2 tech, there are a number of elements which will make conventional net builders a little bit nervous. Most Web2 devs are used to having full management over their tech stack, whereas the blockchain is decentralized. Whether or not it runs domestically or of their cloud situations, their code and information lives in locations that they personal.
You don’t essentially quit full management of your information. Along with operating a node server, which connects to a blockchain and shops the info for simple entry, you may as well run your personal validator server. Validators confirm and commit transactions, so it is possible for you to to find out what is taken into account legitimate on the blockchain. As a aspect profit, this additionally helps the community proceed to thrive.
On high of the decentralization, Web2 devs might take a look at the mix of append-only transactions and transparency by default with sweaty palms. We’ve all learn tales of parents discovering secrets and techniques like API keys in public repos—a secret despatched to a blockchain is basically there endlessly. That is the place operating on a testnet is essential. You’ll be able to take a look at every part on an area testnet earlier than sending it to the livenet. Heck, you possibly can spin up your personal testnet if full management is that essential to you.
Having mentioned a number of the variations, I believe it’s time we switched to what these two worlds have in widespread. There’s a lot for a Web2 dev to seek out acquainted in a Web3 paradigm with a number of new ideas to know. However within the subsequent part, I wish to zoom in on one characteristic explicit to XRPL that can assist Web2 leap into Web3 programming sooner.
So what if it’s essential do extra along with your transaction than simply retailer it on the blockchain? You could have heard about sensible contracts, which is able to set off some form of motion when they’re referred to as. However you primarily have to write down your personal API and code for that contract, which might be numerous work and requires testing to get proper, identical as you’ll for those who had been writing your personal API endpoints.
For a lot of blockchains, you possibly can write sensible contracts that self-execute when sure circumstances are fulfilled. It’s important to write all of the code, set the parameters, take a look at, and audit every part about it, then deploy it to your blockchain of selection. Pattern code may help you get began, however errors in a contract can happen. You could solely discover the error after a contract executes, which might be expensive.
On the XRP Ledger blockchain, there are current constructing blocks, that are like premade API capabilities that function on the ledger. You don’t want to write down any code. All it’s essential do is know the parameters—learn the docs for the perform that you just wish to use and you’re able to go. These capabilities are native to the blockchain and require no further work.
Whereas a wise contract wants further testing and auditing, these constructing blocks undergo rigorous testing and are written by core ledger builders so all edge circumstances are mechanically dealt with. They package deal widespread options like tokens, non-fungible tokens (NFTs), automated market makers (AMMs), and so forth. so that you just needn’t write your personal implementation of these options—this ensures they’re all interoperable with one another.
For devs used to APIs, you’ll have to deal with a little bit extra latency than you’re used to as a result of validation of each transaction. On the XRPL, a transaction normally takes between 4 and eight seconds to be validated; different blockchains may very well be longer (for instance, Bitcoin usually takes about an hour for a transaction to be thought-about validated). If there are any delays in validating the transaction, APIs might reply with an acknowledgement at first, then comply with with a full response payload later. Most libraries provide async capabilities that can look ahead to transactions to be thought-about absolutely validated, so you possibly can construct async interfaces for those who count on to work together with contracts or fastened capabilities that can take some time to reply.
To this point, we’ve talked in regards to the Web3 tech that maps to Web2 ideas. Subsequent, let’s discover the brand new talents that including blockchain capabilities to your repertoire will unlock.
Whereas a blockchain ledger is analogous to a database, that’s not the use case the place a Web2 developer goes to seek out the perfect outcomes. A blockchain shines in monetary use circumstances. You get near-instantaneous worth switch around the globe with a blockchain versus the times that banks take to settle any transaction. That is what’s known as the Web of Worth, which is all about shifting funds and worth around the globe with the identical ease of sending an electronic mail.
Sometimes, a Web2 developer would add monetary capabilities by means of a bank card processor or different monetary companies supplier. These companies take a not insignificant portion of the cost as their due—as much as three p.c on some bank card processors. Bank card corporations just lately settled a lawsuit over these fees, which might be one of many largest bills that small companies face. There’s nonetheless a value on blockchain transactions, nevertheless it’s a lot decrease—usually a fraction of a US cent.
Because the lawsuit talked about above reveals, having one or two large entities management the cost course of for nearly each transaction isn’t all the time the perfect for patrons. The blockchain eliminates middlemen. As a substitute of trusting a single entity loads, you’re trusting numerous entities a little bit. It eradicates intermediaries, verifying funds in a approach that’s clear and decentralized.
Keep in mind at the start once I mentioned that Web2 devs side-eye Web3 apps as all scams? The reality is {that a} clear, peer-validated blockchain truly prevents numerous cost scams. Some particular person sellers and small retailers have been topic to online refund scams and request and refund scams. Transactions can’t be rolled again by sneaky consumers; refunds should be initiated as a transaction from vendor to purchaser.
Typically you run into an API that doesn’t fairly meet your wants—nearly, however not fairly. Think about for those who might add a little bit customization to the API itself, as an alternative of needing to rewrite the entire thing from scratch. Further programmability for fixed functions is coming, which is able to assist you to just do that. You’ll be capable of add your personal customizations to current fastened capabilities in order that no matter particular enterprise logic you have got is mirrored and included in these blockchain-native capabilities.
There’s numerous widespread ideas between Web2 and Web3 growth. A lot of the tech concerned truly crosses between paradigms—you continue to want a frontend and a backend. A blockchain is de facto only a distributed database that a number of friends keep and validate. You’ll should get used to the full transparency, distributed management, and append-only nature of it, however you’ll be higher off when you do.
For the monetary use circumstances at which XRPL and different blockchains excel, these are advantages, not negatives. Transactions which might be seen to all, immutable, and below nobody’s full management present a reliable cost methodology with out having to belief particular person cost processors.
In case you’re able to take the following step in understanding blockchain and integrating these instruments into your tasks, take a look at our Web2 to Web3 XRPL Learning Portal course. It’s designed particularly for Web2 builders to get hands-on expertise with blockchain expertise, serving to you bridge the hole and construct confidently on this new paradigm.