Network
Launch Date
Consensus
Note
Sepolia
Oct 2021
PoW
Like-for-like representation of Ethereum
Görli
Jan 2019
PoA
Proof-of-Authority
Kiln
Mar 2022
PoS
Post-Merge (for ETH2), shadow fork of the mainnet
Kintsugi
Dec 2021
PoS
DEPRECATED, use Kiln; post-Merge (for ETH2)
Ropsten
Nov 2016
PoW
DEPRECATED, use Sepolia; the Merge to happen on Jun 8, 2022
Rinkeby
Apr 2017
PoA
DEPRECATED, use Görli and Görli Faucet
Kovan
Mar 2017
PoA
DEPRECATED, use Sepolia or Görli
List of active and deprecated Ethereum testnets, including Kintsugi.
Features
Optimistic rollup 
ZK-rollup 
Proof
Uses fraud proofs to prove transaction validity. 
Uses validity (zero-knowledge) proofs to prove transaction validity. 
Capital efficiency
Requires waiting through a 1-week delay (dispute period) before withdrawing funds. 
Users can withdraw funds immediately because validity proofs provide incontrovertible evidence of the authenticity of off-chain transactions. 
Data compression
Publishes full transaction data as calldata to Ethereum Mainnet, which increases rollup costs. 
Doesn't need to publish transaction data on Ethereum because ZK-SNARKs and ZK-STARKs already guarantee the accuracy of the rollup state. 
EVM compatibility
Uses a simulation of the Ethereum Virtual Machine (EVM), which allows it to run arbitrary logic and support smart contracts. 
Doesn't widely support EVM computation, although a few EVM-compatible ZK-rollups have appeared. 
Rollup costs
Reduces costs since it publishes minimal data on Ethereum and doesn't have to post proofs for transactions, except in special circumstances. 
Faces higher overhead from costs involved in generating and verifying proofs for every transaction block. ZK proofs require specialized, expensive hardware to create and have high on-chain verification costs. 
Trust assumptions
Doesn't require a trusted setup. 
Requires a trusted setup to work. 
Liveness requirements
Verifiers are needed to keep tabs on the actual rollup state and the one referenced in the state root to detect fraud. 
Users don't need someone to watch the L2 chain to detect fraud. 
Security properties 
Relies on cryptoeconomic incentives to assure users of rollup security. 
Relies on cryptographic guarantees for security. 
Start building
on Alchemy.
Sign up for free
Start building on Optimism.
Sign up for free
Start building on Arbitrum.
Sign up for free
Start building on Ethereum.
Sign up for free
Start building on Polygon.
Sign up for free
Start building on Starknet.
Sign up for free
Start building on Flow.
Sign up for free
kiln faucet
Get free Kiln ETH.
Start building today
Goerli faucet
Get free Goerli ETH.
Start building today
SEPOLIA FAUCET
Get free Sepolia ETH.
Start Building Today
mumbai faucet
Get free Mumbai Matic.
Start building today
rinkeby faucet
Get free Rinkeby
ETH.
Start building today
Start building on Ethereum.
Get started for free
Start building on Ethereum.
Get started for free
Start building on Flow.
Get started for free
Start building on Polygon.
Get started for free
Start building on Starknet.
Get started for free
Start building on Optimism.
Get started for free
Start building on Solana.
Get started for free
Start building on Solana.
Sign up for beta access
Start building on Solana.
Join the waitlist
Arbitrum logo
Start building on Arbitrum.
Get started for free
Learn
Solidity at
Alchemy
University
Get started today
curl 
https://release.solana.com/v1.10.32/solana-install-init-x86_64-pc-windows-msvc.exe 
--output 
C:\solana-install-tmp\solana-install-init.exe 
--create-dirs
Web3 Tools
WEBSOCKETS OVERVIEW

What is a WebSocket?

What They Are and How They Work in Web3
Last Updated:
June 20, 2022

WebSocket is a bidirectional communication protocol based on TCP that standardizes communication between a client and a server, allowing for both parties to request data from one another. In contrast, a unidirectional protocol like HTTP only allows for the client to request data from the server. 

