Search code examples
nearprotocol

NEAR API with Python


A community member would like to utilise Python to integrate aspects of their application with NEAR. Would it be possible to build an application on NEAR using Python? Can the NEAR API be used with Python?


Solution

  • With NEAR you build on 2 fronts:

    1. "Inside": Contracts (to write code that runs on-chain and changes state in the system)
    2. "Outside": API (to create dApps that communicate with NEAR)

    Contracts

    We currently support two languages:

    You can find more examples of contracts written in both of these languages in our NEAR Examples GitHub org, many of which are running live on near.dev

    In the future we will support any language that we (or our community) decides to enable from a pretty long list where “enable” means building out the sdk like near-sdk-rs and near-sdk-as linked above.

    API

    We currently have a JSON RPC API that you can use from any language (including Python) as well as a convenient wrapper for JavaScript developers called near-api-js. Again, we (or our community) can decide to build more convenient wrappers for any other language we want to support, including Go, Java, C#, Python, Ruby, etc

    As a side note, if someone in the community is interested in Python specifically, there’s a ton of it currently being used to do things like run tests (nearcore pytest), manage builds (nearcore scripts) and deploy nodes (nearup) as well as simulate some of the on-chain stuff like the Runtime