Skip to main content

Energi Management API

Beside the official dApp APIs interface Energi Core Node has support for additional management APIs. Similar to the DApp APIs, these are also provided using JSON-RPC and follow exactly the same conventions. Energi comes with a console client which has support for all additional APIs described here.

Enabling the management APIs

To offer these APIs over the Energi RPC endpoints, please specify them with the --${interface}api command line argument (where ${interface} can be rpc for the HTTP endpoint, ws for the WebSocket endpoint and ipc for the unix socket (Unix) or named pipe (Windows) endpoint).

For example: energi3 --ipcapi admin,eth,miner --rpcapi eth,web3 --rpc

  • Enables the admin, official DApp and miner API over the IPC interface
  • Enables the official DApp and web3 API over the HTTP interface

The HTTP RPC interface must be explicitly enabled using the --rpc flag.

Please note, offering an API over the HTTP (rpc) or WebSocket (ws) interfaces will give everyone access to the APIs who can access this interface (DApps, browser tabs, etc). Be careful which APIs you enable. By default Energi enables all APIs over the IPC (ipc) interface and only the db, eth, net and web3 APIs over the HTTP and WebSocket interfaces.

To determine which APIs an interface provides, the modules JSON-RPC method can be invoked. For example over an ipc interface on unix systems:

echo '{"jsonrpc":"2.0","method":"rpc_modules","params":[],"id":1}' | nc -U $datadir/energi.ipc

will give all enabled modules including the version number:

{  
"id":1,
"jsonrpc":"2.0",
"result":{
"admin":"1.0",
"debug":"1.0",
"energi":"1.0",
"eth":"1.0",
"masternode":"1.0",
"miner":"1.0",
"net":"1.0",
"personal":"1.0",
"rpc":"1.0",
"txpool":"1.0",
"web3":"1.0"
}
}

List of management APIs

Beside the officially exposed DApp API namespaces (energi,eth, masternode, web3), Energi provides the following extra management API namespaces:

  • admin: energi node management
  • debug: energi node debugging
  • energi: energi management
  • masternode: energi masternode management
  • miner: Miner management
  • personal: Account management
  • txpool: Transaction pool inspection
admindebugenergiminermasternodepersonaltxpool
datadirbacktraceAtlistGen2CoinssetMinerNonceCapcollateralBalanceecRecovercontent
nodeInfoblockProfilesearchGen2CoinsstakingStatusdepositCollateralimportRawKeyinspect
peerscpuProfilesearchRawGen2CoinsautocompoundingwithdrawCollaterallistAccountsstatus
addPeerdumpBlockclaimGen2CoinsDirectstartlistMasternodeslockAccount
addTrustedPeergcStatsclaimGen2CoinsCombinedstopmasternodeInfonewAccount
removePeergetBlockRlpsearchGen3DestinationByGen2AddresssetRecommitIntervalannounceunlockAccount
removeTrustedPeergoTraceclaimGen2CoinsImportsetGasPricedenouncesendTransaction
startRPCmemStatsbudgetInfosetExtrastatssign
startWSseedHashsignbudgetProposesetEtherbasesignTransaction
stopRPCsetBlockProfileRateblacklistInfoaddDPoSopenWallet
stopWSsetHeadblacklistEnforceremoveDPoSderiveAccount
exportChainstacksblacklistRevoke
importChainstartCPUProfileblacklistDrain
validateMigrationstartGoTraceblacklistCollect
checkpointLocalstopCPUProfilecheckpointInfo
stopGoTracecheckpointPropose
traceBlockupgradeInfo
traceBlockByNumberupgradePropose
traceBlockByHashupgradePerform
traceBlockFromFileupgradeCollect
traceTransactionvoteAccept
verbosityvoteReject
vmodulewithdrawFee
writeBlockProfilecompensationInfo
writeMemProfilecompensationProcess
compensationPropose

Admin

The admin API gives you access to several non-standard RPC methods, which will allow you to have a fine grained control over your energi instance, including but not limited to network peer and RPC endpoint management.

admin_datadir

The datadir administrative property can be queried for the absolute path the running energi node currently uses to store all its databases.

ClientMethod invocation
Goadmin.Datadir() (string, error)
Consoleadmin.datadir
RPC{"method": "admin_datadir"}

Example

> admin.datadir
"/home/username/.energicore"

admin_nodeInfo

The nodeInfo administrative property can be queried for all the information known about the running energi node at the networking granularity. These include general information about the node itself as a participant of the ÐΞVp2p P2P overlay protocol, as well as specialized information added by each of the running application protocols (e.g. eth, les, shh, bzz).

ClientMethod invocation
Goadmin.NodeInfo() (*p2p.NodeInfo, error)
Consoleadmin.nodeInfo
RPC{"method": "admin_nodeInfo"}

Example