A WebSocket connection between a client and a server can stay open as long as the parties wish it to maintain the connection, allowing for continuous communication.

With HTTP, each connection begins when the client makes a request and ends the connection when the request is fulfilled.

WebSockets may be superior for Web3 dApp notifications because they enable real-time notifications for critical events continuously compared to requiring individual requests. Tools like Alchemy Notify make it simple to add real-time notifications to wallets and dApps. 

What is WebSocket?

WebSocket is a bidirectional communication protocol that enables interactive communication sessions between a client and server. It’s based on TCP and is often used for apps and services that want real-time notification capabilities.  

What is a WebSocket server?

A WebSocket server is an application that is listening on a TCP port, following a specific protocol. WebSocket is a bidirectional communications protocol between a client and a server, allowing for both of them to request and send data to one another. 

In contrast, HTTP is a unidirectional communications protocol, where the client can only send requests to the server and the server can only send data back in response—never can the server in a HTTP relationship request from the client.

What is a WebSocket connection?

A WebSocket connection is a continuous connection between the client and server. In contrast, HTTP connections are one-time only. The connection begins with every request the client makes from the server and ends with the server’s response. WebSocket connections can be maintained for as long as the client and servers wish it to be open, meaning data can flow through that WebSocket as long as the parties wish—all from one initial request.

What protocol does WebSocket use?

WebSocket uses the WS protocol, which is based on the Transmission Control Protocol (TCP). It is a connection-oriented network, meaning a connection between participants has to be established first to route data through to the right location. 

In contrast, the Internet Protocol determines where data is sent based on information within that packet of data; no pre-setup is required to route the packet. 

What is a WebSocket API?

There are two ways for a server to send data to a client. The client can regularly request data from the server, known as polling, or the server can automatically send data to the client, known as server push

WebSocket APIs take advantage of the connection between the client and server by staying open after the initial request to use the server pushing technique, removing the infrastructure stress created from clients constantly polling the server for new updates.

How do WebSockets work?

WebSockets are a bidirectional communication method, allowing for multiple responses from a single server request. WebSockets are also mostly used for client-server communication, while webhooks are mostly used for server-server communication. 

How do WebSockets work differently compared to webhooks?

In contrast to WebSockets, webhooks, which use HTTP, are strictly unidirectional: the server only responds to applications when a request is made, and every time a request is fulfilled, the connection is terminated. 

Alchemy Notify uses webhooks to communicate between servers and WebSockets to push the notifications that the dApp user sees.

What are web3 WebSockets used for?

Alchemy’s Subscription API provides two new API methods that extend the functionality of the original Ethereum API - eth_subscribe and eth_unsubscribe - that enable Web3 developers to use WebSockets for continually receiving information or data such as getting pending transaction information, pending transaction hashes, new header blocks, and logs.

Here are the supported methods of Alchemy’s Subscription API that uses WebSockets:

  • alchemy_newFullPendingTransactions - returns the full transaction information (not just transaction hashes) for all transactions that are added to the pending state
  • ​​alchemy_filteredNewFullPendingTransactions - returns the transaction information for all pending transactions that match a to or from address filter
  • newPendingTransactions - returns the hash for all transactions that are added to the pending state regardless if you sent them or not
  • newHeads - sends an event each time a new header (block) is added to the blockchain
  • logs - sends logs that are part of newly added blocks that match specified filter criteria

When any existing WebSockets connection needs to be terminated, the eth_unsubscribe call can be used along with the subscription ID parameter.

When to use WebSockets vs Webhooks

The tradeoff between using WebSockets or webhooks comes from whether your infrastructure design can better handle many open WebSocket connections concurrently versus many webhook connection requests from clients.

If your server application runs as a cloud function (AWS Lambda, Google Cloud Functions, etc) use webhooks because the application will not keep the WebSocket connections open. 

If the quantity of notifications being sent is low, webhooks are also superior in that the connections are begun only on the condition of an event happening. 

If the event is rare, it is better to use webhooks than to keep open many WebSocket connections between the client and server. 

Lastly, whether one is trying to bridge a server with another server or a client and a server matters too; webhooks are better for the former, WebSockets for the latter. We’ve created a Github repo for setting up a webhook server

