Skip to Content
DevelopersNTSQuick Start

Quick Start

️⚠️
NTS is in active development and currently unstable. It is open to select early developers for exploration but is not yet suitable for production use. Follow developer updates for the latest changes, as performance is not at production level.

Get up and running with N1TS (N1 TypeScript) in minutes. This guide will walk you through creating your first smart contract app.

N1TS lets you build smart contracts using TypeScript with automatic state management, built-in token operations, and cross-cluster communication.

Setup a wallet/ account on N1

Before you can interact with the N1 network, you need to setup an account (wallet). This account will be used to sign and send transactions to the N1 network.

Create a file system wallet

A file system wallet is a private key stored in a file on your local machine.

This will create a new wallet and save the private key to a file in the default path of ~/.config/n1/keys/admin.json (on macOS). You can change the output path by using the optional --outfile flag.

n1 key generate

Setup your config settings

Run the following command to view your current config settings.

n1 config get

You should see something like this:

┌─────────────┬────────────────────────────┐ Key Value ├─────────────┼────────────────────────────┤ nts_url https:/n1ts.n1.xyz ├─────────────┼────────────────────────────┤ default_key key └─────────────┴────────────────────────────┘

If the default_key is not set to the correct key, you can set it by running the following command:

n1 config set default_key <name of your key>

Initialize your project

Initialize a new project

Create a new directory and initialize a new N1 project by running the following command:

n1 app init <name of your app>

This will create a new directory with the following structure:

      • app.ts
      • index.test.ts
    • n1config.json
    • package.json
    • .gitignore

Install dependencies

Run the following command to install the dependencies inside your project:

pnpm install

You can now start building your app in the src directory and write tests in the tests directory.

Development

The N1 CLI provides a powerful development mode that enables rapid iteration with automatic rebuilding and test execution.

Start development mode

Run the following command in your project directory:

n1 app dev

This will:

  • Watch your contract files for changes and automatically rebuild
  • Watch your test files for changes
  • Start an interactive development REPL

Available commands

In the development REPL, you have access to the following commands:

  • run - Builds, deploys, and runs all tests
  • clear - Clears the terminal screen
  • help - Shows available commands
  • exit - Exits the development mode

For detailed information about writing and running tests, see the Testing guide.

Last updated on