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
Build with Alchemy's
Gas Manager & Bundler APIs
Learn
Solidity at
Alchemy
University
Get started today
Build with Alchemy's
Gas Manager & Bundler APIs
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
Learn Solidity
CONTRACT INTERFACE OVERVIEW

What is the Solidity contract interface?

Everything You Need to Know About Solidity's Smart Contract Interface
Last Updated:
October 4, 2022
Table of Contents
Table of Contents
Table of Contents

{{learn-solidity}}

Solidity is an object-oriented, high-level language for implementing smart contracts. While writing smart contracts in Solidity, you may want to use interfaces to interact with other smart contracts. Knowing how to use interfaces will help you increase your knowledge of the Solidity language and may give you some new ideas on other interesting Solidity smart contracts you can build.

In this article, we explain what a Solidity contract interface is and show you how to create one. We provide some examples for interface implementation and declaration to serve as guides as you write one. 

What is the Solidity interface?

A Solidity contract interface is a list of function definitions without implementation. In other words, an interface is a description of all functions that an object must have for it to operate. The interface enforces a defined set of properties and functions on a contract.

Solidity allows you to interact with other contracts without having their code by using their interface. For example, if you want to interact with another contract from your own contract, you provide your calls with an interface wrapper. By declaring an interface, you can interact with other contracts, and call functions in another contract.

Interfaces are usually found at the top of a Solidity contract, and they are identified using the “interface” keyword. Because interfaces reduce code duplication and overhead, they are most useful when decentralized applications require extensibility and want to avoid complexity.

Solidity Interface Characteristics

  1. The Solidity interface can inherit from other interfaces
  2. Contracts can inherit interfaces as they would inherit other contracts
  3. You can override an interface function
  4. Data types defined inside interfaces can be accessed from other contracts

All functions that inherit from the interface must set the override modifier on every function that overrides an interface function. Otherwise, the Solidity compiler will throw an error.

Abstract Contracts vs. Interfaces

Abstract contracts and interfaces are two ways web3 developers can build larger, more complex distributed applications because they allow for extensibility within Solidity.

Abstract contracts possess at least one function that lacks implementation, and as a result, they cannot be compiled. However, abstract contracts can be used as base contracts from which other contracts can inherit.

Interfaces are similar to abstract contracts, but they cannot have any functions implemented. Additionally, interfaces are limited to what the contract’s Application Binary Interface (ABI) can represent. The conversion between the ABI and an interface is possible without any information loss.

How to Create a Solidity Interface

Interfaces are usually at the top of your program and declared with the “interface” keyword. Then you can use that interface to communicate with another contract, or you can implement the interface.

Suppose you were writing a smart contract wallet, it might look something like this:

Notice the use of “is IWallet” here. In this case we are inheriting the IWallet interface and implementing it in our contract, Wallet.

Then, if you had some smart contract that wanted to be able to communicate with wallets (WalletFriendlyContract here), you could re-use the interface:

Solidity Interface Requirements 

There are some restrictions when creating interfaces in Solidity, and developers should remember this list of the main interface requirements:

  1. The interface cannot have any functions implemented
  2. Functions of an interface can be only of type external
  3. The interface cannot declare a constructor 
  4. The interface cannot declare state variables 

Solidity Interface Examples

This section contains some examples to guide you in writing Solidity interface code. 

The following example interface code, taken from the Solidity documentation, creates an interface named “Token” for retrieving information about transactions. It contains a function to access information about the address recipient and the amount transferred from other contracts.

The next Solidity interface example, taken from Solidity by Example, shows a full contract with interface declaration and implementation. 

Start Building Solidity Apps with Alchemy

This article introduced you to Solidity interfaces and demonstrated how developers can use interfaces to save time and reduce complexity when building applications in Solidity. To continue learning about Solidity, explore Alchemy University's free Ethereum Developer Bootcamp, that explains the core concepts of Solidity development over a 7-week, self-paced course packed with coding challenges, video lessons, and the best resources for mastering Solidity.