When to use the WebSocket Protocol

For many Web3 dApps, it’s mandatory to update your users in real-time on the status of their transactions. Otherwise, they may have a poor user experience and abandon your app or service. Alchemy Notify solves this by letting users know the exact status of their transactions.

When to use WebSockets over HTTP

WebSockets should be used over HTTP requests whenever latency needs to be the lowest amount possible so users receive notifications on events as fast as they happen. HTTP is comparatively much slower because the client is limited in how often it can receive updates by how often it sends out requests.

WebSocket Examples

We’ve created guides on how to implement Alchemy Notify to send in-app notifications updating your users for critical events like when their wallet balance changes. Here are a few tutorials we've published:

  1. Tracking pending and mined Ethereum transactions 
  2. Building a dApp with real-time transaction notifications
  3. Integrating Alchemy webhooks with Zapier

Alchemy Notify can even be used to send email notifications to your dApp users, preventing frustration on the status of their transactions.

ALCHEMY SUPERNODE - ETHEREUM NODE API

Scale to any size, without any errors

Alchemy Supernode finally makes it possible to scale blockchain applications without all the headaches. Plus, our legendary support will guide you every step of the way.

Get started for free
Supernode footer
Web3 Tools
WEBSOCKETS OVERVIEW

What Is a WebSocket and How Does It Work

What They Are and How They Work in Web3
Last Updated:
June 20, 2022
Don't miss an update
Sign up for our newsletter to get alpha, key insights, and killer resources.
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
Table of Contents

{{building-alchemy-ad}}

WebSocket is a bidirectional communication protocol based on TCP that standardizes communication between a client and a server, allowing for both parties to request data from one another. In contrast, a unidirectional protocol like HTTP only allows for the client to request data from the server. 

A WebSocket connection between a client and a server can stay open as long as the parties wish it to maintain the connection, allowing for continuous communication.

With HTTP, each connection begins when the client makes a request and ends the connection when the request is fulfilled.

WebSockets may be superior for Web3 dApp notifications because they enable real-time notifications for critical events continuously compared to requiring individual requests. Tools like Alchemy Notify make it simple to add real-time notifications to wallets and dApps. 

What is WebSocket?

WebSocket is a bidirectional communication protocol that enables interactive communication sessions between a client and server. It’s based on TCP and is often used for apps and services that want real-time notification capabilities.  

What is a WebSocket server?

A WebSocket server is an application that is listening on a TCP port, following a specific protocol. WebSocket is a bidirectional communications protocol between a client and a server, allowing for both of them to request and send data to one another. 

In contrast, HTTP is a unidirectional communications protocol, where the client can only send requests to the server and the server can only send data back in response—never can the server in a HTTP relationship request from the client.

What is a WebSocket connection?

A WebSocket connection is a continuous connection between the client and server. In contrast, HTTP connections are one-time only. The connection begins with every request the client makes from the server and ends with the server’s response. WebSocket connections can be maintained for as long as the client and servers wish it to be open, meaning data can flow through that WebSocket as long as the parties wish—all from one initial request.

What protocol does WebSocket use?

WebSocket uses the WS protocol, which is based on the Transmission Control Protocol (TCP). It is a connection-oriented network, meaning a connection between participants has to be established first to route data through to the right location. 

In contrast, the Internet Protocol determines where data is sent based on information within that packet of data; no pre-setup is required to route the packet. 

What is a WebSocket API?

There are two ways for a server to send data to a client. The client can regularly request data from the server, known as polling, or the server can automatically send data to the client, known as server push

WebSocket APIs take advantage of the connection between the client and server by staying open after the initial request to use the server pushing technique, removing the infrastructure stress created from clients constantly polling the server for new updates.

How do WebSockets work?

WebSockets are a bidirectional communication method, allowing for multiple responses from a single server request. WebSockets are also mostly used for client-server communication, while webhooks are mostly used for server-server communication. 

How do WebSockets work differently compared to webhooks?

In contrast to WebSockets, webhooks, which use HTTP, are strictly unidirectional: the server only responds to applications when a request is made, and every time a request is fulfilled, the connection is terminated. 

