NEAR Shell is a fully featured NodeJS command line application that wraps
You use NEAR Shell to connect to the NEAR platform from the terminal to create accounts, deploy contracts and more.
Prerequisites: Make sure you have the latest version npm and node
Mac and Linux
To install NEAR Shell globally (recommended)
npm install -g near-shell
Please use the Windows Subsystem for Linux (WSL).
- Download a distro from this Microsoft link.
- Install Node.js following the directions here
- We will be installing
near-shellglobally and Windows is known to have permission issues with this in WSL. Follow the guide here in order to fix this issue.
- Now we can run the same command as Mac and Linux:
Note: Copy/pasting can be a bit odd using WSL. Quick Edit Mode will allow right-click pasting. Depending on your version there may be another checkbox allowing Ctrl+V pasting as well.
If an upgrade is available, NEAR Shell will present a notice similar to the following:
To upgrade NEAR Shell, just follow the instructions
If you're curious, you can always check your current version before and after the upgrade with
near --version # version info appears on the last line of output
And you can always see the latest available version using
npm outdated -g # note the difference between Current and Latest
But NEAR Shell handles upgrade notification automatically.
If you have any issues upgrading NEAR Shell, sometimes the fastest way to resolve the issue is to uninstall / reinstall
npm uninstall -g near-shell <snippet id='shell-install-command'/>
In command line, from directory with your project:
near login # logging in through NEAR protocol wallet near create_account <accountId> # create a developer account with --masterAccount(required), publicKey and initialBalance near state <accountId> # view account state near keys <accountId> # view account public keys near send <sender> <receiver> <amount> # send tokens to given receiver near stake <accountId> <stakingKey> <amount> # create staking transaction (stakingKey is base58 encoded) near delete <accountId> <beneficiaryId> # delete an account and transfer funds to beneficiary account
For smart contract:
near build # build your smart contract near deploy # deploy your smart contract near call <contractName> <methodName> [args] # schedule smart contract call which can modify state near view <contractName> <methodName> [args] # make smart contract call which can view state near clean # clean the smart contract build locally (remove ./out )
near tx-status <hash> # lookup transaction status by hash
near repl # launch interactive Node.js shell with NEAR connection available to use near generate-key <account-id> # generate key
|--version||Show version number||[boolean]|
|--nodeUrl||NEAR node URL||[string]||"http://localhost:3030"|
|--networkId||NEAR network ID for different keys by network||[string]||"default"|
|--helperUrl||NEAR contract helper URL||[string]|
|--keyPath||Path to master account key||[string]|
|--accountId||Unique identifier for the account||[string] [required]|
|--masterAccount||Account used to create requested account.||[string] [required]|
|--publicKey||Public key to initialize the account with||[string] [required]|
|--initialBalance||Number of tokens to transfer to newly account||[string] [required]|