Skip to main content

Aurora CLI

The Aurora Command Line Interface (CLI) is a tool that enables to interact with the Aurora engine directly from the shell. Among other things, the Aurora CLI enables you to:

  • Deploy Aurora blockspace on NEAR networks
  • Send EVM transactions
  • Interact and test Aurora engine
tip

Under the hood, Aurora CLI utilizes the Aurora Engine Rust API

Overview

Aurora cli has two subcommands in the context of interacting with Aurora engine as an EVM or a Near smart contract. Each subcommand support methods that reads/write from the Aurora engine state.

Click on a command for more information and examples.

Near

Read methods

CommandDescription
engine-callDry-run EVM call transaction
engine-erc20Look up an ERC20 token in Aurora engine
engine-xcc-dry-runDry run precompiled contract results
ft-balance-ofGet balance of an fungible token
ft-balance-of-ethGet balance of ETH of an Aurora EVM
ft-metadataGet metadata of Fungible token contract
ft-total-eth-supply-on-auroraGet total ETH supply on Aurora (ETH in Aurora EVM)
ft-total-supplyGet total ETH supply on Aurora (ETH in Aurora EVM)
ft-total-supply-on-nearGet total ETH supply on NEAR (nETH as NEP-141 token)
get-accounts-counterGet accounts counter for statistics
get-aurora-erc20Get ERC20 balance of from NEP-141 account id
get-balanceGet NEP-141 balance from ERC20 address
get-block-hashGet block hash from a block number
get-bridged-nep141Get bridged NEP-141 account id from ERC20 address
get-chain-idGet chain id
get-codeGet code of account storage from an Ethereum address
get-engine-bridge-proverGet bridge prover address
get-nonceGet nonce of an account from an Ethereum address
get-paused-flagsGet paused flag to see if the state is paused
get-receipt-resultGet NEAR receipt result from receipt id
get-storage-atGet storage data at an Ethereum address and a key
get-upgrade-indexGet upgrade index
soliditySend ABI encoded query input in a solidity contract
storage-balance-ofGet NEAR storage balance of an NEAR account id

Write methods

CommandDescription
begin-blockBegin genesis block at Engine EVM state
begin-chainInitialize EVM state in Engine
callExecute raw ethereum transaction with 'call' method in Aurora EVM state
deploy-codeDeploy a code at Aurora EVM state with raw transaction
deploy-erc20-tokenDeploy bridged ERC20 token from NEP-141
engine-callCall a smart contract at an Ethereum address with inputs
engine-erc20Transfer from to an ERC20 at an Ethereum address
engine-xccExecute cross contract call precompiles between NEAR and EVM
factory-updateUpdate to Factory setting of Aurora EVM state
ft-on-transferCallback function to execute on fungible token transfer on bridge
ft-transferTransfer fungible token to receiver NEAR account id
ft-transfer-callTransfer fungible token to receiver NEAR account id
register-relayerRegister relayer with an Ethereum address
set-paused-flagsSet EVM state in Aurora as paused or not
soliditySend ABI encoded call input in a solidity contract
storage-depositDeposit NEAR on engine for storage balance
storage-unregisterUnregister storage for Aurora Engine
storage-withdrawWithdraw storage balance of Aurora engine
withdrawWithdraw wrapped NEAR to

Aurora

Read methods

CommandDescription
get-resultGet eth transaction result from transaction hash

Write methods

CommandDescription
callCall Ethereum smart contract
deployDeploy Ethereum smart contract
transferTransfer ETH from coinbase to

Setup

Installation

Make sure you have a current version of Cargo and Rust installed.

Mac and Linux

  1. Install cargo and rustup using a command curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
  2. Ensure you have installed latest version
  3. Install aurora-cli-rs globally by running:
cargo install aurora-cli-rs

Windows

For Windows users, we recommend using Windows Subsystem for Linux (WSL).

  1. Install WSL [click here]
  2. Install rustup [ click here ]
cargo install -g aurora-cli-rs
heads up

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.

Update aurora-cli-rs

If a aurora-cli-rs update is available, you will be notified in the terminal after running any command. (see example below)

  • Follow the instructions to update by running:
cargo install --force aurora-cli-rs
  • You can always check your current version by running:
aurora-cli-rs --version  # version info appears on the last line of output

Troubleshooting:

If you have any issues upgrading NEAR CLI, the fastest way to resolve the issue is to uninstall then reinstall.

cargo uninstall aurora-cli-rs
cargo install aurora-cli-rs

Network selection

The default network for aurora-cli-rs is testnet.

  • You can change the network by prepending an environment variable to your command in a JSON config file.
{
"network": "mainnet",
"engine_account_id": "aurora",
"aurora_api_key": null,
"near_key_path": null,
"evm_secret_key": null
}

