Skip to main content

Overview

The Viction console is an interactive JavaScript runtime environment that provides a powerful interface for interacting with a Viction node. It exposes the full Web3 JavaScript API along with node administration interfaces.

Commands

console

Start an interactive JavaScript environment with a new or existing Viction node.

Description

The console command starts a full Viction node and attaches an interactive JavaScript console to it. This is the primary method for local node interaction and administration. The console exposes:
  • Complete Web3 JavaScript Ðapp API
  • Node administration interface
  • Account management functions
  • Network and peer management
  • Blockchain query capabilities

Options

The console command accepts all standard node flags plus console-specific options:
string
default:"."
JavaScript root path for loadScript command
string
Execute JavaScript statement and exit (non-interactive mode)
string
Comma separated list of JavaScript files to preload into the console

Interactive Example

This starts a node and opens the console:

Execute Single Command

Output:

Preload Scripts

attach

Connect to an already running Viction node.

Description

The attach command connects to a running Viction node via IPC, WebSocket, or HTTP and opens an interactive JavaScript console. This is useful for:
  • Managing a node running as a background service
  • Connecting to remote nodes
  • Running multiple console sessions on the same node

Endpoint Formats

string
tomo attach /path/to/tomo.ipcConnects via IPC socket (most secure, local only)
string
tomo attach ws://hostname:8546Connects via WebSocket (supports remote connections)
string
tomo attach http://hostname:8545Connects via HTTP RPC (supports remote connections)

Options

string
default:"."
JavaScript root path for loadScript command
string
Execute JavaScript statement and exit
string
Comma separated list of JavaScript files to preload
string
Data directory for finding the default IPC endpoint

Examples

Attach via IPC (default):
This connects to the default IPC endpoint: ~/.tomo/tomo.ipc Attach via IPC with custom path:
Attach via WebSocket:
Attach via HTTP:
Execute command on remote node:
Attach with custom datadir:

js

Execute JavaScript files without interactive mode.

Description

The js command starts an ephemeral Viction node, executes the specified JavaScript files in sequence, and then shuts down. This is useful for:
  • Automated blockchain tasks
  • Scripted deployments
  • Batch operations
  • Testing and development

Options

Accepts all standard node flags plus:
string
default:"."
JavaScript root path for relative file paths
string
Comma separated list of JavaScript files to preload before execution

Example Scripts

check_balance.js:
deploy_contract.js:

Usage

The node will wait for pending callbacks to complete. Press Ctrl-C to force exit.

JavaScript API

The console exposes several API modules:

Web3 Modules

Console Features

Command History

The console maintains command history across sessions:
  • Up/Down arrows: Navigate history
  • Ctrl+R: Reverse history search
  • History file: ~/.tomo/history

Tab Completion

Press Tab to auto-complete:

Loading Scripts

Pretty Printing

Large objects are automatically formatted:

Common Console Tasks

Check Node Status

Account Operations

Send Transactions

Query Blockchain

Smart Contract Interaction

Masternode Management

Security Considerations

IPC vs HTTP/WebSocketIPC is the most secure connection method as it’s limited to local access. When using HTTP or WebSocket, ensure proper firewall rules and consider using authentication.
Personal APINever expose the personal module over HTTP/WebSocket on public networks. It allows account management and can be exploited.
Unlocking AccountsWhen unlocking accounts, use the minimum required duration. Never leave accounts unlocked indefinitely.

Tips and Tricks

Create Aliases

Create convenient aliases for common operations:
Then use:

Monitor Events

Exit Console

To exit the console:
or press Ctrl+D

Troubleshooting

Cannot Connect via Attach

  1. Ensure the node is running
  2. Verify the endpoint path/URL
  3. For WebSocket/HTTP, ensure the server is enabled:

Module Not Available

If a module (e.g., personal) is not available:
  1. Check which modules are enabled (shown at console start)
  2. For attach via HTTP/WS, enable the module:

Script Execution Errors

If scripts fail with loadScript:
  1. Verify the file path is correct
  2. Check file permissions
  3. Use absolute paths or set --jspath correctly
  4. Look for syntax errors in the script

See Also