1/5
## ABI The ABI (Application Binary Interface) is an important part of interacting with smart contracts. It defines the functions that a contract exposes and how different applications can interact with them. We'll look at a simple Vyper contract in Remix and explore the ABI generated by the compiler. ### Generating the ABI Let's start by compiling our contract. ```bash Compile buy_me_a_coffee.vy ``` Once compiled, we can see the compilation details, including the ABI. The ABI is a JSON-formatted document that specifies the contract's functions, inputs, outputs, and other metadata. ### Understanding the ABI The ABI is a list of different types of functions that the smart contract can accept. For example, we can see a `fund` function and a `withdraw` function in our contract. ```python "root": { "0": { "type": "string \"function\"", "name": "string \"fund\"", "stateMutability": "string \"payable\"", "inputs": [], "outputs": [] } }, "1": { "type": "string \"function\"", "name": "string \"withdraw\"", "stateMutability": "string \"nonpayable\"", "inputs": [], "outputs": [] } ``` The ABI also includes information about the contract's version, EVM version, and other metadata. ### Using the ABI The ABI is used by applications to interact with the smart contract. By providing the ABI to a library or tool, the application can understand the contract's functions and interact with them accordingly. The ABI doesn't include the contract's logic. It only defines the interface for interacting with the contract. We will see how to integrate the ABI into our smart contract in the next lesson.
A comprehensive guide to understanding and using the Application Binary Interface (ABI) in Vyper smart contracts - This lesson explains what ABI is, why it's important, and how to access and use it.
Previous lesson
Previous
Next lesson
Next
Give us feedback
Course Overview
About the course
The basics of blockchain transactions, how to send and receive money on a blockchain network.
How to write Python based smart contracts using Vyper.
How to read and understand Vyper smart contracts.
Vyper data structures, arrays, structs, hash maps.
How to build a smart contract application and deploy on ZKsync with Moccasin.
Smart Contract Auditor
$100,000 - $200,000 (avg. salary)
On-chain Data Analyst
$59,000 - $139,000 (avg. salary)
DeFi Developer
$75,000 - $200,000 (avg. salary)
Smart Contract Engineer
$100,000 - $150,000 (avg. salary)
Web3 developer
$60,000 - $150,000 (avg. salary)
Web3 Developer Relations
$85,000 - $125,000 (avg. salary)
Last updated on May 15, 2025
Vyper Developer
Introduction to Python and VyperDuration: 2h 08min
Duration: 2h 32min
Duration: 24min
Course Overview
About the course
The basics of blockchain transactions, how to send and receive money on a blockchain network.
How to write Python based smart contracts using Vyper.
How to read and understand Vyper smart contracts.
Vyper data structures, arrays, structs, hash maps.
How to build a smart contract application and deploy on ZKsync with Moccasin.
Smart Contract Auditor
$100,000 - $200,000 (avg. salary)
On-chain Data Analyst
$59,000 - $139,000 (avg. salary)
DeFi Developer
$75,000 - $200,000 (avg. salary)
Smart Contract Engineer
$100,000 - $150,000 (avg. salary)
Web3 developer
$60,000 - $150,000 (avg. salary)
Web3 Developer Relations
$85,000 - $125,000 (avg. salary)
Last updated on May 15, 2025