Save the modified JSON file as default-config.json then run aurora-cli-rs in the same directory of the file. Key paths are required to be filled to execute each write commands.


Near Read

engine-call

Dry-run EVM call transaction

  • arguments: target_addr_hex, input_data_hex
  • options: default

Example:

USAGE:
aurora-cli-rs near read engine-call [OPTIONS] --target-addr-hex <TARGET_ADDR_HEX> --input-data-hex <INPUT_DATA_HEX>

engine-erc20

Operate ERC20 on Aurora EVM state

  • arguments(subcommands): allowance, approve, balance-of, total-supply, transfer, transfer-from
  • options: --amount <AMOUNT>, --sender-addr-hex <SENDER_ADDR_HEX>, --target-addr-hex <TARGET_ADDR_HEX>

Example

USAGE:
aurora-cli-rs near read engine-erc20 [OPTIONS] --target-addr-hex <TARGET_ADDR_HEX> <SUBCOMMAND>

OPTIONS:
-a, --amount <AMOUNT>
-h, --help Print help information
-s, --sender-addr-hex <SENDER_ADDR_HEX>
-t, --target-addr-hex <TARGET_ADDR_HEX>

SUBCOMMANDS:
allowance
approve
balance-of
help Print this message or the help of the given subcommand(s)
total-supply
transfer
transfer-from

engine-xcc-dry-run

Dry-run cross compile contract between NEAR and Aurora

  • arguments: none
  • options: --sender-address-hex <SENDER_ADDRESS_HEX>, --sender-address-hex <SENDER_ADDRESS_HEX>, --target-near-account <TARGET_NEAR_ACCOUNT>, --method-name <METHOD_NAME>

Example

USAGE:
aurora-cli-rs near read engine-xcc-dry-run [OPTIONS] --sender-address-hex <SENDER_ADDRESS_HEX> --target-near-account <TARGET_NEAR_ACCOUNT> --method-name <METHOD_NAME>

ft-balance-of

Get balance of an fungible token(NEP-141)

  • arguments: ACCOUNT_ID
  • options: default

Example

USAGE:
aurora-cli-rs near read ft-balance-of <ACCOUNT_ID>

ft-balance-of-eth

Get balance ETH fungible token(NEP-141)

  • arguments: ACCOUNT_ID
  • options: default

Example

USAGE:
aurora-cli-rs near read ft-balance-of-eth <ACCOUNT_ID>

ft-metadata

Get metadata for a fungible token

  • arguments: none
  • options: default

Example

USAGE:
aurora-cli-rs near read ft-metadata

ft-total-eth-supply-on-aurora

Get total ETH supply on Aurora (ETH in Aurora EVM)

  • arguments: none
  • options: default

Example

USAGE:
aurora-cli-rs near read ft-total-eth-supply-on-aurora

ft-total-supply

Get total ETH supply on Aurora (ETH in Aurora EVM)

  • arguments: none
  • options: default

Example

USAGE:
aurora-cli-rs near read ft-total-supply

ft-total-supply-on-near

Get total ETH supply on NEAR (nETH as NEP-141 token)

  • arguments: none
  • options: default

Example

USAGE:
aurora-cli-rs near read ft-total-supply-on-near

get-accounts-counter

Get total number of accounts for statistics

  • arguments: none
  • options: default

Example

USAGE:
aurora-cli-rs near read get-accounts-counter

get-aurora-erc20

Get connected Aurora ERC20 token address from NEP-141 account id

  • arguments: NEP_141_ACCOUNT
  • options: default

Example

USAGE:
aurora-cli-rs near read get-aurora-erc20 <NEP_141_ACCOUNT>

get-balance

Get NEP-141 balance from ERC20 address

  • arguments: ADDRESS_HEX
  • options: default

Example

USAGE:
aurora-cli-rs near read get-balance <ADDRESS_HEX>

borsh input problem

get-block-hash

Get block hash from a block number

  • arguments: BLOCK_NUMBER
  • options: default

Example

USAGE:
aurora-cli-rs near read get-block-hash <BLOCK_NUMBER>

get-bridged-nep141

Get bridged NEP141 from ERC20 token address

  • arguments: ERC_20_ADDRESS_HEX
  • options: default

Example

USAGE:
aurora-cli-rs near read get-bridged-nep141 <ERC_20_ADDRESS_HEX>

get-chain-id

Get chain id

  • arguments: none
  • options: default

Example

USAGE:
aurora-cli-rs near read get-chain-id

get-code

Get code

  • arguments: ADDRESS_HEX
  • options: default

Example

USAGE:
aurora-cli-rs near read get-code <ADDRESS_HEX>

get-engine-bridge-prover

Get engine bridge prover account id

  • arguments: none
  • options: default

Example

USAGE:
aurora-cli-rs near read get-engine-bridge-prover

get-nonce

Get nonce of an account from an ethereum address

  • arguments: ADDRESS_HEX
  • options: default

