Console Mode

This page describes Elld Javascript console

Overview

Elld comes with a Javascript environment designed to allow users interact with the client, blockchain state and the network. With the console, you will be able to write and execute complex scripts in Javascript.

Start the Console

Starting the Elld in console mode is simple. You only need to use the console command instead of the start command.

elld console -a "0.0.0.0:9000"

The command above will start the client and immediately present you with a prompt to type arbitrary Javascript expressions expressions and call in-built functions.

Attach To A Running Client

Elld provides the ability to start a console that attaches to a remote node. Using attach command instead of console starts the console in attach mode.

In attach mode, only the console and a RPC client is enabled. You can call most functions that are available in the un-attached mode.

elld attach

The command above will attach to the local Elld instance running on the default RPC address 127.0.0.1:8999. Use --rpcaddress to specify a different address.

Console APIs

The console environment includes in-built, helper methods for interacting with the client, blockchain state and the network. These methods are categorized into namespaces according to their functions and similarities.

Namespace

Description

global

Includes convenience methods that are commonly used.

admin

Perform administrative functions.

personal

Includes methods that access or interact with node's accounts.

ell

Includes methods that access and interact with an accounts balance.

rpc

Includes methods that starts, stops and checks the status of the RPC server.

_system

Includes non-user friendly methods that are directly bound to native functions.

RPC Namespaces

RPC namespaces provides access to services offered by the RPC server. They are not available in the console until the RPC server starts to run. These are the namespaces:

Namespace

Description

state

Access the blockchain state (e.g blocks, branches etc)

ell

Access account balance and send balance.

node

Includes methods to access client information (e.g configs, sync state etc).

pool

Access the transaction pool.

miner

Manage the CPU miner.

personal

Includes methods that access or interact with node's accounts.

admin

Perform administrative functions

net

Manage and access the clients peers and network functions.

logger

Update log level (useful for debugging)

Start RPC Service

By default, RPC namespaces will not be accessible in the console when the RPC server is not turned on. To turn on the RPC server within the console, call the rpc.start method:

> rpc.start()

Which should produce the log output below:

> INFO[0008] RPC service started Address="127.0.0.1:8999"

‚Äč