Replies: 3 comments 3 replies
-
Hello, Jordan from Demergent Labs. We might be able to take on this opportunity. We've worked extensively with RustPython to get our Python SDK for ICP (Internet Computer Protocol) to fit within its limits (which started out around ~2 MB gzipped but are fortunately much larger now). What you're asking for will be a very difficult task depending on NEAR's protocol limitations. We've worked extensively with the teams behind ICP to improve the ICP protocol to allow for larger Wasm binary sizes and to enable more and more of the Python stdlib. The Python stdlib in RustPython is very large. I would almost say it's impossible to fit it inside of 1.5 MB. The question becomes one of trade-offs and NEAR protocol improvements. For example, which Python stdlib functionality are you willing to live without? What is NEAR willing to do to improve the protocol to allow for larger binaries, Wasi, etc? Another important point is Wasi. Does NEAR support the Wasi host imports? Those are very important for certain stdlib functionality. ICP started out only supporting the And so, please reach out to discuss this grant and future work with us. I am @lastmjs on Telegram and Twitter. I've sent you some messages on Telegram.
P.S. You're actually using our fork of RustPython in your demo |
Beta Was this translation helpful? Give feedback.
-
Hi, I am currently on a trip, so the discussion can be a bit delayed. I believe @lastmjs is skilled at developing blockchain SDK and have much trouble shooting experience with RustPython. As one of the developer of RustPython, I am interested in milestone 1 and 2 to enhance the entire RustPython WASM ecosystem.
I agree here. there must be effort to cut-down the useless libraries. At the same time, I hope we also can reduce the wasting binaries to allow more third-party libraries. |
Beta Was this translation helpful? Give feedback.
-
This proposal is closed as Milestones 1 and 2 were achieved with MicroPython already: https://github.com/orgs/micropython/discussions/16427#discussioncomment-11986599, and Milestone 3 is built on top of it: https://github.com/r-near/near-sdk-py |
Beta Was this translation helpful? Give feedback.
-
Hi RustPython community, I am a software engineer currently leading DevTools ecosystem in NEAR Protocol.
NEAR Protocol is a blockchain, that is resource-efficient, horizontally scalable, uses Wasm as the runtime, and is written in Rust. There are already Rust, JavaScript, and AssemblyScript SDKs to build apps. NEAR Protocol provides a few dozen host functions (Storage API, data input/output API, native cryptography API, etc), and has a limit of 1.5MB for Wasm file.
We have played a bit with RustPython and MircoPython. We could not make RustPython Wasm files fit the size requirement (<1MB, ideally, with a hard limit of 1.5MB). With MicroPython we succeeded in building a Wasm file. Still, it failed to be pre-compiled with the Wasm runtime in nearcore due to some unsupported Wasm features or functions that are not provided by NEAR host runtime.
The current error message we get from wasmer (Wasm runtime used in nearcore) with MicroPython
PrepareError(DeserializeError)
means that there are some validation errors (e.g. imports that are not provided by Wasm host or unsupported Wasm features like bulk memory).Milestone 1
I can offer $50k grant for the initial stage - get the following Python code to be compiled to Wasm (<1.2MB) and executed by Wasm runtime in nearcore without errors.
Useful references:
Milestone 2
I offer $50k grant to develop CLI tooling to streamline the build process that will allow multiple source files and PiPy dependencies (probably with the limitation that only Python-only dependencies will be suitable) to be packaged into a Wasm file that will work on NEAR (we still need to comply with 1.5MB filesize limit).
Take inspiration from
cargo-near
, which is CLI tool for building Rust apps for NEAR.Consider using
uv
tooling.Beyond
I offer up to $200k in grants for near-sdk-py development and improvements that will bring Python SDK on par with Rust SDK, providing data collections API over basic key-value Storage API, etc.
If you are interested in taking the challenge on, please, comment here or reach out to me in DM NEAR's Zulip @frol or Telegram.
Beta Was this translation helpful? Give feedback.
All reactions