Example

USAGE:
aurora-cli-rs near read get-nonce <ADDRESS_HEX>

get-paused-flags

Get paused flag to see if the state is paused

  • arguments: none
  • options: default

Example

USAGE:
aurora-cli-rs near read get-paused-flags <ADDRESS_HEX>

get-receipt-result

Get NEAR receipt result from receipt id with base58 encoding

  • arguments: RECIPT_ID_B58
  • options: default

Example

USAGE:
aurora-cli-rs near read get-receipt-result <RECEIPT_ID_B58>

get-storage-at

Get storage data at an Ethereum address and a key

  • arguments: ADDRESS_HEX, KEY_HEX
  • options: default

Example

USAGE:
aurora-cli-rs near read get-storage-at <ADDRESS_HEX> <KEY_HEX>

deprecated

get-upgrade-index

Get upgrade index

  • arguments: none
  • options: default

Example

USAGE:
aurora-cli-rs near read get-upgrade-index

solidity

Send ABI encoded query input in a solidity contract

  • arguments: call-args-by-name, unary-call
  • options: --amount <AMOUNT>, --sender-addr-hex <SENDER_ADDR_HEX>, --target-addr-hex <TARGET_ADDR_HEX>

Example

USAGE:
aurora-cli-rs near read solidity [OPTIONS] --target-addr-hex <TARGET_ADDR_HEX> <SUBCOMMAND>

OPTIONS:
-a, --amount <AMOUNT>
-h, --help Print help information
-s, --sender-addr-hex <SENDER_ADDR_HEX>
-t, --target-addr-hex <TARGET_ADDR_HEX>

SUBCOMMANDS:
call-args-by-name Allows invoking a solidity functions by passing in a JSON object. The
names of the fields are the argument names of the function, and the
values are strings that can be parsed into the correct types
help Print this message or the help of the given subcommand(s)
unary-call

storage-balance-of

Get NEAR storage balance of an NEAR account id

  • arguments: account_id
  • options: default

Example

USAGE:
aurora-cli-rs near read storage-balance-of <ACCOUNT_ID>

Near write

begin-block

Begin block at Engine EVM state

  • arguments: <HASH>, <COINBASE>, <TIMESTAMP>, <NUMBER>, <DIFFICULTY>, <GASLIMIT>
  • options: default

Example

USAGE:
aurora-cli-rs near write begin-block <HASH> <COINBASE> <TIMESTAMP> <NUMBER> <DIFFICULTY> <GASLIMIT>

begin-chain

Begin Aurora EVM state

  • arguments: <CHAIN_ID>, <GENESIS_ALLOC>
  • options: default

Example

USAGE:
aurora-cli-rs near write begin-chain <CHAIN_ID> <GENESIS_ALLOC>

call

Execute raw ethereum transaction with 'call' method in Aurora EVM state

  • arguments: <CALL_BYTE_HEX>
  • options: default

Example

USAGE:
aurora-cli-rs near write call <CALL_BYTE_HEX>

deploy-code

Deploy a code at Aurora EVM state with raw transaction

  • arguments: <CODE_BYTE_HEX>
  • options: default

Example

USAGE:
aurora-cli-rs near write deploy-code <CODE_BYTE_HEX>

deploy-erc20-token

Deploy bridged ERC20 token from NEP-141

  • arguments: <NEP141>
  • options: default

Example

USAGE:
aurora-cli-rs near write deploy-erc20-token <NEP141>

engine-call

Call a smart contract at an Ethereum address with inputs

  • arguments: none
  • options: --target-addr-hex <TARGET_ADDR_HEX>, --input-data-hex <INPUT_DATA_HEX>

Example

USAGE:
aurora-cli-rs near write engine-call [OPTIONS] --target-addr-hex <TARGET_ADDR_HEX> --input-data-hex <INPUT_DATA_HEX>

engine-erc20

Transfer from to an ERC20 at an Ethereum address

  • arguments: allowance, approve, balance-of, total-supply, transfer, transfer-from
  • options: --amount <AMOUNT>, --target-addr-hex <TARGET_ADDR_HEX>

Example

USAGE:
aurora-cli-rs near write engine-erc20 [OPTIONS] --target-addr-hex <TARGET_ADDR_HEX> <SUBCOMMAND>

OPTIONS:
-a, --amount <AMOUNT>
-h, --help Print help information
-t, --target-addr-hex <TARGET_ADDR_HEX>

SUBCOMMANDS:
allowance
approve
balance-of
help Print this message or the help of the given subcommand(s)
total-supply
transfer
transfer-from

engine-xcc

Execute cross contract call precompiles between NEAR and EVM

  • arguments: none
  • options: --target-near-account <TARGET_NEAR_ACCOUNT>, --method-name <METHOD_NAME>

Example

