Skip to content

frol/near-contract-python-proof-of-concept

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Proof of Concept of using Python for NEAR Contracts

I used RustPython to create this proof of concept, more specifically, this fork that trims away wasm_bindgen which is not supported in NEAR environments since NEAR environment is not a browser environment. Here is how to compile it:

cargo build --target wasm32-unknown-unknown --release

NEAR mainnet and testnet has a limit of 1.5MB for the contract size and transaction size, but the resulting binary I got is 9.1MB, so I tried to strip it:

wasm-opt -Oz --strip --vacuum target/wasm32-unknown-unknown/release/pycontract.wasm -o pycontract.wasm

I still get 4.3MB Wasm, which is not enough to push it through. Next steps are:

  1. further tweak RustPython to avoid remaining __wbindgen_* imports (see WAT output to see that the current contract tries to import those host methods that are not available, so it won't get executed in NEAR)
  2. run a localnet (e.g. with near-workspaces) to get it tested to potentially push NEAR Protocol changes to increase the limits.

License

Licensed under either of

at your option.

About

No description, website, or topics provided.

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors