Use this file to discover all available pages before exploring further.
The NEAR SDK is a library that allows you to develop smart contracts. Currently, there are two versions of the NEAR SDK: one for Rust and one for JavaScript.
We strongly recommend using the Rust SDK for production contracts. Rust provides the most mature tooling, best performance, and the strongest safety guarantees when handling real assets on-chain. The JavaScript SDK is a great option for prototyping and learning.
This is how a smart contract written in Rust and JavaScript using the NEAR SDK looks like:
JavaScript
Rust
@NearBindgen({})class HelloNear { greeting: string = 'Hello'; @view({}) // This method is read-only and can be called for free get_greeting(): string { return this.greeting; } @call({}) // This method changes the state, for which it costs gas set_greeting({ greeting }: { greeting: string }): void { near.log(`Saving greeting ${greeting}`); this.greeting = greeting; }}