Proof of Working
Published in

Proof of Working

Mamba: A new version with a new direction

Why?

Mamba has been the full node successor to neo-python for the N3 network. It used a native implementation for the virtual machine to overcome the speed bottleneck neo-python suffered from, had a fully typed code base and fully audited state (for every single transaction). Maintaining this state comes at a high cost.

After a hard and honest look at the features present and their usage, we concluded it was time to pivot. The Neo ecosystem as a whole advanced in recent years, and as a result, we believe that the need to run a full node has diminished, whereas the need to easily interact with the network has increased. While there will always be an entry barrier into the blockchain space, Mamba’s barrier was a bit too high for its own good. Until now!

What’s new?

Mamba has pivoted to a “light wallet/app” SDK. Meaning that as a user you no longer need to have the full chain state synced locally. Instead, it will make use of full nodes to obtain the data needed via RPC.

This shift of direction allowed us to drop a significant part of the code base. Which in turn made it possible to clean up and restructure it to remove tight coupled parts. It also allowed us to drop a set of 3rd party native dependencies giving us all major platform support (Linux, macOS(+ARM) & Windows). Most importantly, it freed up time to add new code to lower the entry barrier.

This release introduces a set of wrapper classes that allow you to interact with any on-chain smart contract like they’re regular Python classes. There’s no need for strange constructs with dictionaries indicating contract type and value that you often see to pass parameters, or wrapping your native Python types into some contract type. You can just use native Python types and the rest is taken care of. Did we already mention static type checking support? No more guessing on the return type of a smart contract function, your IDE will be able to give you auto completion support or mypy can warn about issues. A façade class will automatically take care of the transaction building and signing for you, while leaving the possibility to manually override the parts you want.

Are you ready to hit the ground running?

Show me!

Glad you asked.

This example shows how to query the Neo token balance of a given address. The NeoToken class is a wrapper around the native NEO token smart contract. The façade will take care of the transaction building, communicating with the node and obtaining the results. In this example test_invoke means it will perform a read-only action and no transaction will be persisted on the chain.

A common state changing action would be transferring tokens. This could be as simple as the following

Note that opening a wallet and linking the preferred account for signing to the façade has been omitted for brevity.

We hope this has gotten you excited to try it out. Head over to the documentation at https://mamba.coz.io to get it installed and to learn the ins and outs of how to use it for your needs.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store