COZ has announced an overhaul of Mamba, its Python SDK for Neo N3. The scope for the project has been significantly reduced as part of the shake-up, which is designed to make the SDK more lightweight, accessible, and maintainable moving forward.
Mamba was the name given to the N3 version of neo-python, a full node and SDK built in 2017 for the Legacy network. Like its predecessor, Mamba was originally designed to act as a full node, allowing developers to synchronize the blockchain and interface with the network directly.
As of the new v1.0.0 release, the node infrastructure has been removed from Mamba completely. The new version will serve primarily as a light wallet & app SDK, where interfacing with the blockchain is handled over RPC. This is better suited to onboard Python application developers into the N3 ecosystem as it reduces the complexity when starting a project.
Stripping Mamba down to its most useful components for dApp developers allows the team to reap a number of benefits. With less time needed to maintain the codebase between Neo versions, developer hours can be spent finding ways to lower the barrier to entry for application builders. Additionally, dropping several third-party dependencies enables the SDK to be supported on more major platforms, such as MacOS ARM devices.
In its new form, Mamba fills a similar role in the ecosystem to Neon.js. The building blocks are provided to handle all basic network operations, including smart contract deployment, voting, asset transfers, and wallet management.
Further tools are also included to support more specialized use cases. In the announcement, an example of the new contract wrapper classes was given, which demonstrates how to perform a balance request on the Neo native contract.
Similar wrappers are provided for other native contracts, but developers can wrap any deployed contract using the GenericContract wrapper to call its methods in a convenient way. The result of the invocation can then be easily converted to a native Python value using the provided unwrap helper functions.
Mamba’s facade takes care of the entire process of building, relaying, and obtaining the results for a transaction. Like Neon.js and its experimental interface, the contract wrappers can be used to perform both read-only queries and actions that persist state to the blockchain, costing GAS in the process.
However, Mamba also takes this ability a step further, being able to run custom transaction scripts in addition to direct contract invocations. A guide to using Mamba with smart contracts has been provided in the documentation, and several examples of common actions can be found on GitHub.
Developers can learn how to get started using Mamba by visiting the documentation at the link below: