Difference between revisions of "NodeCore CommandLine"

From Veriblock Wiki
Jump to: navigation, search
Line 63: Line 63:
 
Most often the command line will be connected to a NodeCore instance, as that is its point.
 
Most often the command line will be connected to a NodeCore instance, as that is its point.
  
All commands:
 
  
{| class="wikitable"
+
=== getblock ===
! Command
+
 
! Explanation
+
Returns the block for the specified block number
! Example
+
 
|-
+
Syntax
| addNode
+
<pre>
| ...
+
getblock <blockNumber>
| ...
+
</pre>
|-
+
 
| getBalance
+
Examples:
|
+
<pre>
|
+
#get info for block 30000
|-
+
getblock 30000
| getBlockchains
+
 
|
+
#returns info for a specific command
|
+
rpc (78.46.106.162:10500) > {
|-
+
  "payload": {
| getBlocks
+
    "blocks": [
|
+
      {
|
+
        "coinbaseReward": 1000000000,
|-
+
        "transactionFees": 0,
| getBlockTemplate
+
        "size": 0,
|
+
        "raw": "CLDqARDu+t7SBRoYAAABzlcP6/yCPKGucmMsLyg5lpSry1lAIhgAAAOgOclPMbNBFhGVm/qG/Hamtlw3HtYpRgAAAAAAAAAwhsm43/v/////AToWaVLnTYcGoeUPflsiB8rJOoy/viPRGkIk0000003815F944BD02E2AA76E69E7DFBD493D689ADE032ACaICU69wD",
|
+
        "number": 30000,
|-
+
        "timestamp": 1515699566,
| getBlockTimes
+
        "hash": "000001CE570FEBFC823CA1AE72632C2F28399694ABCB5940",
|
+
        "previous_hash": "000003A039C94F31B3411611959BFA86FC76A6B65C371ED6",
|
+
        "difficulty": 70,
|-
+
        "winning_nonce": -1142020986,
| getHistory
+
        "miner_address": "VazUQm9TaPmbhTWEi6FYUUPp28Eynq",
|
+
        "ledgerHash": "D34D34D34DFCD7917DE38043D36136000EFA13AF44EC31410F8F770FAF3D003134DF6002",
|
+
        "bitcoin_block_headers": [],
|-
+
        "transactions": []
| getInfo
+
      }
|
+
    ]
|
+
  },
|-
+
  "success": true,
| getLastBitcoinBlock
+
  "messages": []
|
+
}
|
+
 
|-
+
 
| getNewAddress
+
</pre>
|
+
 
|
+
=== getblockchains ===
|-
+
 
| getPeerInfo
+
Returns blockchain information
|
+
 
|
+
Syntax
|-
+
<pre>
| getPendingTransactions
+
getblockchains
|
+
</pre>
|
+
 
|-
+
Examples:
| getPop
+
<pre>
|
+
#get info about the current blockchain
|
+
getblockchains
|-
+
 
| getSignatureIndex
+
#returns info for a specific command
|
+
rpc (78.46.106.162:10500) > {
|
+
  "payload": {
|-
+
    "best_length": 37530,
| getTransactions
+
    "longest_length": 37530
|
+
  },
|
+
  "success": true,
|-
+
  "messages": []
| removeNode
+
}
|
+
 
|
+
</pre>
|-
+
 
| sendCoins
+
 
|
+
=== getinfo ===
|
+
 
|-
+
Returns general information about this node and the presently-known blockchain
| setTransactionFee
+
 
|
+
Syntax
|
+
<pre>
|-
+
getinfo
| signMessage
+
</pre>
|
+
 
+
Examples:
|-
+
<pre>
| submitBlocks
+
getinfo
|
+
 
|
+
#returns info for a specific command
|-
+
rpc (78.46.106.162:10500) > {
| submitPop
+
  "payload": {
|
+
    "default_address": {
|
+
      "address": "VazUQm9TaPmbhTWEi6FYUUPp28Eynq",
|-
+
      "amount": 187457753607875
| submitTransactions
+
    },
|
+
    "estimated_hash_rate": 6,
|
+
    "number_of_blocks": 37532,
|-
+
    "transaction_fee": 121,
| validateAddress
+
    "last_block": {
|
+
      "coinbaseReward": 1000000000,
|
+
      "transactionFees": 0,
|}
+
      "size": 0,
 +
      "raw": "CJulAhCLoo7TBRoYAAAAKxIj2rocYAtCHvclu0nOg6mEdUFFIhgAAAAV+9oXWONJpFXwDTd3aUIEabXUJJ8pfQcAAAAAAAAw6q+nsvr/////AToWaVLnTYcGoeUPflsiB8rJOoy/viPRGkIk0000003815F944BD02E2AA76E69E7DFBD493D689ADE032ACaICU69wD",
 +
      "number": 37531,
 +
      "timestamp": 1516474635,
 +
      "hash": "0000002B1223DABA1C600B421EF725BB49CE83A984754145",
 +
      "previous_hash": "00000015FBDA1758E349A455F00D377769420469B5D4249F",
 +
      "difficulty": 1917,
 +
      "winning_nonce": -1505110038,
 +
      "miner_address": "VazUQm9TaPmbhTWEi6FYUUPp28Eynq",
 +
      "ledgerHash": "D34D34D34DFCD7917DE38043D36136000EFA13AF44EC31410F8F770FAF3D003134DF6002",
 +
      "bitcoin_block_headers": [],
 +
      "transactions": []
 +
    },
 +
    "difficulty": 1917
 +
  },
 +
  "success": true,
 +
  "messages": []
 +
}
 +
 
 +
 
 +
</pre>
  
 
=== getBalance===
 
=== getBalance===

Revision as of 18:59, 20 January 2018

See: Main_Page

Overview

The NodeCore CommandLine can access an instance of NodeCore

Commands: Not Connected

When first started, the command line is not connected.

clear

Standard command, clears the screen

connect

Connects to an instance of nodecore via gRPC, on port 10500.

If connected to a node, then many other commands are available.

Syntax:

connect <peer>

Examples:

#connect to an instance
connect 78.46.106.162:10500

help

Standard help command.

Syntax:

help [command]

Examples:

#returns list of available commands
help

#returns info for a specific command
help connect

quit

Standard quit command, exits the console

Commands: Connected

Most often the command line will be connected to a NodeCore instance, as that is its point.


getblock

Returns the block for the specified block number

Syntax

getblock <blockNumber>

Examples:

#get info for block 30000
getblock 30000

#returns info for a specific command
rpc (78.46.106.162:10500) > {
  "payload": {
    "blocks": [
      {
        "coinbaseReward": 1000000000,
        "transactionFees": 0,
        "size": 0,
        "raw": "CLDqARDu+t7SBRoYAAABzlcP6/yCPKGucmMsLyg5lpSry1lAIhgAAAOgOclPMbNBFhGVm/qG/Hamtlw3HtYpRgAAAAAAAAAwhsm43/v/////AToWaVLnTYcGoeUPflsiB8rJOoy/viPRGkIk0000003815F944BD02E2AA76E69E7DFBD493D689ADE032ACaICU69wD",
        "number": 30000,
        "timestamp": 1515699566,
        "hash": "000001CE570FEBFC823CA1AE72632C2F28399694ABCB5940",
        "previous_hash": "000003A039C94F31B3411611959BFA86FC76A6B65C371ED6",
        "difficulty": 70,
        "winning_nonce": -1142020986,
        "miner_address": "VazUQm9TaPmbhTWEi6FYUUPp28Eynq",
        "ledgerHash": "D34D34D34DFCD7917DE38043D36136000EFA13AF44EC31410F8F770FAF3D003134DF6002",
        "bitcoin_block_headers": [],
        "transactions": []
      }
    ]
  },
  "success": true,
  "messages": []
}


getblockchains

Returns blockchain information

Syntax

getblockchains

Examples:

#get info about the current blockchain
getblockchains

