> For the complete documentation index, see [llms.txt](https://near-sdk-js.gitbook.io/near-sdk-js/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://near-sdk-js.gitbook.io/near-sdk-js/near-bindgen/functions/nearbindgen.md).

# NearBindgen

[**near-bindgen**](/near-sdk-js/near-bindgen.md) • **Docs**

***

[near-sdk-js v2.0.0](/near-sdk-js/packages.md) / [near-bindgen](/near-sdk-js/near-bindgen.md) / NearBindgen

## Function: NearBindgen()

> **NearBindgen**(`options`): `any`

Extends this class with the methods needed to make the contract storable/serializable and readable/deserializable to and from the blockchain. Also tells the SDK to capture and expose all view, call and initialize functions. Tells the SDK whether the contract requires initialization and whether to use a custom serialization/deserialization function when storing/reading the state.

### Parameters

• **options**

Options to configure the contract behaviour.

• **options.requireInit?**: `boolean`

Whether the contract requires initialization.

• **options.deserializer?**

Custom deserializer function to use for reading the contract state.

• **options.serializer?**

Custom serializer function to use for storing the contract state.

### Returns

`any`

### Defined in

[packages/near-sdk-js/src/near-bindgen.ts:167](https://github.com/near/near-sdk-js/blob/b58ac04fc6dff2f1120e9098c0cb059493486598/packages/near-sdk-js/src/near-bindgen.ts#L167)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://near-sdk-js.gitbook.io/near-sdk-js/near-bindgen/functions/nearbindgen.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