Alchemy Notify uses webhooks to communicate between servers and WebSockets to push the notifications that the dApp user sees.

What are web3 WebSockets used for?

Alchemy’s Subscription API provides two new API methods that extend the functionality of the original Ethereum API - eth_subscribe and eth_unsubscribe - that enable Web3 developers to use WebSockets for continually receiving information or data such as getting pending transaction information, pending transaction hashes, new header blocks, and logs.

Here are the supported methods of Alchemy’s Subscription API that uses WebSockets:

  • alchemy_newFullPendingTransactions - returns the full transaction information (not just transaction hashes) for all transactions that are added to the pending state
  • ​​alchemy_filteredNewFullPendingTransactions - returns the transaction information for all pending transactions that match a to or from address filter
  • newPendingTransactions - returns the hash for all transactions that are added to the pending state regardless if you sent them or not
  • newHeads - sends an event each time a new header (block) is added to the blockchain
  • logs - sends logs that are part of newly added blocks that match specified filter criteria

When any existing WebSockets connection needs to be terminated, the eth_unsubscribe call can be used along with the subscription ID parameter.

When to use WebSockets vs Webhooks

The tradeoff between using WebSockets or webhooks comes from whether your infrastructure design can better handle many open WebSocket connections concurrently versus many webhook connection requests from clients.

If your server application runs as a cloud function (AWS Lambda, Google Cloud Functions, etc) use webhooks because the application will not keep the WebSocket connections open. 

If the quantity of notifications being sent is low, webhooks are also superior in that the connections are begun only on the condition of an event happening. 

If the event is rare, it is better to use webhooks than to keep open many WebSocket connections between the client and server. 

Lastly, whether one is trying to bridge a server with another server or a client and a server matters too; webhooks are better for the former, WebSockets for the latter. We’ve created a Github repo for setting up a webhook server

When to use the WebSocket Protocol

For many Web3 dApps, it’s mandatory to update your users in real-time on the status of their transactions. Otherwise, they may have a poor user experience and abandon your app or service. Alchemy Notify solves this by letting users know the exact status of their transactions.

When to use WebSockets over HTTP

WebSockets should be used over HTTP requests whenever latency needs to be the lowest amount possible so users receive notifications on events as fast as they happen. HTTP is comparatively much slower because the client is limited in how often it can receive updates by how often it sends out requests.

WebSocket Examples

We’ve created guides on how to implement Alchemy Notify to send in-app notifications updating your users for critical events like when their wallet balance changes. Here are a few tutorials we've published:

  1. Tracking pending and mined Ethereum transactions 
  2. Building a dApp with real-time transaction notifications
  3. Integrating Alchemy webhooks with Zapier

Alchemy Notify can even be used to send email notifications to your dApp users, preventing frustration on the status of their transactions.

WebSocket is a bidirectional communication protocol based on TCP that standardizes communication between a client and a server, allowing for both parties to request data from one another. In contrast, a unidirectional protocol like HTTP only allows for the client to request data from the server. 

A WebSocket connection between a client and a server can stay open as long as the parties wish it to maintain the connection, allowing for continuous communication.

With HTTP, each connection begins when the client makes a request and ends the connection when the request is fulfilled.

WebSockets may be superior for Web3 dApp notifications because they enable real-time notifications for critical events continuously compared to requiring individual requests. Tools like Alchemy Notify make it simple to add real-time notifications to wallets and dApps. 

What is WebSocket?

WebSocket is a bidirectional communication protocol that enables interactive communication sessions between a client and server. It’s based on TCP and is often used for apps and services that want real-time notification capabilities.  

What is a WebSocket server?

A WebSocket server is an application that is listening on a TCP port, following a specific protocol. WebSocket is a bidirectional communications protocol between a client and a server, allowing for both of them to request and send data to one another. 

In contrast, HTTP is a unidirectional communications protocol, where the client can only send requests to the server and the server can only send data back in response—never can the server in a HTTP relationship request from the client.

What is a WebSocket connection?