If developers are new to development in general, Alchemy University's 3-week JavaScript crash course is a great prerequisite before starting an Ethereum bootcamp.

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
Learn Solidity
CONTRACT INTERFACE OVERVIEW

What is the Solidity contract interface?

Everything You Need to Know About Solidity's Smart Contract Interface
Last Updated:
October 4, 2022
Last Updated:
March 14, 2023
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

Talk to an Expert

Learn how Alchemy's blockchain developer tools can help your business succeed in web3!
Valid number
Thank you! An Alchemy expert will be in touch with you shortly!
Oops! Something went wrong while submitting the form.

{{learn-solidity}}

Table of Contents

Solidity is an object-oriented, high-level language for implementing smart contracts. While writing smart contracts in Solidity, you may want to use interfaces to interact with other smart contracts. Knowing how to use interfaces will help you increase your knowledge of the Solidity language and may give you some new ideas on other interesting Solidity smart contracts you can build.

In this article, we explain what a Solidity contract interface is and show you how to create one. We provide some examples for interface implementation and declaration to serve as guides as you write one. 

What is the Solidity interface?

A Solidity contract interface is a list of function definitions without implementation. In other words, an interface is a description of all functions that an object must have for it to operate. The interface enforces a defined set of properties and functions on a contract.

Solidity allows you to interact with other contracts without having their code by using their interface. For example, if you want to interact with another contract from your own contract, you provide your calls with an interface wrapper. By declaring an interface, you can interact with other contracts, and call functions in another contract.

Interfaces are usually found at the top of a Solidity contract, and they are identified using the “interface” keyword. Because interfaces reduce code duplication and overhead, they are most useful when decentralized applications require extensibility and want to avoid complexity.

Solidity Interface Characteristics

  1. The Solidity interface can inherit from other interfaces
  2. Contracts can inherit interfaces as they would inherit other contracts
  3. You can override an interface function
  4. Data types defined inside interfaces can be accessed from other contracts

All functions that inherit from the interface must set the override modifier on every function that overrides an interface function. Otherwise, the Solidity compiler will throw an error.

Abstract Contracts vs. Interfaces

Abstract contracts and interfaces are two ways web3 developers can build larger, more complex distributed applications because they allow for extensibility within Solidity.

Abstract contracts possess at least one function that lacks implementation, and as a result, they cannot be compiled. However, abstract contracts can be used as base contracts from which other contracts can inherit.

Interfaces are similar to abstract contracts, but they cannot have any functions implemented. Additionally, interfaces are limited to what the contract’s Application Binary Interface (ABI) can represent. The conversion between the ABI and an interface is possible without any information loss.

How to Create a Solidity Interface

Interfaces are usually at the top of your program and declared with the “interface” keyword. Then you can use that interface to communicate with another contract, or you can implement the interface.

Suppose you were writing a smart contract wallet, it might look something like this:

Notice the use of “is IWallet” here. In this case we are inheriting the IWallet interface and implementing it in our contract, Wallet.

Then, if you had some smart contract that wanted to be able to communicate with wallets (WalletFriendlyContract here), you could re-use the interface:

Solidity Interface Requirements 

There are some restrictions when creating interfaces in Solidity, and developers should remember this list of the main interface requirements:

  1. The interface cannot have any functions implemented
  2. Functions of an interface can be only of type external
  3. The interface cannot declare a constructor 
  4. The interface cannot declare state variables 

Solidity Interface Examples

This section contains some examples to guide you in writing Solidity interface code. 

The following example interface code, taken from the Solidity documentation, creates an interface named “Token” for retrieving information about transactions. It contains a function to access information about the address recipient and the amount transferred from other contracts.

The next Solidity interface example, taken from Solidity by Example, shows a full contract with interface declaration and implementation. 

Start Building Solidity Apps with Alchemy

This article introduced you to Solidity interfaces and demonstrated how developers can use interfaces to save time and reduce complexity when building applications in Solidity. To continue learning about Solidity, explore Alchemy University's free Ethereum Developer Bootcamp, that explains the core concepts of Solidity development over a 7-week, self-paced course packed with coding challenges, video lessons, and the best resources for mastering Solidity.