USAGE:
aurora-cli-rs near write engine-xcc [OPTIONS] --target-near-account <TARGET_NEAR_ACCOUNT> --method-name <METHOD_NAME>

factory-update

Update to Factory setting of Aurora EVM state

  • arguments: <WASM_BYTES_PATH>
  • options: default

Example

USAGE:
aurora-cli-rs near write factory-update <WASM_BYTES_PATH>

ft-on-transfer

Callback function to execute on fungible token transfer on bridge

  • arguments: <SENDER_NEAR_ID>, <AMOUNT>, <MSG>
  • options: default

Example

USAGE:
aurora-cli-rs near write ft-on-transfer <SENDER_NEAR_ID> <AMOUNT> <MSG>

ft-transfer

Transfer fungible token to receiver NEAR account id

  • arguments: <RECEIVER_ID>, <AMOUNT>, <MEMO>
  • options: default

Example

USAGE:
aurora-cli-rs near write ft-transfer <RECEIVER_ID> <AMOUNT> <MEMO>

ft-transfer-call

Transfer fungible token to receiver NEAR account id

  • arguments: <RECEIVER_ID>, <AMOUNT>, <MEMO>, <MSG>
  • options: default

Example

USAGE:
aurora-cli-rs near write ft-transfer-call <RECEIVER_ID> <AMOUNT> <MEMO> <MSG>

register-relayer

Register relayer with an Ethereum address

  • arguments: <RELAYER_ETH_ADDRESS_HEX>
  • options: default

Example

USAGE:
aurora-cli-rs near write register-relayer <RELAYER_ETH_ADDRESS_HEX>

set-paused-flags

Set EVM state in Aurora as paused or not

  • arguments: <PAUSED_MASK>
  • options: default

Example

USAGE:
aurora-cli-rs near write set-paused-flags <PAUSED_MASK>

solidity

Send ABI encoded call input in a solidity contract

  • arguments: call-args-by-name, unary-call
  • options: --amount <AMOUNT>, --sender-addr-hex <SENDER_ADDR_HEX>, --target-addr-hex <TARGET_ADDR_HEX>

Example

USAGE:
aurora-cli-rs near write solidity [OPTIONS] --target-addr-hex <TARGET_ADDR_HEX> <SUBCOMMAND>

OPTIONS:
-a, --amount <AMOUNT>
-h, --help Print help information
-s, --sender-addr-hex <SENDER_ADDR_HEX>
-t, --target-addr-hex <TARGET_ADDR_HEX>

SUBCOMMANDS:
call-args-by-name Allows invoking a solidity functions by passing in a JSON object. The
names of the fields are the argument names of the function, and the
values are strings that can be parsed into the correct types
help Print this message or the help of the given subcommand(s)
unary-call

storage-deposit

Deposit NEAR on engine for storage balance

  • arguments: <ACCOUNT_ID>
  • options: default

Example

USAGE:
aurora-cli-rs near write storage-deposit <ACCOUNT_ID> [REGISTRATION_ONLY]

storage-unregister

Unregister storage for Aurora Engine

  • arguments: <FORCE>
  • options: default

Example

USAGE:
aurora-cli-rs near write storage-deposit <FORCE> [REGISTRATION_ONLY]

storage-withdraw

Withdraw NEAR from storage balance of Aurora Engine contract

  • arguments: <AMOUNT>
  • options: default

Example

USAGE:
aurora-cli-rs near write storage-withdraw <AMOUNT>

withdraw

Withdraw wrapped NEAR to

  • arguments: <RECIPIENT_ADDRESS>, <AMOUNT>
  • options: default

Example

USAGE:
aurora-cli-rs near write withdraw <RECIPIENT_ADDRESS> <AMOUNT>

Aurora read

get-result

Get eth transaction result from transaction hash

  • arguments: <TX_HASH_HEX>
  • options: default

Example

USAGE:
aurora-cli-rs aurora read get-result <TX_HASH_HEX>

Aurora write

call

Call Ethereum smart contract

  • arguments: none
  • options: --target-addr-hex <TARGET_ADDR_HEX>, --input-data-hex <INPUT_DATA_HEX>
USAGE:
aurora-cli-rs aurora write call [OPTIONS] --target-addr-hex <TARGET_ADDR_HEX> --input-data-hex <INPUT_DATA_HEX>

deploy

Deploy Ethereum smart contract

  • arguments: <INPUT_DATA_HEX>
  • options: default

Example

USAGE:
aurora-cli-rs aurora write deploy <INPUT_DATA_HEX>

transfer

Transfer ETH from coinbase to

  • arguments: none
  • options: --target-addr-hex <TARGET_ADDR_HEX>, --amount <AMOUNT>

Example

USAGE:
aurora-cli-rs aurora write transfer --target-addr-hex <TARGET_ADDR_HEX> --amount <AMOUNT>