A WebSocket connection is a continuous connection between the client and server. In contrast, HTTP connections are one-time only. The connection begins with every request the client makes from the server and ends with the server’s response. WebSocket connections can be maintained for as long as the client and servers wish it to be open, meaning data can flow through that WebSocket as long as the parties wish—all from one initial request.

What protocol does WebSocket use?

WebSocket uses the WS protocol, which is based on the Transmission Control Protocol (TCP). It is a connection-oriented network, meaning a connection between participants has to be established first to route data through to the right location. 

In contrast, the Internet Protocol determines where data is sent based on information within that packet of data; no pre-setup is required to route the packet. 

What is a WebSocket API?

There are two ways for a server to send data to a client. The client can regularly request data from the server, known as polling, or the server can automatically send data to the client, known as server push

WebSocket APIs take advantage of the connection between the client and server by staying open after the initial request to use the server pushing technique, removing the infrastructure stress created from clients constantly polling the server for new updates.

How do WebSockets work?

WebSockets are a bidirectional communication method, allowing for multiple responses from a single server request. WebSockets are also mostly used for client-server communication, while webhooks are mostly used for server-server communication. 

How do WebSockets work differently compared to webhooks?

In contrast to WebSockets, webhooks, which use HTTP, are strictly unidirectional: the server only responds to applications when a request is made, and every time a request is fulfilled, the connection is terminated. 

Alchemy Notify uses webhooks to communicate between servers and WebSockets to push the notifications that the dApp user sees.

What are web3 WebSockets used for?

Alchemy’s Subscription API provides two new API methods that extend the functionality of the original Ethereum API - eth_subscribe and eth_unsubscribe - that enable Web3 developers to use WebSockets for continually receiving information or data such as getting pending transaction information, pending transaction hashes, new header blocks, and logs.

Here are the supported methods of Alchemy’s Subscription API that uses WebSockets:

  • alchemy_newFullPendingTransactions - returns the full transaction information (not just transaction hashes) for all transactions that are added to the pending state
  • ​​alchemy_filteredNewFullPendingTransactions - returns the transaction information for all pending transactions that match a to or from address filter
  • newPendingTransactions - returns the hash for all transactions that are added to the pending state regardless if you sent them or not
  • newHeads - sends an event each time a new header (block) is added to the blockchain
  • logs - sends logs that are part of newly added blocks that match specified filter criteria

When any existing WebSockets connection needs to be terminated, the eth_unsubscribe call can be used along with the subscription ID parameter.

When to use WebSockets vs Webhooks

The tradeoff between using WebSockets or webhooks comes from whether your infrastructure design can better handle many open WebSocket connections concurrently versus many webhook connection requests from clients.

If your server application runs as a cloud function (AWS Lambda, Google Cloud Functions, etc) use webhooks because the application will not keep the WebSocket connections open. 

If the quantity of notifications being sent is low, webhooks are also superior in that the connections are begun only on the condition of an event happening. 

If the event is rare, it is better to use webhooks than to keep open many WebSocket connections between the client and server. 

Lastly, whether one is trying to bridge a server with another server or a client and a server matters too; webhooks are better for the former, WebSockets for the latter. We’ve created a Github repo for setting up a webhook server

When to use the WebSocket Protocol

For many Web3 dApps, it’s mandatory to update your users in real-time on the status of their transactions. Otherwise, they may have a poor user experience and abandon your app or service. Alchemy Notify solves this by letting users know the exact status of their transactions.

When to use WebSockets over HTTP

WebSockets should be used over HTTP requests whenever latency needs to be the lowest amount possible so users receive notifications on events as fast as they happen. HTTP is comparatively much slower because the client is limited in how often it can receive updates by how often it sends out requests.

WebSocket Examples

We’ve created guides on how to implement Alchemy Notify to send in-app notifications updating your users for critical events like when their wallet balance changes. Here are a few tutorials we've published:

  1. Tracking pending and mined Ethereum transactions 
  2. Building a dApp with real-time transaction notifications
  3. Integrating Alchemy webhooks with Zapier

Alchemy Notify can even be used to send email notifications to your dApp users, preventing frustration on the status of their transactions.

Build web3 with Alchemy

Alchemy combines the most powerful web3 developer products and tools with resources, community and legendary support.

 Start building