This report provides an overview of the current state of Python programming language technologies in blockchain software development ecosystems for 2023. We examine blockchain projects and tooling that use Python or are related to Python and why this overlap is significant. We highlight new and exciting projects and opportunities for Python developers.
Why is this important?
Python is one of the world's leading programming languages and was named "most in-demand language of 2022".
Here are some uses where Python is the number one language of choice:
- Data research
- Quantitative finance
- Trading automation
- Integration and testing
- Software automation and DevOps
Python is also heavily used in web backends, having both small and large projects choosing their software-as-a-service solutions to be built on top of it. Within the traditional tech industry, the top ten apps such as Instagram and Pinterest rely heavily on Python. The cryptocurrency industry is no different. Centralised exchanges use Python in their backend API and integration and have been doing so for over a decade.
Blockchain, cryptocurrency or protocol projects looking to attract talent and builders in the above verticals should offer Python-based development solutions. Vice versa, Python developers who look to enter the blockchain industry can easily find opportunities in these specific areas. More mature Python tooling can often be seen as an indication for adoption in professional settings and makes it easier to enter into traditional corporations.
Python and blockchain ecosystem interconnections
Because of the heavily financial nature of blockchains, and Python's unique status in finance and data research, there are multiple software development verticals where Python and blockchain development overlap.
Blockchains usually do not come with Python included. Typically, for a minimal blockchain or protocol project, there is no support for Python by the core development team. Here is a look at some typical components and integrations.
Outside traditional software development verticals, we also have smart contracts, where we can find Python in part of tooling or smart contracts themselves. Furthermore, we can identify that Python plays a crucial role in security and smart contract auditing.
Overall state of the blockchain development ecosystem
A good overview of the state of the blockchain development ecosystem can be found in Electric Capital's Developer Report 2022. Despite 2022 being a bear market in cryptocurrencies and in tech stock generally, the developer numbers year over year are up.
Development is accelerating. Half of the new developers entered the industry in 2022.
In 2022, Trading Strategy organised the first Python-focused blockchain developer conference, PyChain. The virtual event had over 1,200 signups and 500 concurrent stream viewers. Since December, PyChain YouTube videos have gained 5,000+ views.
PyChain 2022 included talks from numerous blockchains and protocols such as Ethereum Foundation, NEAR, MultiverseX (previously known as Elrond), Cosmos, Curve, but also included talks from the traditional quantitative finance perspective, having covered topics such as risk analysis and strategy backtesting.
For the project overviews found later in this report, we link to the respective PyChain 2022 presentation if available. Otherwise, we provide links to the project developer documentation.
Python verticals in blockchain development
Below are introductions and overviews to individual notable blockchain projects that best utilise Python in 2022.
We have divided projects based on their vertical into:
- Core blockchain and node software
- Smart contract languages
- Integration libraries
- Smart contract development frameworks
- Data research, including extract transform load (ETL) solutions
- Security and auditing
Core blockchain and node software
Despite being somewhat of a controversial candidate for the task, Python language is used in core blockchain node development as well.
Chia blockchain core software is written in Python. Chia claims to be the most decentralised blockchain if counted by an individual node count. Chia offers unique proof of spacetime (PoSt) consensus model. Chia offers smart contracts via the ChiaLip programming language and has been used in World Bank pilots.
Lamden is the performant Python-based blockchain platform that makes using and creating the next generation of dApps easy for everyone.
Smart contract programming languages
Python and Python-inspired languages are being used as the smart contract programming language for several blockchains. Smart contract development is dominated by Solidity and Rust. The more experimental Python-based approaches are interesting, as they offer easier code readability, and writability and can offer better security compile-time guarantees, thus creating a safer ecosystem.
Vyper is the offspring of the first-ever smart contract programming language, Serpent, made in 2014 by Vitalik Buterin. Today, Vyper is used in production for many DeFi applications and has proven its robustness in transacting billions of dollars of value. Here is a 3-minute intro to Vyper.
Tezos offers SmartPy, which is both a smart contract programming language and development platform. It uses Python as domain-specific language (DSL). Tezos is a proof-0f-stake blockchain and one of the first blockchains offering on-chain governance.
Solana offers Seahorse, another Python domain-specific language for smart contract programming. Seahorse simplifies smart contract development greatly, but still offers type safety and interoperability with Rust-based smart contracts. The Seahorse compiler generates intermediate Rust artefacts and uses the Anchor library to do the heavy lifting.
PyTeal is yet another domain-specific language using Python. PyTeal allows you to write contracts for Algorand's Transaction Execution Approval Language (TEAL). PyTeal programs provide a convenient and familiar syntax for smart contract development.
Integration libraries and software toolkit libraries are used to make blockchains communicate with other software. This includes web frontends and server-based applications like SaaS offerings. One of the most common use case for this is to integrate cryptocurrency payments to centralised exchanges (CEX) or other currency ramps.
Integration libraries allow you to query the chain state, assemble and broadcast your own transactions. The libraries speak with a blockchain node using Remote Procedure Call (RPC) protocol. Common protocol choices include JSON-RPC and Protobuf.
Web3.py is the original Web3 toolkit for Python. Web3.py was created for the Ethereum mainnet and is maintained by Ethereum Foundation. However, it is used with other EVM-based L1 and L2 blockchains as well.
Pons is another Python library for Ethereum and EVM-based blockchains. Pons uses asynchronous programming model and is currently in an experimental stage.
Sign in with Ethereum
Sign in with Ethereum (SIWE) for Python offers a passwordless sign-in experience for your website using an Ethereum wallet. SIWE offers built-in security and integration with popular Python web frameworks like Django and Flask. SIWE works with multiple wallets like MetaMask and all WalletConnect-based wallets.
CosmPy is a Python library for interacting with Cosmos SDK-based blockchain networks. CosmPy can be used for transferring tokens, staking, performing atomic swaps, deploying and interacting with a smart contract.
CosmPy is currently maintained by Fetch.ai. Cosmos SDK is being used to build multiple different blockchains including Osmosis, Stargazer, Cosmos Hub that are then connected with relays.
The Paloma Software Development Kit (SDK) in Python is a simple library toolkit for building software that can interact with the Paloma blockchain and provides simple abstractions over core data structures, serialization, key management, and API request generation. Paloma is a fast, permissionless, Cosmos-SDK blockchain that moves messages securely, between any other blockchains.
xrpl-py is a Python library to interact with XRP Ledger (often incorrectly called Ripple). The library offers serialization and transaction signing, by providing native Python methods and models for XRP Ledger transactions and core server API.
IOTA Wallet Library
IOTA Wallet Library is Rust-based with Python bindings. It can be used to interact with IOTA blockchains, including Shimmer. IOTA is a Directed acyclic graph (DAG) based blockchain claiming free transaction costs.
NEAR-API-Py is a Python library for the development of applications that use the NEAR platform. NEAR is a sharded high-performance smart contract-enabled blockchain with over 10 million accounts.
Vega API Client
Aptos Python SDK
Aptos provides a lightly maintained official Python SDK. Currently, this is still in development and is unsuitable for directly interfacing with Aptos.
Python Substrate Interface
Substrate is the SDK used to build Polkadot chains. Python Substrate Interface specialises in interfacing with a Substrate node; querying storage, composing extrinsics, encoding/decoding and providing additional convenience methods to deal with the features and metadata of the Substrate runtime.
Solana.py is the base Python library for interacting with Solana. You can use it to build transactions and interact with the Solana JSON RPC API.
Solders is a Python binding to the Solana Rust SDK. It provides robust, high-performance solutions to core Solana tasks such as transaction signing and serialization, and saves us from reimplementing Solana logic in pure Python.
Smart contract development frameworks
Smart contract development frameworks provide additional tooling for writing smart contracts. This includes:
- Automatic compilation of complex smart contract projects (think UNIX Make for smart contracts)
- Unit and integration testing frameworks for smart contracts, as test cases are often cumbersome or impossible to write in the smart contract DSL language itself
- Deployment and scripting
ApeWorX is a smart contract development framework for Python developers, data scientists, and security professionals. ApeWorX supports Ethereum, EVM-based blockchains and StarkNet.
MultiversX SDK for Python
MultiversX SDK for Python (previously known as Elrond) offers compiling, testing and deployment of smart contracts for the MultiverseX blockchain.
AnchorPy is the gateway to interacting with Anchor programs in Python. Anchor is a framework for Solana's Sealevel runtime providing several convenient developer tools for writing smart contracts.
SnekMate is a repository for state-of-the-art, highly opinionated, hyper-optimised, and secure Vyper smart contract building blocks. SnekMate contains Foundry-based unit tests, property-based tests (i.e. fuzzing), and invariant tests for all contracts.
As mentioned earlier in the report, Python is the number one programming language for trading, in both cryptocurrency and traditional finance. For the efficiency of the report, we focus on open-source solutions; we do not list client libraries for centralised exchanges, custodian solutions or other proprietary API services. For the record, there are hundreds of libraries and APIs that use Python outside of these open-source solutions.
Trading Strategy is an algorithmic trading framework for decentralised finance (DeFi) markets. It allows you to develop, backtest and execute trading strategies using high-level Python programming and quantitative finance tools instead of Solidity. Currently, Trading Strategy supports Ethereum, several EVM-based blockchains, Uniswap v3, Aave v3 lending protocol, Uniswap v2 and compatible DEXes.
Hummingbot is a high-frequency trading framework for cryptocurrencies. Hummingbot specialises in market-making on centralised exchanges.
CCXT is an integration library for various centralised exchanges. CCXT stands for CryptoCurrency Exchange Trading Library. It offers a standard API to make orders
ETL stands for Extract - transform - load (ETL). It refers to solutions to ingest data streams from one system and then transform this data to a different format, usually more suitable for queries and business analytics.
Blockchain ETL facilitates data science on blockchain data. Blockchain ETL is available in Google BigQuery for some EVM chains.
Web3-Ethereum-Defi is a low-level Python library for extracting DeFi trading data form various blockchains. The project also offers trade execution primitives besides high performance data ingests. Currently Web3-Ethereum-DeFi supports Ethereum, several EVM based blockchains, Uniswap v3, Aave v3 lending protocol, Uniswap v2 and compatible DEXes.
Because of its easiness to read and scriptability, Python is the foundation of many blockchain and smart contract security tools.
Mythril is a security analysis tool for EVM bytecode. Supports smart contracts built for Ethereum, Hedera, Quorum, Vechain, Roostock, Tron and other EVM-compatible blockchains. Mythril is maintained by Consensys.
Slither is a Solidity static analysis framework written in Python 3. It runs a suite of vulnerability detectors, prints visual information about contract details, and provides an API to easily write custom analyses. Slither enables developers to find vulnerabilities, enhance their code comprehension, and quickly prototype custom analyses.
Woke is a Python-based development and testing framework for Solidity. It offers vulnerability detectors, a Language Server Protocol (LSP) for Solidity and a fuzzer. Woke is maintained by Ackee.
Halmos is a symbolic bounded model checker for Ethereum smart contracts bytecode that can be used for bug detection as well as formal verification of the contract. Halmos executes the given contract bytecode with symbolic function arguments and symbolic storage states, enabling it to explore all possible behaviours. It unrolls loops allowing it to run automatically without the need for additional user annotations. Halmos proves that assertions are never violated by any inputs or provides a counter-example. Halmos is maintained by Andreessen Horowitz.
In this category, we have the remaining miscellaneous Python-based blockchain projects.
rotki is an open-source portfolio tracker, accounting and analytics tool that protects your privacy. rotki's Python source code is available to inspect. It is a local-first application with a strong focus on user privacy. Your financial data is kept encrypted in your system and not shared with third parties, making it suitable for funds and corporations.
What to expect for 2023
Blockchain technology has started to diversify from its Bitcoin and Ethereum architecture duopoly. While EVM is still the dominating solution, its architectural shortcomings are becoming more obvious as later-generation technology enters the market. Although any change towards more scalable, secure, and user-friendly technologies is slower than we wish, it is still happening.
- Specialisation: blockchains such as Vega and Cosmos app chains that are for trading and NFTs are entering the market for the first time. We do not yet know if specialised app chains or generic blockchains will eventually win.
- Scalability: Sharding-based solutions like NEAR and MultiverseX are starting to mature, offering viable long-term scalability. Unlike short them scalability, stop-gap fixes such as just increasing the block size are not offering long-term scalability, these chains are rethinking the architecture so that it will scale forever. Other scaling solutions include L2s like Arbitrum, but at the moment, any of the L2 scaling solutions do not offer any new or interesting functionality beyond a normal EVM chain.
- Industry maturity: after hard lessons learned, the blockchain industry is maturing generally speaking. The bear market has wiped out unsustainable projects and employee pools chasing easy money.
- For the next level of evolution, the tooling needs to improve. This includes end user-facing elements (wallets, DApps), professional-facing elements (data availability and formats), as well as security (better smart contract languages that prevent writing exploitable code).
We expect integration and the need to access data with variation and growth of the industry that will generate more demand for Python libraries and tooling. Software developers should find ample opportunities in this space as long as they know where to look.
Trading Strategy will be organising the next instalment of PyChain later this year, PyChain 2023 and would like to extend an invitation to all quality Python and blockchain projects and developers out there to build a bigger and better ecosystem together.