> admin.nodeInfo
{
enode: "enode://679dd0db3c5adb2204713643e61f59a6e11e83dd21b6710be6709f2adf87fa7d94d39d2dc125c351214e0dbbc404f23c4b41b3f4c26c235e8409116bbc3a6338@149.28.111.46:49797",
enr: "0xf896b8404a2d9784a9acf55469c4ba0ec0f90a6ec4bea024a3f408ed5ed1488efac1951f12d3851d55eb2683af1dbaf97883aa6d5abf1d1d19d5b9d81d4bc4e705de89032483636170c6c5836574684682696482763482697084951c6f2e89736563703235366b31a102679dd0db3c5adb2204713643e61f59a6e11e83dd21b6710be6709f2adf87fa7d8374637082c2858375647082c285",
id: "fe2dfbf5803836726c687fce171e69c48ab948eaeed827ab40161cc7146f2a55",
ip: "149.28.111.46",
listenAddr: "[::]:49797",
name: "energi/v0.8.2-devel/linux-amd64/go1.13.4",
ports: {
discovery: 49797,
listener: 49797
},
protocols: {
eth: {
config: {
byzantiumBlock: 0,
chainId: 49797,
constantinopleBlock: 0,
eip150Block: 0,
eip150Hash: "0x0000000000000000000000000000000000000000000000000000000000000000",
eip155Block: 0,
eip158Block: 0,
energi: {...},
homesteadBlock: 0,
mnCleanupPeriod: 10800,
mnEverCollateral: 3e+22,
mnRequireValidation: 5,
mnRewardsPerBlock: 10,
mnValidationPeriod: 5,
petersburgBlock: 0,
superblockCycle: 1440
},
difficulty: 8969814167,
genesis: "0x93b3a19ffad91326cd638f15930fdea1268c24d599b50b0e19299209c70c0e4e",
head: "0x0d552f8a588a5d35b078e1a3453524db97ccf01758ab36e566eccac9a7ede503",
network: 49797
}

admin_peers

The peers administrative property can be queried for all the information known about the connected remote nodes at the networking granularity. These include general information about the nodes themselves as participants of the ÐΞVp2p P2P overlay protocol, as well as specialized information added by each of the running application protocols (e.g. eth, les, shh, bzz).

ClientMethod invocation
Goadmin.Peers() ([]*p2p.PeerInfo, error)
Consoleadmin.peers
RPC{"method": "admin_peers"}

Example

> admin.peers
[{
caps: ["eth/70"],
enode: "enode://dfd101e56b9124e5f5674470929a9ae9d75de493f43d7057d5dba543e235d7638b0d5e6e883dc12aef9d46ead51e58ee46c5bd67e458d5856ce009e88920dce5@100.0.197.59:49797",
id: "759ce1410ca7aad3def9c34cfbf2853d00253fda5c4cfc98d078e4a5052b4b99",
name: "energi/v3.0.3-stable/linux-arm64/go1.13.8",
network: {
inbound: false,
localAddress: "192.168.43.36:54264",
remoteAddress: "100.0.197.59:49797",
static: false,
trusted: false
},
protocols: {
eth: {
difficulty: 136128690128,
head: "0xb8bd8c3354aa16f18fa378783a749dcb6d412c19e654918c5a5fe660b22cd2a2",
version: 70
}
}
}]

admin_addPeer

The addPeer administrative method requests adding a new remote node to the list of tracked static nodes. The node will try to maintain connectivity to these nodes at all times, reconnecting every once in a while if the remote connection goes down.

The method accepts a single argument, the enode URL of the remote peer to start tracking and returns a BOOL indicating whether the peer was accepted for tracking or some error occurred.

ClientMethod invocation
Goadmin.AddPeer(url string) (bool, error)
Consoleadmin.addPeer(nodeURL)
RPC{"method": "admin_addPeer", "params": [url]}

Example

> admin.addPeer("enode://439da3ce5873d7afb3f4516ecc8bf3fd3ff3772f00fdbe9248d13978ab9f2e5a95aeb20e808ef5248ca5e071853202c0bdaf9aae8c5bf907423de5d575f34665@52.36.22.29:49797")
true
//To verify that it has been added to the list:
> admin.peers
[{
caps: ["eth/70"],
enode: "enode://dfd101e56b9124e5f5674470929a9ae9d75de493f43d7057d5dba543e235d7638b0d5e6e883dc12aef9d46ead51e58ee46c5bd67e458d5856ce009e88920dce5@100.0.197.59:49797",
id: "759ce1410ca7aad3def9c34cfbf2853d00253fda5c4cfc98d078e4a5052b4b99",
name: "energi/v3.0.3-stable/linux-arm64/go1.13.8",
network: {
inbound: false,
localAddress: "192.168.43.36:54264",
remoteAddress: "100.0.197.59:49797",
static: false,
trusted: false
},
protocols: {
eth: {
difficulty: 136128690128,
head: "0xb8bd8c3354aa16f18fa378783a749dcb6d412c19e654918c5a5fe660b22cd2a2",
version: 70
}
}
}, {
caps: ["eth/70"],
enode: "enode://439da3ce5873d7afb3f4516ecc8bf3fd3ff3772f00fdbe9248d13978ab9f2e5a95aeb20e808ef5248ca5e071853202c0bdaf9aae8c5bf907423de5d575f34665@52.36.22.29:49797",
id: "845663d3a6b2679927d24ea24930488189283544833df804a8f7ee6705e68c1a",
name: "energi/v3.0.4-stable/linux-amd64/go1.13.8",
network: {
inbound: false,
localAddress: "192.168.43.36:43402",
remoteAddress: "52.36.22.29:49797",
static: false,
trusted: false
},
protocols: {
eth: {
difficulty: 115451169321,
head: "0xbc24007fe19978884bd000552ac082babf49aa76ba3df8bf904e537265ca6fa4",
version: 70
}
}
}]

admin_addTrustedPeer

The addTrustedPeer administrative method pass a nodeURL to connect a to a peer on the network. The nodeURL needs to be in enode URL format.

ClientMethod invocation
Consoleadmin.addTrustedPeer(nodeURL)

Example

>admin.addTrustedPeer("enode://3abb689050324339e9e78c3c4bcac92f831d6f410e590dc07c2c6da01008dea3546a06fed8bc7682513b941f9d2d1d04121eb5ffe9ef21cbe879cd0ac3759c7d@45.32.129.164:49797")
true

admin_removePeer

The removePeer administrative method passes a nodeURL to remove a peer on the network. The nodeURL must be in anger URL format.

ClientMethod invocation
Consoleadmin.removePeer(nodeURL)

Example

>admin.removePeer("enode://3abb689050324339e9e78c3c4bcac92f831d6f410e590dc07c2c6da01008dea3546a06fed8bc7682513b941f9d2d1d04121eb5ffe9ef21cbe879cd0ac3759c7d@45.32.129.164:49797")
true

admin_removeTrustedPeer

The removeTrustedPeer administrative method passes a nodeURL to remove a peer on the network. The nodeURL must be in anger URL format.

ClientMethod invocation
Consoleadmin.removeTrustedPeer(nodeURL)

Example

>admin.removeTrustedPeer("enode://3abb689050324339e9e78c3c4bcac92f831d6f410e590dc07c2c6da01008dea3546a06fed8bc7682513b941f9d2d1d04121eb5ffe9ef21cbe879cd0ac3759c7d@45.32.129.164:49797")
true

admin_startRPC

The startRPC administrative method starts an HTTP based JSON RPC API webserver to handle client requests. All the parameters are optional:

  • host: network interface to open the listener socket on (defaults to "localhost")
  • port: network port to open the listener socket on (defaults to 39796)
  • cors: cross-origin resource sharing header to use (defaults to "")
  • apis: API modules to offer over this interface (defaults to "eth,net,web3")

The method returns a boolean flag specifying whether the HTTP RPC listener was opened or not. Please note, only one HTTP endpoint is allowed to be active at any time.

ClientMethod invocation
Goadmin.StartRPC(host string, port rpc.HexNumber, cors string, apis string) (bool, error)
Consoleadmin.startRPC(host, port, cors, apis)
RPC{"method": "admin_startRPC", "params": [host, port, cors, apis]}

Example

> admin.startRPC("127.0.0.1", 39796)
true
//To add other options you have to stop the RPC communication
> admin.stopRPC()
true
//To offer nrg, net and energi modules on RPC communication
> admin.startRPC("127.0.0.1", 39796, "", 'nrg, net, energi')
true

admin_startWS

The startWS administrative method starts with a WebSocket based JSON RPC API webserver to handle client requests. All the parameters are optional:

  • host: network interface to open the listener socket on (defaults to "localhost")
  • port: network port to open the listener socket on (defaults to 39795)
  • cors: cross-origin resource sharing header to use (defaults to "")
  • apis: API modules to offer over this interface (defaults to "eth,net,web3")

The method returns a boolean flag specifying whether the WebSocket RPC listener was open or not. Please note, only one WebSocket endpoint is allowed to be active at any time.

ClientMethod invocation
Goadmin.StartWS(host string, port rpc.HexNumber, cors string, apis string) (bool, error)
Consoleadmin.startWS(host, port, cors, apis)
RPC{"method": "admin_startWS", "params": [host, port, cors, apis]}

Example

> admin.startWS("127.0.0.1", 39795)
true

admin_stopRPC

The stopRPC administrative method closes the currently open HTTP RPC endpoint. As the node can only have a single HTTP endpoint running, this method takes no parameters, returning a boolean whether the endpoint was closed or not.

ClientMethod invocation
Goadmin.StopRPC() (bool, error)
Consoleadmin.stopRPC()
RPC{"method": "admin_stopRPC"}

Example

> admin.stopRPC()
true

admin_stopWS

The stopWS administrative method closes the currently open WebSocket RPC endpoint. As the node can only have a single WebSocket endpoint running, this method takes no parameters, returning a boolean whether the endpoint was closed or not.

ClientMethod invocation
Goadmin.StopWS() (bool, error)
Consoleadmin.stopWS()
RPC{"method": "admin_stopWS"}

Example

> admin.stopWS()
true

admin_exportChain

The exportChain administrative method exports the blockchain to the given file in binary format. Return true on success, otherwise false.

ClientMethod invocation
Consoleadmin.exportChain('path/to/file')

Example

> admin.exportChain('/home/user/export_data')
true
//A binary file, called export_data, is created at the specified address.

admin_importChain

The importChain administrative method imports the blockchain from a marshalled binary format. Note that the blockchain is reset (to genesis) before the imported blocks are inserted to the chain. Return true on success, otherwise false.

ClientMethod invocation
Consoleadmin.importChain('path/to/file')

Example

//Using the result of the example from the previous section
> admin.importChain('/home/user/export_data')
true

admin_validateMigration

The validateMigration administrative method validates locally that the blockchain migration has been done without scams.

ClientMethod invocation
Consoleadmin.validateMigration(file)

Example

admin_checkpointLocal

The checkpointLocal administrative method allows you to apply the checkpoint locally. To see a list of the proposed checkpoints see the _checkpointInfo method.

ClientMethod invocation
Consoleadmin.checkpointLocal(number, hash)

Example

Debug

The debug API gives you access to several non-standard RPC methods, which will allow you to inspect, debug and set certain debugging flags during runtime.

debug_backtraceAt

Sets the logging backtrace location. When a backtrace location is set and a log message is emitted at that location, the stack of the goroutine executing the log statement will be printed to stderr.

The location is specified as <filename>:<line>.

ClientMethod invocation
Consoledebug.backtraceAt(string)
RPC{"method": "debug_backtraceAt", "params": [string]}

Example:

> debug.backtraceAt("block.go:271")
null

debug_blockProfile

Turns on block profiling for the given duration and writes profile data to disk. It uses a profile rate of 1 for most accurate information. If a different rate is desired, set the rate and write the profile manually using debug_writeBlockProfile.

ClientMethod invocation
Consoledebug.blockProfile(file, seconds)
RPC{"method": "debug_blockProfile", "params": [string, number]}

Example:

> debug.blockProfile('energi.profile', 1)
null

debug_cpuProfile

Turns on CPU profiling for the given duration and writes profile data to disk.

ClientMethod invocation
Consoledebug.cpuProfile(file, seconds)
RPC{"method": "debug_cpuProfile", "params": [string, number]}

Example:

> debug.cpuProfile("energi.profile", 10)
null

debug_dumpBlock

Retrieves the state that corresponds to the block number and returns a list of accounts (including storage and code). The block_number is a hex string. If the block number does not exist, it returns the error 'missing trie node'.

ClientMethod invocation
Consoledebug.DumpBlock(block_number)

Example

> var dumBlock=debug.dumpBlock(web3.toHex(79002))
undefined

> dumBlock.root
"c2c8817d1ff170bc8b94c844807dd06b71bba553337f90d7cc1e19d8148b3923"

//If the block is not stored in the node:
> debug.dumpBlock(web3.toHex(75100))
Error: missing trie node d2a09009ed0162ac4da2ad6247b78b68c595a9fb4ae06c1669e7eaa14f881045 (path )
at web3.js:3164:20
at web3.js:6368:15
at web3.js:5102:36
at <anonymous>:1:1

debug_gcStats

Returns garbage collection (GC) statistics.

See https://golang.org/pkg/runtime/debug/#GCStats for information about the fields of the returned object.

ClientMethod invocation
Consoledebug.gcStats()
RPC{"method": "debug_gcStats", "params": []}

Example:

> debug.gcStats()
{
LastGC: "2020-04-09T17:38:44.177415435-04:00",
NumGC: 34,
Pause: [32397, 33865, 20498, 21493, 28007, 28463, 26632, 30023, 26400, 24280, 24771, 40584, 62389, 23990, 152777, 175898, 40109, 168668, 39386, 33822, 34844, 43313, 63097, 37240, 101870, 42657, 54167, 36284, 44091, 31994, 30718, 44071, 26629, 225296],
PauseEnd: ["2020-04-09T17:38:44.177415435-04:00", "2020-04-09T17:36:43.759227836-04:00", "2020-04-09T17:36:38.22539545-04:00", "2020-04-09T17:36:19.619719195-04:00", "2020-04-09T17:36:02.344265137-04:00", "2020-04-09T17:35:54.249068-04:00", "2020-04-09T17:35:06.790595319-04:00", "2020-04-09T17:35:01.069936797-04:00", "2020-04-09T17:34:44.279025039-04:00", "2020-04-09T17:34:32.218251516-04:00", "2020-04-09T17:34:22.012816349-04:00", "2020-04-09T17:33:20.165958268-04:00", "2020-04-09T17:31:19.598314614-04:00", "2020-04-09T17:29:18.879008002-04:00", "2020-04-09T17:29:01.756476707-04:00", "2020-04-09T17:27:01.563443288-04:00", "2020-04-09T17:25:00.959127499-04:00", "2020-04-09T17:24:09.569324773-04:00", "2020-04-09T17:22:09.360561961-04:00", "2020-04-09T17:20:58.673309213-04:00", "2020-04-09T17:20:53.467706398-04:00", "2020-04-09T17:20:23.966091807-04:00", "2020-04-09T17:19:56.316381814-04:00", "2020-04-09T17:19:40.945951483-04:00", "2020-04-09T17:19:26.973527342-04:00", "2020-04-09T17:17:26.876604199-04:00", "2020-04-09T17:17:21.7245871-04:00", "2020-04-09T17:17:14.830418806-04:00", "2020-04-09T17:17:11.466163325-04:00", "2020-04-09T17:15:50.618711322-04:00", "2020-04-09T17:15:50.340416069-04:00", "2020-04-09T17:15:50.230385317-04:00", "2020-04-09T17:15:50.110889832-04:00", "2020-04-09T17:15:49.925534228-04:00"],
PauseQuantiles: null,
PauseTotal: 1850723
}

debug_getBlockRlp

Retrieves and returns the RLP encoded block by number.

ClientMethod invocation
Godebug.GetBlockRlp(number uint64) (string, error)
Consoledebug.getBlockRlp(number, [options])
RPC{"method": "debug_getBlockRlp", "params": [number]}

Example:

> debug.getBlockRlp(86995)
"f90292f9025aa0437b5ce010a3c3f72cba77ef9873620196f329cfa963c00fccdd826756101c36a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d493479482cfc8ea7043b5459d0a4c9dbcc4c42106c8c0a5a03ce6358a7caa192d9c40e7d405bbf23337f6522b2ae7919e914d5acd2cec44e3a03ece00936462fa52af40bbdd487c1fac36c48deefde6f34731b0398a270fe9fda0d9584402acec6dd9b257cf3671a7633d5fe111581300253293a8a142577edcebb90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008301e1e9830153d38402625a0080845e8f94ae9cdb8303000587656e657267693388676f312e31332e38856c696e7578a002066cedc3d4c1301da337732d8f0012205a3b17bc8f6787569717fa3adbd84088000000000000147db8415e29ba6ae107355548430314b94b6f85586160d8a244bf09aebd66177a45dcb717c6159d75caaae3f92789ab27b671a9090a920a4ae7fc0764abb5d300d6aa1801f3f2830153e9808401c9c38094000000000000000000000000000000000000030088be202d6a0eda000084228cb7338203208080c0"

debug_goTrace

Turns on Go runtime tracing for the given duration and writes trace data to disk.

ClientMethod invocation
Consoledebug.goTrace(file, seconds)
RPC{"method": "debug_goTrace", "params": [string, number]}

Example:

> debug.goTrace("go.trace", 5)
null

debug_memStats

Returns detailed runtime memory statistics.

See https://golang.org/pkg/runtime/#MemStats for information about the fields of the returned object.

ClientMethod invocation
Consoledebug.memStats()
RPC{"method": "debug_memStats", "params": []}

Example:

> debug.memStats()
{
Alloc: 781224264,
BuckHashSys: 2011062,
BySize: [{
Frees: 0,
Mallocs: 0,
Size: 0
}, {
Frees: 14001180,
Mallocs: 14041549,
Size: 8
}, {
Frees: 59709826,
Mallocs: 60079639,
Size: 16
}, {
Frees: 83953849,
Mallocs: 84427149,
Size: 32
}, {
Frees: 14231480,
Mallocs: 14465436,
Size: 48
}, {
Frees: 23611219,
Mallocs: 23913962,
Size: 64
}, {
Frees: 3903912,
Mallocs: 3910357,
Size: 80
}, {
Frees: 8177718,
Mallocs: 8195109,
Size: 96
}, {
Frees: 369487,
Mallocs: 409223,
Size: 112
}, {
Frees: 867709,
Mallocs: 875110,
Size: 128
}, {
Frees: 5250,
Mallocs: 5880,
Size: 144
}, {
Frees: 434872,
Mallocs: 435958,
Size: 160
}, {
Frees: 197327,
Mallocs: 197416,
Size: 176
}, {
Frees: 218191,
Mallocs: 218633,
Size: 192
}, {
Frees: 14449,
Mallocs: 15392,
Size: 208
}, {
Frees: 101290,
Mallocs: 101845,
Size: 224
}, {
Frees: 7024153,
Mallocs: 7025031,
Size: 240
}, {
Frees: 26964,
Mallocs: 29098,
Size: 256
}, {
Frees: 273090,
Mallocs: 274299,
Size: 288
}, {
Frees: 1114416,
Mallocs: 1115961,
Size: 320
}, {
Frees: 402674,
Mallocs: 414199,
Size: 352
}, {
Frees: 4578,
Mallocs: 5037,
Size: 384
}, {
Frees: 6701,
Mallocs: 8248,
Size: 416
}, {
Frees: 122230,
Mallocs: 124934,
Size: 448
}, {
Frees: 2678,
Mallocs: 2721,
Size: 480
}, {
Frees: 20890,
Mallocs: 21321,
Size: 512
}, {
Frees: 57859,
Mallocs: 59025,
Size: 576
}, {
Frees: 9240,
Mallocs: 10331,
Size: 640
}, {
Frees: 1053,
Mallocs: 1274,
Size: 704
}, {
Frees: 678,
Mallocs: 711,
Size: 768
}, {
Frees: 1382,
Mallocs: 1499,
Size: 896
}, {
Frees: 1177,
Mallocs: 1250,
Size: 1024
}, {
Frees: 561,
Mallocs: 585,
Size: 1152
}, {
Frees: 409,
Mallocs: 461,
Size: 1280
}, {
Frees: 572,
Mallocs: 629,
Size: 1408
}, {
Frees: 2269,
Mallocs: 2403,
Size: 1536
}, {
Frees: 314,
Mallocs: 374,
Size: 1792
}, {
Frees: 979,
Mallocs: 1021,
Size: 2048
}, {
Frees: 637,
Mallocs: 664,
Size: 2304
}, {
Frees: 851,
Mallocs: 896,
Size: 2688
}, {
Frees: 388,
Mallocs: 425,
Size: 3072
}, {
Frees: 36,
Mallocs: 43,
Size: 3200
}, {
Frees: 145,
Mallocs: 149,
Size: 3456
}, {
Frees: 993,
Mallocs: 1021,
Size: 4096
}, {
Frees: 2577,
Mallocs: 5711,
Size: 4864
}, {
Frees: 676,
Mallocs: 1361,
Size: 5376
}, {
Frees: 1208,
Mallocs: 6017,
Size: 6144
}, {
Frees: 66,
Mallocs: 75,
Size: 6528
}, {
Frees: 23,
Mallocs: 28,
Size: 6784
}, {
Frees: 72,
Mallocs: 73,
Size: 6912
}, {
Frees: 7231,
Mallocs: 37454,
Size: 8192
}, {
Frees: 1020,
Mallocs: 1043,
Size: 9472
}, {
Frees: 22,
Mallocs: 31,
Size: 9728
}, {
Frees: 208,
Mallocs: 213,
Size: 10240
}, {
Frees: 932,
Mallocs: 970,
Size: 10880
}, {
Frees: 367,
Mallocs: 373,
Size: 12288
}, {
Frees: 146,
Mallocs: 150,
Size: 13568
}, {
Frees: 11,
Mallocs: 12,
Size: 14336
}, {
Frees: 474,
Mallocs: 560,
Size: 16384
}, {
Frees: 241,
Mallocs: 255,
Size: 18432
}, {
Frees: 60,
Mallocs: 61,
Size: 19072
}],
DebugGC: false,
EnableGC: true,
Frees: 230841652,
GCCPUFraction: 0.0009352435872180002,
GCSys: 80465920,
HeapAlloc: 781224264,
HeapIdle: 1126555648,
HeapInuse: 884547584,
HeapObjects: 1560864,
HeapReleased: 754499584,
HeapSys: 2011103232,
LastGC: 1586468684744159500,
Lookups: 0,
MCacheInuse: 6944,
MCacheSys: 16384,
MSpanInuse: 9532648,
MSpanSys: 18481152,
Mallocs: 232402516,
NextGC: 1547627136,
NumForcedGC: 0,
NumGC: 37,
OtherSys: 4538178,
PauseEnd: [1586466949925534200, 1586466950110889700, 1586466950230385400, 1586466950340416000, 1586466950618711300, 1586467031466163200, 1586467034830418700, 1586467041724587000, 1586467046876604200, 1586467166973527300, 1586467180945951500, 1586467196316381700, 1586467223966091800, 1586467253467706400, 1586467258673309200, 1586467329360562000, 1586467449569324800, 1586467500959127600, 1586467621563443200, 1586467741756476700, 1586467758879008000, 1586467879598314500, 1586468000165958100, 1586468062012816400, 1586468072218251500, 1586468084279025200, 1586468101069937000, 1586468106790595300, 1586468154249068000, 1586468162344265200, 1586468179619719200, 1586468198225395500, 1586468203759228000, 1586468324177415400, 1586468444385757000, 1586468564547655700, 1586468684744159500, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
PauseNs: [225296, 26629, 44071, 30718, 31994, 44091, 36284, 54167, 42657, 101870, 37240, 63097, 43313, 34844, 33822, 39386, 168668, 40109, 175898, 152777, 23990, 62389, 40584, 24771, 24280, 26400, 30023, 26632, 28463, 28007, 21493, 20498, 33865, 32397, 125603, 73602, 70053, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
PauseTotalNs: 2119981,
StackInuse: 2162688,
StackSys: 2162688,
Sys: 2118778616,
TotalAlloc: 17995533064
}

debug_seedHash

Fetches and retrieves the seed hash of the block by number

ClientMethod invocation
Godebug.SeedHash(number uint64) (string, error)
Consoledebug.seedHash(number, [options])
RPC{"method": "debug_seedHash", "params": [number]}

Example:

> debug.seedHash(87014)
"0x510e4e770828ddbf7f7b00ab00a9f6adaf81c0dc9cc85f1f8249c256942d61d9"

debug_setHead

Sets the current head of the local chain by block number.

caution

Note, this is a destructive action and may severely damage your chain. Use with extreme caution. The block number in hexadecimal string.

ClientMethod invocation
Godebug.SetHead(number uint64)
Consoledebug.setHead(number)
RPC{"method": "debug_setHead", "params": [number]}
info

References: Ethash

Example:

> debug.setHead(web3.toHex(nrg.blockNumber))
null

debug_setBlockProfileRate

Sets the rate (in samples/sec) of goroutine block profile data collection. A non-zero rate enables block profiling, setting it to zero stops the profile. Collected profile data can be written using debug_writeBlockProfile.

ClientMethod invocation
Consoledebug.setBlockProfileRate(rate)
RPC{"method": "debug_setBlockProfileRate", "params": [number]}

Example:

> debug.setBlockProfileRate(10)
null

debug_stacks

Returns a printed representation of the stacks of all goroutines. Note that the web3 wrapper for this method takes care of the printing and does not return the string.

ClientMethod invocation
Consoledebug.stacks()
RPC{"method": "debug_stacks", "params": []}

Example:

> debug.stacks()
...
goroutine 4722 [select]:
energi.world/core/gen3/p2p.(*Peer).run(0xc014a9aa20, 0xf096a0, 0xc0143b6f00, 0x0)
/mnt/data/workspace/Gen3_Release_linux/p2p/peer.go:215 +0x270
energi.world/core/gen3/p2p.(*Server).runPeer(0xc000266000, 0xc014a9aa20)
/mnt/data/workspace/Gen3_Release_linux/p2p/server.go:1002 +0x124
created by energi.world/core/gen3/p2p.(*Server).run
/mnt/data/workspace/Gen3_Release_linux/p2p/server.go:734 +0x1267

goroutine 4650 [select]:
energi.world/core/gen3/p2p.(*Peer).pingLoop(0xc014a9aa20)
/mnt/data/workspace/Gen3_Release_linux/p2p/peer.go:252 +0x178
created by energi.world/core/gen3/p2p.(*Peer).run
/mnt/data/workspace/Gen3_Release_linux/p2p/peer.go:206 +0x117 ...)
...

debug_startCPUProfile

Turns on CPU profiling indefinitely, writing to the given file.

ClientMethod invocation
Consoledebug.startCPUProfile(file)
RPC{"method": "debug_startCPUProfile", "params": [string]}

Example:

> debug.startCPUProfile("energi.profile")
null

debug_startGoTrace

Starts writing a Go runtime trace to the given file.

ClientMethod invocation
Consoledebug.startGoTrace(file)
RPC{"method": "debug_startGoTrace", "params": [string]}

Example:

> debug.startGoTrace("go.trace")
null

debug_stopCPUProfile

Stops an ongoing CPU profile.

ClientMethod invocation
Consoledebug.stopCPUProfile()
RPC{"method": "debug_stopCPUProfile", "params": []}

Example:

> debug.stopCPUProfile()
null

debug_stopGoTrace

Stops writing the Go runtime trace.

ClientMethod invocation
Consoledebug.stopGoTrace()
RPC{"method": "debug_stopGoTrace", "params": []}

Example:

> debug.stopGoTrace()
null

debug_traceBlock

The traceBlock method will return a full stack trace of all invoked opcodes of all transactions that were included in this block. Note, the parent of this block must be present or it will fail.

ClientMethod invocation
Godebug.TraceBlock(blockRlp []byte, config. *vm.Config) BlockTraceResult
Consoledebug.traceBlock(tblockRlp, [options])
RPC{"method": "debug_traceBlock", "params": [blockRlp, {}]}
info

References: RLP

Example

debug_traceBlockByNumber

Similar to debug_traceBlock, traceBlockByNumber accepts a block number and will replay the block that is already present in the database.

ClientMethod invocation
Godebug.TraceBlockByNumber(number uint64, config. *vm.Config) BlockTraceResult
Consoledebug.traceBlockByNumber(number, [options])
RPC{"method": "debug_traceBlockByNumber", "params": [number, {}]}
info

References: RLP

Example

> debug.traceBlockByNumber('0x64')
Error: nonce too high
at web3.js:3164:20
at web3.js:6368:15
at web3.js:5102:36
at <anonymous>:1:1

debug_traceBlockByHash

Similar to debug_traceBlock, traceBlockByHash accepts a block hash and will replay the block that is already present in the database.

ClientMethod invocation
Godebug.TraceBlockByHash(hash common.Hash, config. *vm.Config) BlockTraceResult
Consoledebug.traceBlockByHash(hash, [options])
RPC{"method": "debug_traceBlockByHash", "params": [hash {}]}
info

References: RLP

Example

> debug.traceBlockByHash("0xbf6909b5441be391ff49e36ff6def186ca1030d654638659eae662c88876c83d")
Error: nonce too high
at web3.js:3164:20
at web3.js:6368:15
at web3.js:5102:36
at <anonymous>:1:1

debug_traceBlockFromFile

Similar to debug_traceBlock, traceBlockFromFile accepts a file containing the RLPRLP of the block.

ClientMethod invocation
Godebug.TraceBlockFromFile(fileName string, config. *vm.Config) BlockTraceResult
Consoledebug.traceBlockFromFile(fileName, [options])
RPC{"method": "debug_traceBlockFromFile", "params": [fileName, {}]}

Example

debug_traceTransaction

The traceTransaction debugging method will attempt to run the transaction in the exact same manner as it was executed on the network. It will replay any transaction that may have been executed prior to this one before it will finally attempt to execute the transaction that corresponds to the given hash.

In addition to the hash of the transaction you may give it a secondary optional argument, which specifies the options for this specific call. The possible options are:

  • disableStorage: BOOL. Setting this to true will disable storage capture (default = false).
  • disableMemory: BOOL. Setting this to true will disable memory capture (default = false).
  • disableStack: BOOL. Setting this to true will disable stack capture (default = false).
  • tracer: STRING. Setting this will enable JavaScript-based transaction tracing, described below. If set, the previous four arguments will be ignored.
  • timeout: STRING. Overrides the default timeout of 5 seconds for JavaScript-based tracing calls. Valid values are described here.
ClientMethod invocation
Godebug.TraceTransaction(txHash common.Hash, logger vm.LogConfig) (ExecutionResurt, error)
Consoledebug.traceTransaction(txHash, [options])
RPC{"method": "debug_traceTransaction", "params": [txHash, {}]}

Example

> debug.traceTransaction("0x4365836fda6f0d173c0c614fae43390b6746bddef24bd4158b45a6192f7ae441")
{....

{
depth: 3,
gas: 7125166,
gasCost: 7013847,
memory: ["78c7d97900000000000000000000000028f14c2508ab4ced9c1cce75ad85725b"],
op: "STATICCALL",
pc: 11191,
stack: ["0000000000000000000000000000000000000000000000000000000000000040", "0000000000000000000000000000000000000000000000000000000000001080", "0000000000000000000000000000000000000000000000000000000000000024", "0000000000000000000000000000000000000000000000000000000000000000", "0000000000000000000000000000000000000000000000000000000000000319", "00000000000000000000000000000000000000000000000000000000006cb8ae"]
}, {
depth: 4,
gas: 7011819,
gasCost: 6902271,
memory: ["27e235e300000000000000000000000028f14c2508ab4ced9c1cce75ad85725b"],
op: "STATICCALL",
pc: 3811,
stack: ["0000000000000000000000000000000000000000000000000000000000000040", "0000000000000000000000000000000000000000000000000000000000000080", "0000000000000000000000000000000000000000000000000000000000000024", "0000000000000000000000000000000000000000000000000000000000000000", "0000000000000000000000007ec5b1bc30237d83e7ac369e47fa250b03f226f1", "00000000000000000000000000000000000000000000000000000000006afdeb"]
}, {
depth: 5,
gas: 6900817,
gasCost: 0,
memory: ["00000000000000000000000000000000000000000000152d02c7e14af6800000", "0000000000000000000000000000000000000000000000000000000000000012"],
op: "RETURN",
pc: 305,
stack: ["0000000000000000000000000000000000000000000000000000000000000040", "0000000000000000000000000000000000000000000000000000000000000000"]
}, {
depth: 4,
gas: 7010184,
gasCost: 0,
memory: ["00000000000000000000000000000000000000000000152d02c7e14af6800000", "0000000000000000000000000000000000000000000000000000000000000012"],
op: "RETURN",
pc: 1113,
stack: ["0000000000000000000000000000000000000000000000000000000000000040", "0000000000000000000000000000000000000000000000000000000000000000"]
}, {
depth: 3,
gas: 7119895,
gasCost: 9700,
memory: [],
op: "CALL",
pc: 9311,
stack: ["0000000000000000000000000000000000000000000000000000000000000000", "0000000000000000000000000000000000000000000000000000000000001080", "0000000000000000000000000000000000000000000000000000000000000000", "0000000000000000000000000000000000000000000000000000000000000000", "0000000000000000000000000000000000000000000000000caf2e284cb50000", "00000000000000000000000028f14c2508ab4ced9c1cce75ad85725b6730f559", "0000000000000000000000000000000000000000000000000000000000000000"]
}

...
}

Tracing Options

You may give trace API function a secondary optional argument, which specifies the options for this specific call. The possible options are:

  • disableStorage: BOOL. Setting this to true will disable storage capture (default = false).
  • disableMemory: BOOL. Setting this to true will disable memory capture (default = false).
  • disableStack: BOOL. Setting this to true will disable stack capture (default = false).
  • timeout: STRING. Overrides the default timeout of 5 seconds for JavaScript-based tracing calls. Valid values are described here.
  • tracer: STRING. Setting this will enable JavaScript-based transaction tracing, described in the next section. If set, the previous four arguments will be ignored. The predefined tracers can also be used as the following table.
Tracer NameDescription
4byteTracer4byteTracer searches for 4byte-identifiers, and collects them for post-processing. It collects the methods identifiers along with the size of the supplied data, so a reversed signature can be matched against the size of the data.
callTracercallTracer is a full-blown transaction tracer that extracts and reports all the internal calls made by a transaction, along with any useful information.
evmdisTracerevmdisTracer returns sufficient information from a trace to perform evmdis-style disassembly.
noopTracernoopTracer is just the barebone boilerplate code required from a JavaScript object to be usable as a transaction tracer.
opcountTraceropcountTracer is a sample tracer that just counts the number of instructions executed by the KLVM before the transaction terminated.
prestateTracerprestateTracer outputs sufficient information to create a local execution of the transaction from a custom assembled genesis block.
revertTracerrevertTracer outputs the error string of REVERT. If the execution is not reverted, it outputs an empty string.

Example

//Using a second parameter:
> debug.traceTransaction("0x4365836fda6f0d173c0c614fae43390b6746bddef24bd4158b45a6192f7ae441", {tracer: "callTracer"})
{
calls: [{
calls: [{...}, {...}, {...}, {...}, {...}, {...}, {...}, {...}, {...}, {...}, {...}, {...}],
from: "0x0000000000000000000000000000000000000300",
gas: "0x1c22c99",
gasUsed: "0x78f24",
input: "0x228cb733",
output: "0x",
to: "0x0000000000000000000000000000000000000310",
type: "CALL",
value: "0xbe202d6a0eda0000"
}],
from: "0x0000000000000000000000000000000000000320",
gas: "0x1c97068",
gasUsed: "0x7adf7",
input: "0x228cb733",
output: "0x",
time: "86.296699ms",
to: "0x0000000000000000000000000000000000000300",
type: "CALL",
value: "0xbe202d6a0eda0000"
}

JavaScript-based tracing

Specifying the tracer option in the second argument enables JavaScript-based tracing. In this mode, tracer is interpreted as a JavaScript expression that is expected to evaluate to an object with (at least) two methods, named step and result.

step is a function that takes two arguments, log and db, and is called for each step of the EVM, or when an error occurs, as the specified transaction is traced.

log has the following fields:

  • pc: Number, the current program counter
  • op: Object, an OpCode object representing the current opcode
  • gas: Number, the amount of gas remaining
  • gasPrice: Number, the cost in wei of each unit of gas
  • memory: Object, a structure representing the contract's memory space
  • stack: array[big.Int], the EVM execution stack
  • depth: The execution depth
  • account: The address of the account executing the current operation
  • err: If an error occured, information about the error

If err is non-null, all other fields should be ignored.

For efficiency, the same log object is reused on each execution step, updated with current values; make sure to copy values you want to preserve beyond the current call. For instance, this step function will not work:

function(log) {

this.logs.append(log);

}

But this step function will:

function(log) {

this.logs.append({gas: log.gas, pc: log.pc, ...});

}

log.op has the following methods:

  • isPush() - returns true iff the opcode is a PUSHn
  • toString() - returns the string representation of the opcode
  • toNumber() - returns the opcode's number

log.memory has the following methods:

  • slice(start, stop) - returns the specified segment of memory as a byte slice
  • length() - returns the length of the memory

log.stack has the following methods:

  • peek(idx) - returns the idx-th element from the top of the stack (0 is the topmost element) as a big.Int
  • length() - returns the number of elements in the stack

db has the following methods:

  • getBalance(address) - returns a big.Int with the specified account's balance
  • getNonce(address) - returns a Number with the specified account's nonce
  • getCode(address) - returns a byte slice with the code for the specified account
  • getState(address, hash) - returns the state value for the specified account and the specified hash
  • exists(address) - returns true if the specified address exists

The second function, 'result', takes no arguments, and is expected to return a JSON-serializable value to return to the RPC caller.

If the step function throws an exception or executes an illegal operation at any point, it will not be called on any further VM steps, and the error will be returned to the caller.

Note that several values are Golang big.Int objects, not JavaScript numbers or JS bigints. As such, they have the same interface as described in the godocs. Their default serialization to JSON is as a Javascript number; to serialize large numbers accurately call .String() on them. For convenience, big.NewInt(x) is provided, and will convert a uint to a Go BigInt.

Usage example, returns the top element of the stack at each CALL opcode only:

debug.traceTransaction(txhash, {tracer: '{data: [], step: function(log) { if(log.op.toString() == "CALL") this.data.push(log.stack.peek(0)); }, result: function() { return this.data; }}'});

debug_verbosity

Sets the logging verbosity ceiling. Log messages with level up to and including the given level will be printed.

The verbosity of individual packages and source files can be raised using debug_vmodule.

Level verbosity: 0=silent, 1=error, 2=warn, 3=info, 4=debug, 5=detail (default: 3)

ClientMethod invocation
Consoledebug.verbosity(level)
RPC{"method": "debug_vmodule", "params": [number]}

Example

> debug.verbosity(4)
null

debug_vmodule

Sets the logging verbosity pattern.

ClientMethod invocation
Consoledebug.vmodule(string)
RPC{"method": "debug_vmodule", "params": [string]}

Examples

If you want to see messages from a particular Go package (directory) and all subdirectories, use:

debug.vmodule("eth/*=6")

If you want to restrict messages to a particular package (e.g. p2p) but exclude subdirectories, use:

debug.vmodule("p2p=6")

If you want to see log messages from a particular source file, use

debug.vmodule("server.go=6")

You can compose these basic patterns. If you want to see all output from peer.go in a package below eth (eth/peer.go, eth/downloader/peer.go) as well as output from package p2p at level <= 5, use:

debug.vmodule("eth/*/peer.go=6,p2p=5")

debug_writeBlockProfile

Writes a goroutine blocking profile to the given file.

ClientMethod invocation
Consoledebug.writeBlockProfile(file)
RPC{"method": "debug_writeBlockProfile", "params": [string]}

Example

>  debug.writeBlockProfile("energi.profile")
null

debug_writeMemProfile

Writes an allocation profile to the given file. Note that the profiling rate cannot be set through the API, it must be set on the command line using the --memprofilerate flag.

ClientMethod invocation
Consoledebug.writeMemProfile(file string)
RPC{"method": "debug_writeBlockProfile", "params": [string]}

Example

> debug.writeMemProfile("mem.profile")
null

Energi

info

Migration commands

energi_listGen2Coins

The listGen2Coins method returns the list of accounts that have migrated to the Gen3 network.

ClientMethod invocation
Consoleenergi.listGen2Coins()

Example

> var list=energi.listGen2Coins();
//This call can take minutes
undefined

> list[0]
{
Amount: 26209720000000000,
ItemID: 0,
Owner: "t7hpCwhNjooEdjuSdFAzf7xn4Zpmheavp7",
RawOwner: "0x088cddfa5a911281f31ca6d59870d4e6789d79f3"
}

> list.length
127210

> list[127209]
{
Amount: 79800000000000000000,
ItemID: 127209,
Owner: "tEBnaAxzCjbvGy3JzxZGRwAwFpEn46vtHv",
RawOwner: "0x4fa7e79dbfbb21c9375e96a36f93595afce2abbe"
}

energi_searchGen2Coins

The searchGen2Coins method returns an object that matches the Gen2 account search in the list of migrated accounts.

ClientMethod invocation
Consoleenergi.searchGen2Coins(owners[], include_empty)
note

Note: include_empty is a boolean parameter.

Example

> list[127209] //See example in the _listGen2Coins section
{
Amount: 79800000000000000000,
ItemID: 127209,
Owner: "tEBnaAxzCjbvGy3JzxZGRwAwFpEn46vtHv",
RawOwner: "0x4fa7e79dbfbb21c9375e96a36f93595afce2abbe"
}

> energi.searchGen2Coins(["tEBnaAxzCjbvGy3JzxZGRwAwFpEn46vtHv"], true)
[{
Amount: 79800000000000000000,
ItemID: 127209,
Owner: "tEBnaAxzCjbvGy3JzxZGRwAwFpEn46vtHv",
RawOwner: "0x4fa7e79dbfbb21c9375e96a36f93595afce2abbe"
}]

> list[0]
{
Amount: 26209720000000000,
ItemID: 0,
Owner: "t7hpCwhNjooEdjuSdFAzf7xn4Zpmheavp7",
RawOwner: "0x088cddfa5a911281f31ca6d59870d4e6789d79f3"
}

> energi.searchGen2Coins(["tEBnaAxzCjbvGy3JzxZGRwAwFpEn46vtHv", "t7hpCwhNjooEdjuSdFAzf7xn4Zpmheavp7"], true)
[{
Amount: 26209720000000000,
ItemID: 0,
Owner: "t7hpCwhNjooEdjuSdFAzf7xn4Zpmheavp7",
RawOwner: "0x088cddfa5a911281f31ca6d59870d4e6789d79f3"
}, {
Amount: 79800000000000000000,
ItemID: 127209,
Owner: "tEBnaAxzCjbvGy3JzxZGRwAwFpEn46vtHv",
RawOwner: "0x4fa7e79dbfbb21c9375e96a36f93595afce2abbe"
}]

energi_searchRawGen2Coins

The searchRawGen2Coins method returns an object that matches the raw_owners search in the list of migrated accounts.

ClientMethod invocation
Consoleenergi.searchGen2Coins(raw_owners[], include_empty)
note

Note: include_empty is a boolean parameter.

Example

> energi.searchRawGen2Coins(["0x088cddfa5a911281f31ca6d59870d4e6789d79f3", "0x4fa7e79dbfbb21c9375e96a36f93595afce2abbe"], true)
[{
Amount: 26209720000000000,
ItemID: 0,
Owner: "t7hpCwhNjooEdjuSdFAzf7xn4Zpmheavp7",
RawOwner: "0x088cddfa5a911281f31ca6d59870d4e6789d79f3"
}, {
Amount: 79800000000000000000,
ItemID: 127209,
Owner: "tEBnaAxzCjbvGy3JzxZGRwAwFpEn46vtHv",
RawOwner: "0x4fa7e79dbfbb21c9375e96a36f93595afce2abbe"
}]

energi_searchGen3DestinationByGen2Address

The searchGen3DestinationByGen2Address method returns the Gen3 account that matches the Gen2 account search in the list of migrated accounts. If the account has not been migrated yet, an empty list returns.

ClientMethod invocation
Consoleenergi.searchGen3DestinationByGen2Address(owners[], include_empty)
note

Note: include_empty is a boolean parameter.

Example

> energi.searchGen3DestinationByGen2Address(['tF79fs6NqZNbPtwkfxZ4CgEHB1GFx2SDyP'], true)
[{
Amount: 100000000000000000000,
Gen3Address: "0x680cf4b9c12736dbab9eec2a481e6101aacf300a",
ItemID: 125222
}]

energi_claimGen2CoinsDirect

The claimGen2CoinsDirect method allows you to claim a specific Gen 2 private key to a Gen 3 address.

ClientMethod invocation
Consoleenergi.claimGen2CoinsDirect(password,'addressGen3', privkey_Gen2)

Example

> energi.claimGen2CoinsDirect('you_password', 0x680cf4b9c12736dbab9eec2a481e6101aacf300a, 'cUJqiAW8mkAp5fm9Ewkv8PkjFALSvviayMykt3rajSU2KasurHh9') 
0xba5a8672cb50b609539a74ff76182ed26726601de0f994c610442ad0b24b13d1
undefined

energi_claimGen2CoinsCombined

The claimGen2CoinsCombined method allows you to claim all coins from Gen 2 file dump to a specific Gen 3 address .

ClientMethod invocation
Consoleenergi.claimGen2CoinsCombined(password,'addressGen3', file)

Example

//After generating the dumpWallet file, which was named: "CoinsCombined_migration"
> energi.claimGen2CoinsCombined('energi123', '0x680cf4b9c12736dbab9eec2a481e6101aacf300a','CoinsCombined_migration_this_is_your_wallet.txt')
["0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x5ab963acaf4186ae4e6358c742fa8c6fc3b5f04b8f8be692138294950323c21b", "0xe925853af10506af360b1688a13e48b3f66840d1a835f3a511b8a5b2c433ce91"]
//Verify that the balance has been migrated into the target account

energi_claimGen2CoinsImport

The claimGen2CoinsImport method allows you to Claim all coins from Gen 2 file dump to the same private keys imported into the current instance. File is the "dumpwallet" file, obtained via the console command in the Gen 2 wallet. For each private key that has coins in the associated Gen 2 address, the local node will create a keystore file and reclaim coins in the Gen address. 3 through scheme 1: 1. The "password" will be used to encrypt the keystore files.

ClientMethod invocation
Consoleenergi.claimGen2CoinsImport(password, file)

Example

//After generating the dumpWallet file, which was named: "CoinsImport_migration"
> energi.claimGen2CoinsImport('energi-migration3.0','CoinsImport_migration_this_is_your_wallet.txt')
["0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x02406bc6f9867323aa518939776ac826cadc331bed39a4b2056b2c61cd23fbf0", "0x4e250a47b6d327c04d2585e3124632baf75afbf47f6b22ede02155fbaa12928d"]

//Four different accounts have been created for this example, into which the 1:1 balance sheet has been migrated.
//You can check that the accounts have been created and added to the node with:
> personal.listWallets
[{
accounts: [{
address: "0x7dd389c8df425c5afe31c307d51a86754d16b5d6",
url: "keystore:///home/user/.energicore/testnet/keystore/UTC--2020-04-03T22-45-31.107489475Z--7dd389c8df425c5afe31c307d51a86754d16b5d6"
}],
status: "Locked",
url: "keystore:///home/user/.energicore/testnet/keystore/UTC--2020-04-03T22-45-31.107489475Z--7dd389c8df425c5afe31c307d51a86754d16b5d6"
}, {
accounts: [{
address: "0xd2f737d4be4f5716893449698cc450101f0b1580",
url: "keystore:///home/user/.energicore/testnet/keystore/UTC--2020-04-03T22-46-13.820942642Z--d2f737d4be4f5716893449698cc450101f0b1580"
}],
status: "Locked",
url: "keystore:///home/user/.energicore/testnet/keystore/UTC--2020-04-03T22-46-13.820942642Z--d2f737d4be4f5716893449698cc450101f0b1580"
}, {
accounts: [{
address: "0x5dc9b39668d904c6363a42c61297ca1c0950f849",
url: "keystore:///home/user/.energicore/testnet/keystore/UTC--2020-04-04T00-26-45.547424141Z--5dc9b39668d904c6363a42c61297ca1c0950f849"
}],
status: "Locked",
url: "keystore:///home/user/.energicore/testnet/keystore/UTC--2020-04-04T00-26-45.547424141Z--5dc9b39668d904c6363a42c61297ca1c0950f849"
}, {
accounts: [{
address: "0x47e8bb353647d5136f48b8f5d2b011f616ed01ef",
url: "keystore:///home/user/.energicore/testnet/keystore/UTC--2020-04-07T19-22-55.299355056Z--47e8bb353647d5136f48b8f5d2b011f616ed01ef"
}],
status: "Locked",
url: "keystore:///home/user/.energicore/testnet/keystore/UTC--2020-04-07T19-22-55.299355056Z--47e8bb353647d5136f48b8f5d2b011f616ed01ef"
}, {
accounts: [{
address: "0x4ccce31a5f603b0f858f6e77fb3ac26686020d15",
url: "keystore:///home/user/.energicore/testnet/keystore/UTC--2020-04-07T19-23-06.968463540Z--4ccce31a5f603b0f858f6e77fb3ac26686020d15"
}],
status: "Locked",
url: "keystore:///home/user/.energicore/testnet/keystore/UTC--2020-04-07T19-23-06.968463540Z--4ccce31a5f603b0f858f6e77fb3ac26686020d15"
}]
info

Budget proposal commands:

energi_budgetInfo

The budgetInfo method lists all budget proposals and their current state.

ClientMethod invocation
Consoleenergi.budgetInfo()

Example

//If there are no active proposals:
> energi.budgetInfo()
{
balance: 1.1606178258e+25,
proposals: []
}

//When there are active proposals:
> energi.budgetInfo()
{
balance: 1.1606178258e+25,
proposals: [{
acceptWeight: 0,
accepted: false,
balance: 0,
createdBlock: 91158,
deadline: 1588014268,
finished: false,
paidAmount: 0,
proposal: "0x6024af57b02f9979d48f0f0756b87b56e793fa6d",
proposedAmount: 1e+22,
proposer: "0x680cf4b9c12736dbab9eec2a481e6101aacf300a",
quorumWeight: 2.191e+22,
refUUID: "ddd9cf70-df3f-43c0-b1d7-46168b0493ab",
rejectWeight: 0,
totalWeight: 3.13e+23
}]
}

energi_budgetPropose

The budgetPropose method generates a proposal to the treasury to be voted on by the governance system. It has the following input parameters:

  • amount: must be >= fee and <=184K (nrg). The function accepts this parameter in Wei. Use the web3.toWei('amount', 'energi') function.
  • uuid: it is used as an identifier, so it must be unique for each submitted proposal. Can be generated here https://www.uuidgenerator.net/
  • period: The minimum deadline is 14 days and the maximum is 30 days. Must be provided in seconds, written without quotes.
  • fee: Must be min 100 (nrg). The function accepts this parameter in Wei. Use the web3.toWei('amount', 'ether') function.
  • payer: must be a gen3 address in the local node keystore.

Note: In order to generate a treasury proposal, there must be a total active collateral, of at least 50% of the total that has historically existed. Otherwise, the transaction is rejected and the proposal is not generated.

ClientMethod invocation
Consoleenergi.budgetPropose(amount, uuid, period, fee, payer [,password])

Example

> energi.budgetPropose(web3.toWei('10000', 'ether'), 'ddd9cf70-df3f-43c0-b1d7-46168b0493ab', 1296000, web3.toWei('100', 'ether'), "0x680cf4b9c12736dbab9eec2a481e6101aacf300a", 'password')
0xbf858a31074930c0367a85d83b1051977d22ed3dcadea10a40fcc2b9729d4aaf
undefined
info

Voting API:

It allows you to interact with the voting functionality of the network's governance system. This is used by the APIs: Budget, Blacklist, Compensation Found, Checkpoint and Upgrade.

energi_voteAccept

The voteAccept method allows you to vote in favor of a proposal. It is necessary to provide the proposal number as an input parameter. It can be obtained from the list of proposals by executing any of the methods: _budgetInfo, _blacklistInfo, _compensationInfo, _checkpointInfo or _upgradeInfo.

Note: In order for an MN to vote in favor of a proposal, it must have been announced before the block in which the proposal was made. Only one vote per MN is allowed. See example in _voteReject.

ClientMethod invocation
Consoleenergi.voteAccept(proposal, mn_owner[, password])

Example

> energi.voteAccept('0x6024af57b02f9979d48f0f0756b87b56e793fa6d', '0x8978e517c2b442264e54b890c4428816b66aaf8b', 'TestetNet3.0A')
0x51627be46bc003030bf4c43e7ebb686d35cfaf633edbb6544a0beda16fb967e1
undefined

energi_voteReject

The voteReject method allows you to vote against a proposal. It is necessary to provide the proposal number as an input parameter. It can be obtained from the list of proposals by executing any of the methods: _budgetInfo, _blacklistInfo, _compensationInfo, _checkpointInfo or _upgradeInfo. Returns the transaction hash related to voting.

Note: In order for an MN to vote against a proposal, it must have been announced before the block in which the proposal was made. Only one vote per MN is allowed.

ClientMethod invocation
Consoleenergi.voteReject(proposal, mn_owner[, password])

Example

> energi.voteReject('0x6024af57b02f9979d48f0f0756b87b56e793fa6d', '0x8978e517c2b442264e54b890c4428816b66aaf8b', 'TestetNet3.0A')
0x52c3f415baacdddd147c9c5c7d609e59f056c2cb6f098565a8591dcd55ebbc4e
undefined

//If you try to vote again:
> energi.voteReject('0x6024af57b02f9979d48f0f0756b87b56e793fa6d', '0x8978e517c2b442264e54b890c4428816b66aaf8b', 'TestetNet3.0A')
Error: This account is not allowed to vote!
at web3.js:3164:20
at web3.js:6368:15
at web3.js:5102:36
at <anonymous>:1:1

//If you try to vote with an MN that was announced later:
> energi.voteReject('0x6024af57b02f9979d48f0f0756b87b56e793fa6d', '0x680cf4b9c12736dbab9eec2a481e6101aacf300a', 'energi123')
Error: This account is not allowed to vote!
at web3.js:3164:20
at web3.js:6368:15
at web3.js:5102:36
at <anonymous>:1:1

energi_withdrawFee

The withdrawFee method allows the approved amount to be withdrawn from the treasury, if the voting has been successfully completed. Only the account that made the proposal can withdraw the funds.

ClientMethod invocation
Consoleenergi.withdrawFee(proposal, mn_owner[, password])

Example

> energi.withdrawFee('0x67bb21cc52b18ebfb81b7b8feb91efda2df56fde', '0xa229362a827aa052babc8989d5fc2dc669e18f81', 'TestNet3.0B')
//Verify that the balance has been credited to the account
info

Blacklist Control:

The purpose of blacklisting is to fight with crime-stolen funds.

energi_blacklistInfo

The blacklistInfo method can be consulted to obtain all the information about the status of the proposals to the blacklist registry. Return a list with each of the proposals.

ClientMethod invocation
Consoleenergi.blacklistInfo()

Example:

> energi.blacklistInfo()
[{
blocked: true,
drain: null,
enforce: {
acceptWeight: 1.41e+23,
accepted: true,
balance: 0,
createdBlock: 2269,
deadline: 1581948257,
finished: true,
proposal: "0xd294223dcbf560c020de2d4e3a8e920d9315c4fb",
proposer: "0x25bbaaaf27ab1966c3ab9faf31277a1db7601f3f",
quorumWeight: 2.81e+22,
rejectWeight: 0,
totalWeight: 2.81e+23
},
revoke: null,
target: "0x0f38fc17c5543668b2eeb9d6533464ac6bdecd63"
}, {
blocked: true,
drain: null,
enforce: {
acceptWeight: 3e+22,
accepted: true,
balance: 0,
createdBlock: 2269,
deadline: 1581948257,
finished: true,
proposal: "0xf9149ddf17dd00a084ee9cec74b4d2957882395b",
proposer: "0x25bbaaaf27ab1966c3ab9faf31277a1db7601f3f",
quorumWeight: 2.81e+22,
rejectWeight: 0,
totalWeight: 2.81e+23
},
revoke: null,
target: "0xfbe1c99ff0adc7b16289ea0271efbd8ee9b6c726"
}, {
blocked: true,
drain: null,
enforce: {
acceptWeight: 5e+22,
accepted: true,
balance: 0,
createdBlock: 2269,
deadline: 1581948257,
finished: true,
proposal: "0x96ed7d415fe85661bc7b10d4f683f3f1c63ddfa7",
proposer: "0x25bbaaaf27ab1966c3ab9faf31277a1db7601f3f",
quorumWeight: 2.81e+22,
rejectWeight: 3e+22,
totalWeight: 2.81e+23
},
revoke: null,
target: "0x9979a36db71eaac8ef927f14bf01a18aba6c0276"
}, {
blocked: false,
drain: null,
enforce: {
acceptWeight: 1e+22,
accepted: false,
balance: 0,
createdBlock: 2269,
deadline: 1581948257,
finished: true,
proposal: "0x05a9913fd8ffd22512893f43160063a469412872",
proposer: "0x25bbaaaf27ab1966c3ab9faf31277a1db7601f3f",
quorumWeight: 2.81e+22,
rejectWeight: 1.41e+23,
totalWeight: 2.81e+23
},
revoke: null,
target: "0x52cabaf393a01950f20687920a344148ffdaf403"
}, {
blocked: false,
drain: {
acceptWeight: 1e+22,
accepted: false,
balance: 0,
createdBlock: 2397,
deadline: 1581956001,
finished: true,
proposal: "0xcfdb11664a36c2d00feeba76407130919b8e39f5",
proposer: "0x25bbaaaf27ab1966c3ab9faf31277a1db7601f3f",
quorumWeight: 2.82e+22,
rejectWeight: 1.5e+23,
totalWeight: 2.82e+23
},
enforce: {
acceptWeight: 1.51e+23,
accepted: true,
balance: 0,
createdBlock: 2269,
deadline: 1581948257,
finished: true,
proposal: "0x3b31a9c790ccc8d6345744f2dec7d2a19c56455f",
proposer: "0x25bbaaaf27ab1966c3ab9faf31277a1db7601f3f",
quorumWeight: 2.81e+22,
rejectWeight: 0,
totalWeight: 2.81e+23
},
revoke: {
acceptWeight: 1.5e+23,
accepted: true,
balance: 0,
createdBlock: 2424,
deadline: 1581957853,
finished: true,
proposal: "0xe9a82a713f297a5b64299f6f35c2fd35785b311b",
proposer: "0x01d4a3fdec411abcfc1dece7013890c6ec2629f9",
quorumWeight: 2.82e+22,
rejectWeight: 0,
totalWeight: 2.82e+23
},
target: "0x4aa953defc1ec2178d80248147301961f9866e3c"
}, {
blocked: false,
drain: null,
enforce: {
acceptWeight: 0,
accepted: false,
balance: 1e+21,
createdBlock: 3377,
deadline: 1582014892,
finished: true,
proposal: "0xdbe98c7150110c726a05a4911490e2b82ac61a56",
proposer: "0x01d4a3fdec411abcfc1dece7013890c6ec2629f9",
quorumWeight: 2.32e+22,
rejectWeight: 0,
totalWeight: 2.32e+23
},
revoke: null,
target: "0x2eb64c19b4fd630817f1ebec5b5dd28d7b842f1e"
}, {
blocked: false,
drain: null,
enforce: {
acceptWeight: 0,
accepted: false,
balance: 1e+21,
createdBlock: 7979,
deadline: 1582291650,
finished: true,
proposal: "0x1a58ecd04a69d633ee274adc8f5b9f14e5c93234",
proposer: "0x01d4a3fdec411abcfc1dece7013890c6ec2629f9",
quorumWeight: 2.72e+22,
rejectWeight: 0,
totalWeight: 2.72e+23
},
revoke: null,
target: "0x0000000000000000000000000000000000000319"
}, {
blocked: false,
drain: null,
enforce: {
acceptWeight: 1.5e+23,
accepted: true,
balance: 0,
createdBlock: 7771,
deadline: 1582279130,
finished: true,
proposal: "0x2f77f50dba9e3a66b01729020bab8f074db20a81",
proposer: "0x25bbaaaf27ab1966c3ab9faf31277a1db7601f3f",
quorumWeight: 2.72e+22,
rejectWeight: 0,
totalWeight: 2.72e+23
},
revoke: {
acceptWeight: 1.5e+23,
accepted: true,
balance: 0,
createdBlock: 7822,
deadline: 1582282148,
finished: true,
proposal: "0x518915d1eb0974f084136066d951cea2a778efd9",
proposer: "0x01d4a3fdec411abcfc1dece7013890c6ec2629f9",
quorumWeight: 2.72e+22,
rejectWeight: 0,
totalWeight: 2.72e+23
},
target: "0x5f1b264dd4ca7cff8f77e9e2596f6151cc42bcc2"
}]

energi_blacklistEnforce

The blacklistEnforce method allows you to create a proposal to include a target account in the blacklist. This will be voted on by the governance system. A 1000 NRG refundable fee is required. To claim the refundable fee see the _blacklistCollect method.

ClientMethod invocation
Consoleenergi.blacklistEnforce(target, fee, payer[, password])

Example:

> energi.blacklistEnforce('0x47e8bb353647d5136f48b8f5d2b011f616ed01ef', web3.toWei('1000', 'nrg'),'0x680cf4b9c12736dbab9eec2a481e6101aacf300a', 'energi123')
0x31058bb07509bdf4a7f62314b153b25a26abcc233f8a872246d5ddef82ade3fe
undefined

//To verify that the proposal has been successfully generated:
> energi.blacklistInfo()

[.... , {
blocked: false,
drain: null,
enforce: {
acceptWeight: 0,
accepted: false,
balance: 0,
createdBlock: 92668,
deadline: 1587413837,
finished: false,
proposal: "0x7add616a2bdb84c216bc0c4f5c4b14bbe3b53bcb",
proposer: "0x680cf4b9c12736dbab9eec2a481e6101aacf300a",
quorumWeight: 3.13e+22,
rejectWeight: 0,
totalWeight: 3.13e+23
},
revoke: null,
target: "0x47e8bb353647d5136f48b8f5d2b011f616ed01ef"
},
....

}]

energi_blacklistRevoke

The blacklistRevoke method allows you to create a proposal to remove an target account from the list of blocked accounts. This will be voted on by the governance system. If the proposal is approved, the account will be unlocked. A refundable fee of 100 NRG is required. To claim the refundable fee see the _blacklistCollect method.

ClientMethod invocation
Consoleenergi.blacklistRevoke(target, fee, payer[, password])

Example:

> energi.blacklistRevoke('0x47e8bb353647d5136f48b8f5d2b011f616ed01ef',web3.toWei('100', 'nrg'), '0xa229362a827aa052babc8989d5fc2dc669e18f81', 'TestNet3.0B')
0x620a5c35cc9d4e351a769a6a17409ecca60929e58e35371e87a521a9d6fa9ff1
undefined

//To verify that the proposal has been successfully included:
> energi.blacklistInfo()

[{
...
{
blocked: true,
drain: null,
enforce: {
acceptWeight: 2e+23,
accepted: true,
balance: 1e+21,
createdBlock: 92578,
deadline: 1587408383,
finished: true,
proposal: "0xfba86fef2dd52df4743e30d85d560aa48f53e5ce",
proposer: "0xa229362a827aa052babc8989d5fc2dc669e18f81",
quorumWeight: 3.25e+22,
rejectWeight: 0,
totalWeight: 3.25e+23
},
revoke: {
acceptWeight: 0,
accepted: false,
balance: 0,
createdBlock: 92782,
deadline: 1587420680,
finished: false,
proposal: "0x913b68bb4ef8ec8c558411aaf85a751fbcdd87fd",
proposer: "0xa229362a827aa052babc8989d5fc2dc669e18f81",
quorumWeight: 3.13e+22,
rejectWeight: 0,
totalWeight: 3.13e+23
},
target: "0xd2f737d4be4f5716893449698cc450101f0b1580"
},
...
}]

energi_blacklistDrain

The blacklistDrain method allows you to create a proposal for the funds related to a target account that is blocked, due to being blacklisted, to be transferred to the compensation fund. This will be voted on by the governance system. A refundable fee of 100 NRG is required. To claim the refundable fee see the _blacklistCollect method.

ClientMethod invocation
Consoleenergi.blacklistDrain(target, fee, payer[, password])

Example:

> energi.blacklistDrain('0x9979a36db71eaac8ef927f14bf01a18aba6c0276', web3.toWei('100', 'nrg'),  '0x680cf4b9c12736dbab9eec2a481e6101aacf300a', 'energi123')
0x2e9891cf72fdc71406a6493549092aa1bf6a6733e4e6cea4e8057051ca71d30e
undefined

> energi.blacklistInfo()
[{
....
{
blocked: true,
drain: {
acceptWeight: 0,
accepted: false,
balance: 0,
createdBlock: 92823,
deadline: 1587423099,
finished: false,
proposal: "0x33d2e1e0716afbf3e5f4cd65e4b8252ca8a0239e",
proposer: "0x680cf4b9c12736dbab9eec2a481e6101aacf300a",
quorumWeight: 3.13e+22,
rejectWeight: 0,
totalWeight: 3.13e+23
},
enforce: {
acceptWeight: 5e+22,
accepted: true,
balance: 0,
createdBlock: 2269,
deadline: 1581948257,
finished: true,
proposal: "0x96ed7d415fe85661bc7b10d4f683f3f1c63ddfa7",
proposer: "0x25bbaaaf27ab1966c3ab9faf31277a1db7601f3f",
quorumWeight: 2.81e+22,
rejectWeight: 3e+22,
totalWeight: 2.81e+23
},
revoke: null,
target: "0x9979a36db71eaac8ef927f14bf01a18aba6c0276"
}
...
}]

energi_blacklistCollect

The blacklistCollect method allows you to claim the refundable fee used to generate a proposal by any of the methods:_blacklistEnforce ,_blacklistRevoke and _blacklistDrain.

ClientMethod invocation
Consoleenergi.blacklistCollect(proposal, payer[,password])

Example:

> energi.blacklistCollect('0xa6f6bc8b5d50d15bd1838609f23eb5a353948c0f','0x680cf4b9c12736dbab9eec2a481e6101aacf300a', 'energi123')
0x3b314120dcc1a26527ab8dbba27755b0c249029673d2908591a6275835d69a3d
undefined
//Verify in the browser that the fee has been refunded
info

Compensation Fund API:

It is a fund that works similarly to the treasury, but that manages the funds recovered from accounts associated with crime. The administration of the same, follows the logic of the treasury for the payment vote.

energi_compensationInfo

The compensationInfo method lists all compensation proposals and their current state.

ClientMethod invocation
Consoleenergi.compensationInfo()

Example:

//If there are no active proposals:
> energi.compensationInfo()
{
balance: 3.5612486184063e+23,
proposals: []
}

//When there are active proposals:
> energi.compensationInfo()
{
balance: 3.5612486184063e+23,
proposals: [{
acceptWeight: 0,
accepted: false,
balance: 100000000000000000000,
createdBlock: 92857,
deadline: 1588116447,
finished: false,
paidAmount: 0,
proposal: "0x6f4dfac4c1d82502ab216841647cc447d77d259f",
proposedAmount: 3e+22,
proposer: "0x8978e517c2b442264e54b890c4428816b66aaf8b",
quorumWeight: 2.191e+22,
refUUID: "ddd9cf70-df3f-43c0-b1d7-46168b0493ab",
rejectWeight: 0,
totalWeight: 3.13e+23
}, {
acceptWeight: 0,
accepted: false,
balance: 0,
createdBlock: 92860,
deadline: 1588116552,
finished: false,
paidAmount: 0,
proposal: "0xcc35937d9b2b3a998c4a6b87483d1e2b3a818717",
proposedAmount: 3e+22,
proposer: "0xa229362a827aa052babc8989d5fc2dc669e18f81",
quorumWeight: 2.191e+22,
refUUID: "e04d90cd-e4e0-4557-937e-00ff6d106a87",
rejectWeight: 0,
totalWeight: 3.13e+23
}]
}

energi_compensationPropose

The compensationPropose method generates a proposal to the compensation fund to be voted on by the governance system. It has the same parameters as the _budgetPropose method.

ClientMethod invocation
Consoleenergi.compensationPropose(amount, uuid, period, fee, payer [,password])

Example:

> energi.compensationPropose(web3.toWei('30000', 'ether'), 'e04d90cd-e4e0-4557-937e-00ff6d106a87', 1296000, web3.toWei('100', 'ether'), "0xa229362a827aa052babc8989d5fc2dc669e18f81", 'TestNet3.0B')
0xa5ef068b6a0b30ec518d7b2bebae15c0cb3ec3993c12dfef44609fb31fbcc6a6
undefined

//To verify that the proposal has been successfully generated:
> energi.compensationInfo()
{
balance: 3.5612486184063e+23,
proposals: [...
{
acceptWeight: 0,
accepted: false,
balance: 0,
createdBlock: 92860,
deadline: 1588116552,
finished: false,
paidAmount: 0,
proposal: "0xcc35937d9b2b3a998c4a6b87483d1e2b3a818717",
proposedAmount: 3e+22,
proposer: "0xa229362a827aa052babc8989d5fc2dc669e18f81",
quorumWeight: 2.191e+22,
refUUID: "e04d90cd-e4e0-4557-937e-00ff6d106a87",
rejectWeight: 0,
totalWeight: 3.13e+23
}
...]
}

energi_compensationProcess

The compensationProcess method

ClientMethod invocation
Consoleenergi.compensationProcess

Example:

info

Checkpoint API

It allows you to interact with the dynamic blockchain control points present on the network.

energi_checkpointInfo

The checkpointInfo method lists the checkpoints proposed to the network, to be voted by the governance system. Returns an object with the following parameters:

  • .registry - map of checkpoints in registry
  • .active - all locally enabled checkpoints
ClientMethod invocation
Consoleenergi.checkpointInfo()

Example:

> energi.checkpointInfo()
{
active: [],
registry: []
}

energi_checkpointPropose

The checkpointPropose method allows you to create a proposal for a control point to be added to the network. The proposal must be voted on through the governance system. For security reasons, proposals can only be made by specific accounts related to the Energi Core team.

ClientMethod invocation
Consoleenergi.checkpointPropose(number, hash[, password])

Example:

> energi.checkpointPropose(93000, '0x6429771a092748b3ab63a9de82427a72a3215ba324366f02eeeb9d658f6bcf53')
Error: unknown account
at web3.js:3164:20
at web3.js:6368:15
at web3.js:5102:36
at <anonymous>:1:1
info

Consensus upgrade API

This API is related to the control of updates to the different consensus contracts that operate in the Energi network.

energi_upgradeInfo

The upgradeInfo method returns the map of the list of government improvement proposals for each proxy.

ClientMethod invocation
Consoleenergi.upgradeInfo()

Example:

> energi.upgradeInfo()
{
BackboneReward: [],
BlacklistRegistry: [],
CheckpointRegistry: [],
MasternodeRegistry: [{
acceptWeight: 0,
accepted: true,
balance: 0,
createdBlock: 122691,
deadline: 1588613704,
finished: true,
impl: "0xef0e363008af759cd1e1ea955277a954ebfc76bd",
proposal: "0x6720431f85ab4d608a197503dfb0e860b8c0b00d",
proposer: "0xb1372ea07f6a92bc86fd5f8cdf468528f79f87ca",
proxy: "0x0000000000000000000000000000000000000302",
quorumWeight: 2.2083e+23,
rejectWeight: 0,
totalWeight: 4.33e+23
}, {
acceptWeight: 0,
accepted: true,
balance: 0,
createdBlock: 122723,
deadline: 1588615659,
finished: true,
impl: "0xef0e363008af759cd1e1ea955277a954ebfc76bd",
proposal: "0xcfab0700e272d9e4aed6b3d4da7ff15a6a38ab0c",
proposer: "0xb1372ea07f6a92bc86fd5f8cdf468528f79f87ca",
proxy: "0x0000000000000000000000000000000000000302",
quorumWeight: 2.2083e+23,
rejectWeight: 0,
totalWeight: 4.33e+23
}],
MasternodeToken: [],
SporkRegistry: [],
StakerReward: [],
Treasury: []
}

energi_upgradePropose

The upgradePropose method allows you to create an upgrade proposal for any of the consensus contracts that operate on the Energi network. This will be voted on by the governance system. A 10,000 NRG (ten thousand NRG) refundable fee is required. To claim the refundable fee see the _upgradeCollect method.

ClientMethod invocation
Consoleenergi.upgradePropose(new_impl, fee, payer[, password])

Example:

energi_upgradePerform

The upgradePerform method

ClientMethod invocation
Consoleenergi.upgradePerform(proposal, payer[, password])

Example:

energi_upgradeCollect

The upgradeCollect method allows you to withdraw the refundable fee of an upgrade proposal for some of the consensus contracts that operate on the Energi network.

ClientMethod invocation
Consoleenergi.upgradeCollect(proposal, payer[, password])

Example:

Masternode

info

Token commands:

masternode_collateralBalance

The collateralBalance method allows obtaining the balance of the total collateral associated with a masternode.

ClientMethod invocation
Consolemasternode.collateralBalance(addr)

Example:

masternode.collateralBalance('0x680cf4b9c12736dbab9eec2a481e6101aacf300a')
{
balance: 8.2e+22,
lastBlock: 75626
}

masternode_depositCollateral

The depositCollateral method allows sending the collateral to announce the masternode. You will be given a token as collateral. Returns the transaction hash.

ClientMethod invocation
Consolemasternode.depositCollateral(addr,amount[, password])

Example:

> masternode.depositCollateral('0x680cf4b9c12736dbab9eec2a481e6101aacf300a', web3.toWei('1000', 'energi'), 'password_account')
0xf8839dcb5ab5f7c26d10de6ef43c24e14e6656620ca03f5700395aed0764de6a
undefined

masternode_withdrawCollateral

The withdrawCollateral method allows you to withdraw some or all of the collateral available on the masternode. If only a portion of the available collateral is removed, it is not necessary to announce the masternode again. Returns the transaction hash.

ClientMethod invocation
Consolemasternode.withdrawCollateral(addr_own,amount[, password])

Example:

> masternode.withdrawCollateral('0x680cf4b9c12736dbab9eec2a481e6101aacf300a', web3.toWei('3000', 'energi'), 'password_account')
0x4f38c1e06bf17824eea2c60cb1887f66519c1e77e656f4ec5dc352ecadd90b61
undefined
info

Masternode Registry commands:

masternode_listMasternodes

The listMasternodes displays information about the list of masternodes running on the Energi network. The following information is displayed for each of the masternodes announced on the network:

  • announcedBlock: Block in which the Masternode was announced.
  • collateral: The total balance of the collateral deposited in the Masternode, in Wei.
  • enode: Reconstructed from public key and IPv4.
  • isActive
  • isAlive
  • Masternode
  • owner: Masternode owner address
  • swFeatures
  • swVersion: Extracted from swFeatures
ClientMethod invocation
Consolemasternode.listMasternodes()

Example:

> masternode.listMasternodes()
[{
announcedBlock: 68300,
collateral: 1e+23,
enode: "enode://3abb689050324339e9e78c3c4bcac92f831d6f410e590dc07c2c6da01008dea3546a06fed8bc7682513b941f9d2d1d04121eb5ffe9ef21cbe879cd0ac3759c7d@45.32.129.164:49797",
isActive: true,
isAlive: true,
masternode: "0x3059f46a81adc3a682587c28aa6f41b7c7d9645a",
owner: "0x82cfc8ea7043b5459d0a4c9dbcc4c42106c8c0a5",
swFeatures: "0x3000300",
swVersion: "3.0.3"
}, {
announcedBlock: 73536,
collateral: 2e+21,
enode: "enode://9657a56e9a47d43d9a31cd0f83f7f95ea464ba4675ab688192e00a57b2deb43c9e6768b2ad7f2c6042ec90d2db13740b20699306b3ebe5be3c58713b50b209a9@165.22.209.199:49797",
isActive: true,
isAlive: true,
masternode: "0x9f4530c266aa9a337f8b9e41400cc88cab361ec3",
owner: "0xbb5915c5cd4d453693f084db3cef17ee1bd9ec9e",
swFeatures: "0x3000000",
swVersion: "3.0.0"
}, {
announcedBlock: 68483,
collateral: 1e+22,
enode: "enode://dfd101e56b9124e5f5674470929a9ae9d75de493f43d7057d5dba543e235d7638b0d5e6e883dc12aef9d46ead51e58ee46c5bd67e458d5856ce009e88920dce5@100.0.197.59:49797",
isActive: true,
isAlive: true,
masternode: "0xfbf2853d00253fda5c4cfc98d078e4a5052b4b99",
owner: "0x67319f845917da973570704b811b641d3f335fa9",
swFeatures: "0x3000300",
swVersion: "3.0.3"
}, {
announcedBlock: 76821,
collateral: 5e+21,
enode: "enode://04cd1bbe3c90b867bbaa0415769fd0fda3357fef77073532d3389c4b445634ad55eea3c2253ed17e4f4ed73869098139902c8b567c34f2b0fed56ca66785db73@144.202.18.140:49797",
isActive: true,
isAlive: true,
masternode: "0x4b9885d71b6e3e52651bef1ec3daa7605b7d3dce",
owner: "0x8978e517c2b442264e54b890c4428816b66aaf8b",
swFeatures: "0x3000200",
swVersion: "3.0.2"
}, {
announcedBlock: 76961,
collateral: 8e+22,
enode: "enode://3ee4fe82aaaaed62d927c09a63acf2553c860709849a85ae1bbd9165de15889288c9330d9e62077c1c50bd57eee2c0d1e6c1801a6a58e7ecc94ef66dcd0a3086@186.167.244.251:49797",
isActive: true,
isAlive: true,
masternode: "0x51c667ede285d367389ab17e03e77fbe26bb18c9",
owner: "0x680cf4b9c12736dbab9eec2a481e6101aacf300a",
swFeatures: "0x3000300",
swVersion: "3.0.3"
}]

masternode_masternodeInfo

The masternodeInfo method can be consulted to obtain all the known information about the status of the masternodes associated with the account.

ClientMethod invocation
Consolemasternode.masternodeInfo(owner_or_mn)

Example:

> masternode.masternodeInfo ("0x680cf4b9c12736dbab9eec2a481e6101aacf300a")
{
announcedBlock: 76961,
collateral: 8e+22,
enode: "enode://3ee4fe82aaaaed62d927c09a63acf2553c860709849a85ae1bbd9165de15889288c9330d9e62077c1c50bd57eee2c0d1e6c1801a6a58e7ecc94ef66dcd0a3086@186.167.244.251:49797",
isActive: true,
isAlive: true,
masternode: "0x51c667ede285d367389ab17e03e77fbe26bb18c9",
owner: "0x680cf4b9c12736dbab9eec2a481e6101aacf300a",
swFeatures: "0x3000300",
swVersion: "3.0.3"
}

masternode_announce

The announce method allows announcing a masternode to the Energi network, which has an available collateral. Returns the transaction hash.

ClientMethod invocation
Consolemasternode.announce(owner, enode[, password])

Example:

> masternode.announce('0x680cf4b9c12736dbab9eec2a481e6101aacf300a', "enode://3ee4fe82aaaaed62d927c09a63acf2553c860709849a85ae1bbd9165de15889288c9330d9e62077c1c50bd57eee2c0d1e6c1801a6a58e7ecc94ef66dcd0a3086@186.167.244.251:49797", 'energi123')
'0x6b97d0fcd4fa78bd3f2f39e3e99616763cd1aebdbbe63a476c58288af7f6c46f'

masternode_denounce

The denounce method allows the masternode to be removed from the Energi network. The collateral associated with the masternode is not affected. Returns the hash of the transaction.

ClientMethod invocation
Consolemasternode.denounce(owner[, password])

Example:

> masternode.denounce('0x680cf4b9c12736dbab9eec2a481e6101aacf300a', 'energi123')
"0x2c395e5239032ead8860b23a0811a8b78e225f4a980d6f06a185f8291959607d"

masternode_stats

The stats method displays information about all of the Masternodes in the Energi network.

ClientMethod invocation
Consolemasternode.stats()

Example:

> masternode.stats()
{
active: 5,
activeCollateral: 1.97e+23,
maxOfAllTimes: 5.62e+23,
total: 5,
totalCollateral: 1.97e+23
}

Miner

The miner API allows you to remote control the node's mining operation and set various mining specific settings.

miner_setMinerNonceCap

The setMinerNonceCap method defines the maximum weight that the PoS miner can use per block (nonceCap). By default it has a value of 0. The argument is optional. If the function is executed without an argument, it will only return the previously defined value.

ClientMethod invocation
Consoleminer.setMinerNonceCap([nonceCap])

Example

> miner.setNonceCap(1000)
0 // Default defined value

> miner.setNonceCap()
1000

miner_stakingStatus

The stakingStatus method can be queried for all the information known about the status of the staking on the node console. Returns an object with the following parameters:

  • hash - block hash
  • heigth - block heigth
  • miner - if miner is enabled
  • nonceCap - configuration
  • staking - staking status overall
  • totalWeigth - total staking weigth
  • accounts - staking weight per accounts
  • account - address
  • weight - account weigth
ClientMethod invocation
Consoleminer.stakingStatus()

Example

> miner.stakingStatus()
{
accounts: [],
hash: "0x64cc7035c7cfdecba22e5d035c4e2026568ed7833b2c73a577b1b4f623541ed0",
height: 35542,
miner: true,
nonceCap: 0,
staking: false,
totalWeight: 0
}

miner_autocompounding

Some masternode owners desire to stake with their owner's account and automatically deposit available funds. It makes sense to perform such auto-deposit operation only after MN rewards are paid in the current cycle to prevent reset of MN queue position. The autocompounding method defines how the auto-deposit operation will work on the MN contract.

Modes to be controlled by switch:

Switch:

0 - disable.

1 - do only after blocks, ignore stake rewards (default).

2 - rapidly try to collateralize, if there is any amounts.

By default it has a value of 1. The argument is optional. If the function is executed without an argument, it will only return the previously defined value.

ClientMethod invocation
Consoleminer.setAutocollateralize([switch])

Example

> miner.setautocompounding(0)
1
undefined

> miner.setautocompounding(1)
0

miner_start

The start method starts PoS mining on the node. The method receives no arguments.

ClientMethod invocation
Consoleminer.start()

Example

//To verify that the node is not mining
> miner.stakingStatus().miner
false

> miner.start()
null

//To verify that the node is mining
> miner.stakingStatus().miner
true

miner_stop

The stop method stops PoS mining on the node.

ClientMethod invocation
Consoleminer.stop()

Example

//To verify that the node is mining
> miner.stakingStatus().miner
true

> miner.stop()
null

//To verify that the node is not mining
> miner.stakingStatus().miner
false

miner_setRecommitInterval

The setRecommitInterval method allows you to set a time interval to recreate the recovered block. The default value is 3s.

ClientMethod invocation
Consoleminer.setRecommitInterval(time)

Example

> miner.setRecommitInterval(10)
null

miner_setGasPrice

The setGasPrice method can set the minimum gas price for mining a transaction. Price in Wei. Any transactions that are below this limit are excluded from the mining process.

ClientMethod invocation
Consoleminer.setGasPrice(gasPrice)

Example

> miner.setGasPrice(10000000000)
true

miner_setExtra

The setExtra method sets the extra data for the block when finding a block by the miner. Limited to 32 bytes. (default = client version)

ClientMethod invocation
Consoleminer.setExtra(‘data’)

Example

> miner.setExtra("extra data")
true

miner_setEtherbase

The setEtherbase method sets the ether base, the address that will receive mining rewards.

ClientMethod invocation
Consoleminer.setEtherbase(‘address’)

Example

//To consult the "coinbase" address defined in the node
//You can also use ngt.coinbase
> eth.coinbase
"0x0000000000000000000000457068656d6572616c"

> miner.setEtherbase('0x680cf4b9c12736dbab9eec2a481e6101aacf300a')
true

//To verify the change
> eth.coinbase
"0x680cf4b9c12736dbab9eec2a481e6101aacf300a"

miner_addDPoS

The addDPoS method allows to add contract to staker mapping

ClientMethod invocation
Consoleminer.addDPoS(contract_address_DPoS, staker)

Example

miner_removeDPoS

The removeDPoS method allows to remove contract to staker mapping

ClientMethod invocation
Consoleminer.removeDPoS(contract_adress_DPoS)

Example

Personal

The personal API manages private keys in the key store.

personal_importRawKey

Imports the given unencrypted private key (hex string) into the key store, encrypting it with the passphrase. Returns the address of the new account.

ClientMethod invocation
Consolepersonal.importRawKey(keydata, passphrase)
RPC{"method": "personal_importRawKey", "params": [string, string]}

Example

> personal.importRawKey("8e4ae7e66e8acb973ff52cf09ffc7d96138f674a9c102e7a77780af8dbd5e4f6", '!@superpassword_NRG3.0')
"0x5dc9b39668d904c6363a42c61297ca1c0950f849"

personal_listAccounts

Returns all the Energi account addresses of all keys in the key store.

ClientMethod invocation
Consolepersonal.listAccounts
RPC{"method": "personal_listAccounts", "params": []}

Example

> personal.listAccounts
[ "0x680cf4b9c12736dbab9eec2a481e6101aacf300a"]

personal_lockAccount

Removes the private key with given address from memory. The account can no longer be used to send transactions.

ClientMethod invocation
Consolepersonal.lockAccount(address)
RPC{"method": "personal_lockAccount", "params": [string]}

Example

> personal.lockAccount("0x680cf4b9c12736dbab9eec2a481e6101aacf300a")
true

personal_newAccount

Generates a new private key and stores it in the key store directory. The key file is encrypted with the given passphrase. Returns the address of the new account.

At the Energi console, newAccount will prompt for a passphrase when it is not supplied as the argument.

ClientMethod invocation
Consolepersonal.newAccount()
RPC{"method": "personal_newAccount", "params": [string]}

Example

> personal.newAccount()
Passphrase:
Passphrase entered: *****
Repeat passphrase:
Passphrase entered: *****
"0xd2f737d4be4f5716893449698cc450101f0b1580"

The passphrase can also be supplied as a string.

> personal.newAccount("h4ck3r")
"0x7dd389c8df425c5afe31c307d51a86754d16b5d6"

personal_unlockAccount

Decrypts the key with the given address from the key store.

Both passphrase and unlock duration are optional when using the JavaScript console. If the passphrase is not supplied as an argument, the console will prompt for the passphrase interactively.

The unencrypted key will be held in memory until the unlock duration expires. If the unlock duration defaults to 300 seconds. An explicit duration of zero seconds unlocks the key until energi exits.

The account can be used with nrg_sign and nrg_sendTransaction while it is unlocked.

The flag_Staking allows the node to be unlocked only for staking (flag_Staking = true). Otherwise, the node is unlocked for all types of operations. It is false by default.

ClientMethod invocation
Consolepersonal.unlockAccount(address [, passphrase, duration, flag_Staking])
RPC{"method": "personal_unlockAccount", "params": [string, string, number, bool]}

Examples:

> personal.unlockAccount("0x680cf4b9c12736dbab9eec2a481e6101aacf300a")
Unlock account 0x680cf4b9c12736dbab9eec2a481e6101aacf300a
Passphrase:
true

//You can check the status of the account with personal.listWallets
> personal.listWallets
[{
accounts: [{
address: "0x680cf4b9c12736dbab9eec2a481e6101aacf300a",
url: "keystore:///home/user/.energicore/testnet/keystore/UTC--2019-10-14T17-02-09.681009511Z--"
}],
status: "Unlocked",
url: "keystore:///home/user/.energicore/testnet/keystore/UTC--2019-10-14T17-02-09.681009511Z--"
}]

Supplying the passphrase and unlock duration (in seconds) as arguments:

> personal.unlockAccount("0x680cf4b9c12736dbab9eec2a481e6101aacf300a", "foo", 30)
true

If you want to type in the passphrase and still override the default unlock duration, pass null as the passphrase.

> personal.unlockAccount("0x680cf4b9c12736dbab9eec2a481e6101aacf300a", null, 30)
Unlock account 0x680cf4b9c12736dbab9eec2a481e6101aacf300a
Passphrase:
true

Unlock the wallet for staking only; prompted to enter passphrase.

> personal.unlockAccount("0x680cf4b9c12736dbab9eec2a481e6101aacf300a", null, 0, true)
Unlock account 0x680cf4b9c12736dbab9eec2a481e6101aacf300a
Passphrase:
Passphrase entered: *****
true

There are no UTXOs in Gen 3, so the minimal amount of the account within the last 60 minutes (maturity time) will be used for staking. Only the needed part of such amounts is taken to create a block. So, the same large account can stake many times during the maturity period - no need to split amounts. By default, all available amounts are tried to be staked. If that is not desired, the miner.setMinerNonceCap method can be used to limit the amount being bet per block.

personal_sendTransaction

Validate the given passphrase and submit the transaction.

The transaction is the same argument as for nrg_sendTransaction and contains the from address. If the passphrase can be used to decrypt the private key belonging to tx.from, the transaction is verified, signed and send onto the network. The account is not unlocked globally in the node and cannot be used in other RPC calls.

ClientMethod invocation
Consolepersonal.sendTransaction(tx, passphrase)
RPC{"method": "personal_sendTransaction", "params": [tx, string]}

Example

//We generate a Transaction Object to send
> var tx = {from: "0x391694e7e0b0cce554cb130d723a9d27458f9298", to: "0xafa3f8684e54059998bc3a7b0d2b0da075154d66", value: web3.toWei(1.23, "energi")}
undefined

> personal.sendTransaction(tx, "passphrase")
0x8474441674cdd47b35b875fd1a530b800b51a5264b9975fb21129eeb8c18582f

personal_sign

The sign method calculates an Ethereum specific signature with: sign(keccack256("\x19Ethereum Signed Message:\n" + len(message) + message))).

By adding a prefix to the message makes the calculated signature recognisable as an Ethereum specific signature. This prevents misuse where a malicious DApp can sign arbitrary data (e.g. transaction) and use the signature to impersonate the victim.

See ecRecover to verify the signature.

ClientMethod invocation
Consolepersonal.sign(message, account, [password])
RPC{"method": "personal_sign", "params": [message, account, password]}

Examples:

> personal.sign("0xdeadbeaf", "0x9b2055d370f73ec7d8a03e965129118dc8f5bf83", "")
"0xa3f20717a250c2b0b729b7e5becbff67fdaef7e0699da4de7ca5895b02a170a12d887fd3b17bfdce3481f10bea41f45ba9f709d39ce8325427b57afcfc994cee1b"

personal_signTransaction

The signTransaction method will sign the given transaction with the from account. The node needs to have the private key of the account corresponding with the given “from” address and it needs to be unlocked.

ClientMethod invocation
Consolepersonal.signTransaction(tx_object, ‘password’)

Examples

//Transaction object is created
var tx_Object={
from: "0x680cf4b9c12736dbab9eec2a481e6101aacf300a",
gasPrice: "20000000000",
gas: "21000",
to: '0x8978e517c2b442264e54b890c4428816b66aaf8b',
value: "100000000000000000000",
data: "",
nonce: 2
}

//To sign the transaction:
> personal.signTransaction(tx_Object, 'energi123')
{
raw: "0xf870028504a817c800825208948978e517c2b442264e54b890c4428816b66aaf8b89056bc75e2d63100000808301852ea004141f80cec697e95974baedd1cad4401bd955416ba5eb60fce2b75ccb2ecc59a01024866c0cad0d14c154896572d6ca3e6103141673e4ee1e7446c09e0da456f3",
tx: {
gas: "0x5208",
gasPrice: "0x4a817c800",
hash: "0x2402231f146509606ad39a5d153405459471cb0d00e44ce2a897d82607175386",
input: "0x",
nonce: "0x2",
r: "0x4141f80cec697e95974baedd1cad4401bd955416ba5eb60fce2b75ccb2ecc59",
s: "0x1024866c0cad0d14c154896572d6ca3e6103141673e4ee1e7446c09e0da456f3",
to: "0x8978e517c2b442264e54b890c4428816b66aaf8b",
v: "0x1852e",
value: "0x56bc75e2d63100000"
}
}

personal_ecRecover

ecRecover returns the address associated with the private key that was used to calculate the signature in personal_sign.

ClientMethod invocation
Consolepersonal.ecRecover(message, signature)
RPC{"method": "personal_ecRecover", "params": [message, signature]}

Example

//See sign to verify the signature
> personal.ecRecover("0xdeadbeaf", "0xa3f20717a250c2b0b729b7e5becbff67fdaef7e0699da4de7ca5895b02a170a12d887fd3b17bfdce3481f10bea41f45ba9f709d39ce8325427b57afcfc994cee1b")
"0x9b2055d370f73ec7d8a03e965129118dc8f5bf83"

personal_openWallet

The openWallet method initiates a hardware wallet opening procedure, establishing a USB connection and attempting to authenticate via the provided passphrase.

ClientMethod invocation
Consolepersonal.openWallet(url_Wallet, [passphrase])

Examples

personal_deriveAccount

The deriveAccount method requests a HD wallet to derive a new account, optionally pinning it for later reuse.

ClientMethod invocation
Consolepersonal.deriveAccount(url_Wallet, path, pin)

Examples

txpool

The txpool API gives you access to several non-standard RPC methods to inspect the contents of the transaction pool containing all the currently pending transactions as well as the ones queued for future processing.

txpool_content

The content property can be queried to list the exact details of all the transactions currently pending for inclusion in the next block(s), as well as the ones that are being scheduled for future execution only.

The result is an object with two fields pending and queued. Each of these fields are associative arrays, in which each entry maps an origin-address to a batch of scheduled transactions. These batches themselves are maps associating nonces with actual transactions.

Please note, there may be multiple transactions associated with the same account and nonce. This can happen if the user broadcasts multiple ones with varying gas allowances (or even completely different transactions).

ClientMethod invocation
Gotxpool.Content() (map[string]map[string]map[string][]*RPCTransaction)
Consoletxpool.content
RPC{"method": "txpool_content"}

Example

> txpool.content
{
pending: {
0x9979A36db71Eaac8EF927f14bF01A18aBa6c0276: {
0: {
blockHash: "0x0000000000000000000000000000000000000000000000000000000000000000",
blockNumber: null,
from: "0x9979a36db71eaac8ef927f14bf01a18aba6c0276",
gas: "0x15f90",
gasPrice: "0x2540be400",
hash: "0x555ffccd271ae46f07bd9618d205852b71296fd9bd4828298a86167c3ab9764d",
input: "0x",
nonce: "0x0",
r: "0xe5c7aa3d6317ce9de645de6a9be62b5fc798007f766f4f754e76e8bf364f992d",
s: "0x1e01584bf7386418f7e529f5621f22f81edd1bd045c855a4f472fdd0ef527562",
to: "0x01d4a3fdec411abcfc1dece7013890c6ec2629f9",
transactionIndex: "0x0",
v: "0x1852e",
value: "0xde0b6b3a7640000"
}
},
0xFbe1c99fF0aDC7b16289Ea0271EfbD8eE9b6C726: {
2: {
blockHash: "0x0000000000000000000000000000000000000000000000000000000000000000",
blockNumber: null,
from: "0xfbe1c99ff0adc7b16289ea0271efbd8ee9b6c726",
gas: "0x15f90",
gasPrice: "0x2540be400",
hash: "0x3df7fc6f475bd2dd4d82650d0a9e8f848331ec3ae87532019f124ddd85be7214",
input: "0x",
nonce: "0x2",
r: "0xb24f65cf52ff8c06504c4cf5a55bfa2b0e04ad96528a975c254ec7893620b2d",
s: "0x4975e3f623319e06393119a47d9d13f456afdd2e7df276f6ceee7095e0c48eab",
to: "0x01d4a3fdec411abcfc1dece7013890c6ec2629f9",
transactionIndex: "0x0",
v: "0x1852e",
value: "0x1bc16d674ec80000"
},
3: {
blockHash: "0x0000000000000000000000000000000000000000000000000000000000000000",
blockNumber: null,
from: "0xfbe1c99ff0adc7b16289ea0271efbd8ee9b6c726",
gas: "0x5208",
gasPrice: "0x6fc23ac00",
hash: "0xe00d576b9b04ee934b423fa6ae8f727c9fa8d5c95c2371a3fccab02d53ba22c1",
input: "0x",
nonce: "0x3",
r: "0xaf26ae98950dabef497db5b3dfd398a962c17eec9e70e4334ef0b4070db88dbe",
s: "0x252a136c173055fe007ec20ed0817e8465b5f6da9526314c4b2a24c9ab949d37",
to: "0x01d4a3fdec411abcfc1dece7013890c6ec2629f9",
transactionIndex: "0x0",
v: "0x1852d",
value: "0xde0b6b3a7640000"
},
4: {
blockHash: "0x0000000000000000000000000000000000000000000000000000000000000000",
blockNumber: null,
from: "0xfbe1c99ff0adc7b16289ea0271efbd8ee9b6c726",
gas: "0x493e0",
gasPrice: "0x4a817c800",
hash: "0x48f6decfb20c48c8fb41e3c013c143c3f61d3d1a6b91a8716bdc1eeff57cae94",
input: "0xca0e551f0000000000000000000000004374beea1ffdd4414a7e68975a0cf08cb5e99034",
nonce: "0x4",
r: "0x4a8a509e609fca4fdea6637b0010665b8a551001640b4c0d2b8696b833e3f2d0",
s: "0x17d866c9c34b0dee5cd62426359cfcf86dd08ad25e9813b272c8ef008f446872",
to: "0x0000000000000000000000000000000000000302",
transactionIndex: "0x0",
v: "0x1852e",
value: "0x0"
}
}
},
queued: {}
}

txpool_inspect

The inspect property can be queried to list a textual summary of all the transactions currently pending for inclusion in the next block(s), as well as the ones that are being scheduled for future execution only. This is a method specifically tailored to developers to quickly see the transactions in the pool and find any potential issues.

The result is an object with two fields pending and queued. Each of these fields are associative arrays, in which each entry maps an origin-address to a batch of scheduled transactions. These batches themselves are maps associating nonces with transactions summary strings.

Please note, there may be multiple transactions associated with the same account and nonce. This can happen if the user broadcasts multiple ones with varying gas allowances (or even completely different transactions).

ClientMethod invocation
Gotxpool.Inspect() (map[string]map[string]map[string][]string)
Consoletxpool.inspect
RPC{"method": "txpool_inspect"}

Example

> txpool.inspect
{
pending: {
0x9979A36db71Eaac8EF927f14bF01A18aBa6c0276: {
0: "0x01d4A3FdEc411aBcfc1dece7013890C6ec2629f9: 1000000000000000000 wei + 90000 gas × 10000000000 wei"
},
0xFbe1c99fF0aDC7b16289Ea0271EfbD8eE9b6C726: {
2: "0x01d4A3FdEc411aBcfc1dece7013890C6ec2629f9: 2000000000000000000 wei + 90000 gas × 10000000000 wei",
3: "0x01d4A3FdEc411aBcfc1dece7013890C6ec2629f9: 1000000000000000000 wei + 21000 gas × 30000000000 wei",
4: "0x0000000000000000000000000000000000000302: 0 wei + 300000 gas × 20000000000 wei"
}
},
queued: {}
}

txpool_status

The status property can be queried for the number of transactions currently pending for inclusion in the next block(s), as well as the ones that are being scheduled for future execution only.

The result is an object with two fields pending and queued, each of which is a counter representing the number of transactions in that particular state.

ClientMethod invocation
Gotxpool.Status() (map[string]*rpc.HexNumber)
Consoletxpool.status
RPC{"method": "txpool_status"}

Example

> txpool.status
{
pending: 4,
queued: 0
}