If developers are new to development in general, Alchemy University's 3-week JavaScript crash course is a great prerequisite before starting an Ethereum bootcamp.

Solidity is an object-oriented, high-level language for implementing smart contracts. While writing smart contracts in Solidity, you may want to use interfaces to interact with other smart contracts. Knowing how to use interfaces will help you increase your knowledge of the Solidity language and may give you some new ideas on other interesting Solidity smart contracts you can build.

In this article, we explain what a Solidity contract interface is and show you how to create one. We provide some examples for interface implementation and declaration to serve as guides as you write one. 

What is the Solidity interface?

A Solidity contract interface is a list of function definitions without implementation. In other words, an interface is a description of all functions that an object must have for it to operate. The interface enforces a defined set of properties and functions on a contract.

Solidity allows you to interact with other contracts without having their code by using their interface. For example, if you want to interact with another contract from your own contract, you provide your calls with an interface wrapper. By declaring an interface, you can interact with other contracts, and call functions in another contract.

Interfaces are usually found at the top of a Solidity contract, and they are identified using the “interface” keyword. Because interfaces reduce code duplication and overhead, they are most useful when decentralized applications require extensibility and want to avoid complexity.

Solidity Interface Characteristics

  1. The Solidity interface can inherit from other interfaces
  2. Contracts can inherit interfaces as they would inherit other contracts
  3. You can override an interface function
  4. Data types defined inside interfaces can be accessed from other contracts

All functions that inherit from the interface must set the override modifier on every function that overrides an interface function. Otherwise, the Solidity compiler will throw an error.

Abstract Contracts vs. Interfaces

Abstract contracts and interfaces are two ways web3 developers can build larger, more complex distributed applications because they allow for extensibility within Solidity.

Abstract contracts possess at least one function that lacks implementation, and as a result, they cannot be compiled. However, abstract contracts can be used as base contracts from which other contracts can inherit.

Interfaces are similar to abstract contracts, but they cannot have any functions implemented. Additionally, interfaces are limited to what the contract’s Application Binary Interface (ABI) can represent. The conversion between the ABI and an interface is possible without any information loss.

How to Create a Solidity Interface

Interfaces are usually at the top of your program and declared with the “interface” keyword. Then you can use that interface to communicate with another contract, or you can implement the interface.

Suppose you were writing a smart contract wallet, it might look something like this:

Notice the use of “is IWallet” here. In this case we are inheriting the IWallet interface and implementing it in our contract, Wallet.

Then, if you had some smart contract that wanted to be able to communicate with wallets (WalletFriendlyContract here), you could re-use the interface:

Solidity Interface Requirements 

There are some restrictions when creating interfaces in Solidity, and developers should remember this list of the main interface requirements:

  1. The interface cannot have any functions implemented
  2. Functions of an interface can be only of type external
  3. The interface cannot declare a constructor 
  4. The interface cannot declare state variables 

Solidity Interface Examples

This section contains some examples to guide you in writing Solidity interface code. 

The following example interface code, taken from the Solidity documentation, creates an interface named “Token” for retrieving information about transactions. It contains a function to access information about the address recipient and the amount transferred from other contracts.

The next Solidity interface example, taken from Solidity by Example, shows a full contract with interface declaration and implementation. 

Start Building Solidity Apps with Alchemy

This article introduced you to Solidity interfaces and demonstrated how developers can use interfaces to save time and reduce complexity when building applications in Solidity. To continue learning about Solidity, explore Alchemy University's free Ethereum Developer Bootcamp, that explains the core concepts of Solidity development over a 7-week, self-paced course packed with coding challenges, video lessons, and the best resources for mastering Solidity.

If developers are new to development in general, Alchemy University's 3-week JavaScript crash course is a great prerequisite before starting an Ethereum bootcamp.

{{learn-solidity}}

Contact Us

Talk to an expert at Alchemy to answer all of your product questions.
Valid number
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Build blockchain magic with Alchemy

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

Get started for free