Quick Start
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/key.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 │
├─────────────┼────────────────────────────┤
│ RPC_URL │ https://localhost:3000 │
├─────────────┼────────────────────────────┤
│ 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:
- index.ts
- index.test.ts
- package.json
- jest.config.js
- .gitignore
Install dependencies
Run the following command to install the dependencies inside your project:
npm install
You can now start building your app in the src
directory and write tests in the tests
directory.
Test your app
Run the following command to test your app:
npm test
Build and Deploy
Build your project
To build your project, run the following command:
n1 app build ./src/index.ts
This will build your project and output the build artifacts to the my-n1-project/.n1
directory.
Deploy your project
To deploy your project, run the following command:
n1 app deploy my-app-name ./src/index.ts
This will deploy your app to the N1 network.