#returns info for a specific command
rpc (78.46.106.162:10500) > {
  "payload": {
    "best_length": 37530,
    "longest_length": 37530
  },
  "success": true,
  "messages": []
}


getinfo

Returns general information about this node and the presently-known blockchain

Syntax

getinfo

Examples:

getinfo

#returns info for a specific command
rpc (78.46.106.162:10500) > {
  "payload": {
    "default_address": {
      "address": "VazUQm9TaPmbhTWEi6FYUUPp28Eynq",
      "amount": 187457753607875
    },
    "estimated_hash_rate": 6,
    "number_of_blocks": 37532,
    "transaction_fee": 121,
    "last_block": {
      "coinbaseReward": 1000000000,
      "transactionFees": 0,
      "size": 0,
      "raw": "CJulAhCLoo7TBRoYAAAAKxIj2rocYAtCHvclu0nOg6mEdUFFIhgAAAAV+9oXWONJpFXwDTd3aUIEabXUJJ8pfQcAAAAAAAAw6q+nsvr/////AToWaVLnTYcGoeUPflsiB8rJOoy/viPRGkIk0000003815F944BD02E2AA76E69E7DFBD493D689ADE032ACaICU69wD",
      "number": 37531,
      "timestamp": 1516474635,
      "hash": "0000002B1223DABA1C600B421EF725BB49CE83A984754145",
      "previous_hash": "00000015FBDA1758E349A455F00D377769420469B5D4249F",
      "difficulty": 1917,
      "winning_nonce": -1505110038,
      "miner_address": "VazUQm9TaPmbhTWEi6FYUUPp28Eynq",
      "ledgerHash": "D34D34D34DFCD7917DE38043D36136000EFA13AF44EC31410F8F770FAF3D003134DF6002",
      "bitcoin_block_headers": [],
      "transactions": []
    },
    "difficulty": 1917
  },
  "success": true,
  "messages": []
}


getBalance

Find the balance for a given address

Syntax

getbalance [address]

Case 1: Specific address

#input
getbalance VEYtYxYUJY3MinMa7oyC7vjdGBLrfV

#output
rpc (78.46.106.162:10500) > {
  "payload": {
    "confirmed": [
      {
        "address": "VEYtYxYUJY3MinMa7oyC7vjdGBLrfV",
        "amount": 992331
      }
    ],
    "unconfimed": [
      {
        "address": "VEYtYxYUJY3MinMa7oyC7vjdGBLrfV",
        "amount": 0
      }
    ]
  },
  "success": true,
  "messages": []
}

Case 2: All addresses

#input
getbalance

#output
rpc (78.46.106.162:10500) > {
  "payload": {
    "confirmed": [
      {
        "address": "VEYtYxYUJY3MinMa7oyC7vjdGBLrfV",
        "amount": 992331
      },
      {
        "address": "VCGeXVDjH9EHv8zkGmh6VwL5mHXfpm",
        "amount": 0
      }
    ],
    "unconfimed": [
      {
        "address": "VEYtYxYUJY3MinMa7oyC7vjdGBLrfV",
        "amount": 0
      },
      {
        "address": "VC4YViRdJuiiZw8VSMZMBaUUXBzr8v",
        "amount": 0
      }
    ]
  },
  "success": true,
  "messages": []
}

getNewAddress

Creates a new address from the wallet

Example

# input
getnewaddress

#output
rpc (78.46.106.162:10500) > {
  "payload": "VCGeXVDjH9EHv8zkGmh6VwL5mHXfpm",
  "success": true,
  "messages": []
}

send

Send coins to the specified address. Will automatically pick a source address that has sufficient coins.

Syntax

send <amount> <destinationAddress>

Examples:

#send 1000 coins to address "VE2TkS4er4JeZJRnPkSKUdSeaAew5E"
send 1000 VE2TkS4er4JeZJRnPkSKUdSeaAew5E

#returns info for a specific command
rpc (78.46.106.162:10500) > {
  "payload": {},
  "success": true,
  "messages": []
}