Difference between revisions of "NodeCore CommandLine"

From VeriBlock Wiki
Jump to: navigation, search
(disconnect)
(removenode)
Line 695: Line 695:
 
}
 
}
  
 +
</pre>
 +
 +
=== getpopendorsementsinfo ===
 +
 +
<pre>
 +
getpopendorsementsinfo <address> [searchLength]
 
</pre>
 
</pre>
  
Line 719: Line 725:
 
}
 
}
 
</pre>
 
</pre>
 
  
 
=== send ===
 
=== send ===

Revision as of 13:33, 26 April 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 77.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

Once the CLI is connected to a NodeCore instance, then there are many other commands that can be run.


addallowed

Adds an IP to the whitelist. See: NodeCore_Networking. See command NodeCore_CommandLine#clearallowed

Syntax

addallowed <address>

Example

# input
addallowed 33.33.33.33

# This will update [[nodecore.properties]] file:
# rpc.whitelist.addresses=33.33.33.33

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

addnode

Add a peer node to the local configuration and connect. After adding a node, you should see it when running getpeerinfo,

Syntax

addnode <peer>

Example

# input
addnode 93.130.33.180:6500

#output (also run getpeerinfo to see the node added)
rpc (127.0.0.1:10500) > {
  "payload": {},
  "success": true,
  "messages": []
}

backupwallet

Backup the wallet of the NodeCore instance to the given location.

Syntax

backupwallet <targetLocation>

Example

# input
backupwallet C:\Temp\myBackup2.dat

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

clearallowed

Clears the list of allowed addresses. See command NodeCore_CommandLine#addallowed.

Syntax

clearallowed

Example

# input
clearallowed

# This will update [[nodecore.properties]] file:
# rpc.whitelist.addresses=

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


disconnect

Simply disconnects from the current NodeCore instance

getblocktemplate

Returns a block template along with candidate transactions

Syntax

getblocktemplate [mode] [capabilities]

Examples:

getblocktemplate

#returns info for a specific command
rpc (77.46.106.162:10500) > {
  "payload": {
    "target": -7236281451971613363,
    "size_limit": 1232896,
    "block_height": 37625,
    "coinbase_value": 500000000000,
    "minimum_timestamp": 1516502622,
    "current_timestamp": 1516503768,
    "previous_block_hash": "00000002F22575136B63F90BBAB423CC1241C0ED8EA6FB40",
    "mutable": [
      "timestamp",
      "transactions"
    ],
    "transactions": [
      {
        "fee": 121,
        "weight": 221,
        "required": true,
        "transaction_id": "2EB013AC6B62D192FD0EA3D8DBB757BB8D4F6008BC3A17846A42CBB629F27D58",
        "transaction": {
          "type": "signed",
          "signed": {
            "signature": "304402202F8DDB95B57F536C5317B19C63BDBF41314BBEB9C8A02484DCF09C9069FB2F6F022077902BDC9CDE23BA9FFD6256E9DF57BB37D9D21EF6D793F8B2A2959789A60110",
            "public_key": "3056301006072A8648CE3D020106052B8104000A034200042704DEA2E9BDB74133E298C3AAD8E76588E48AED614674869380B959BB49DF69E8DAA1B7EF4E14240952C2BB082C89FB54A528D6502F8934E1BDA95F651F8D29",
            "signature_index": 27,
            "transaction": {
              "size": 56,
              "txid": "2EB013AC6B62D192FD0EA3D8DBB757BB8D4F6008BC3A17846A42CBB629F27D58",
              "data": "",
              "type": "standard",
              "fee": 121,
              "source_amount": 1121,
              "merkle_path": "",
              "source_address": "VazUQm9TaPmbhTWEi6FYUUPp28Eynq",
              "bitcoin_transaction": "",
              "bitcoin_block_header": "",
              "endorsed_block_header": "",
              "outputs": [
                {
                  "address": "VEP6ZjXby6Ska22bb4fcrirL4Dj2Vo",
                  "amount": 1000
                }
              ]
            }
          }
        },
        "depends": []
      }
    ]
  },
  "success": true,
  "messages": []
}


getbalance

Find the balance for a given address

Syntax

getbalance [address]

Case 1: Specific address

#input
getbalance VEYtYxYUJY3MinMa7oyC7vjdGBLrfV

#output
rpc (77.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 (77.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": []
}


getblockfromindex

Returns the block for the specified block number

Syntax

getblockfromindex <blockNumber>

Examples:

#get info for block 30000
getblockfromindex 30000

#returns info for a specific command
rpc (77.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 (77.46.106.162:10500) > {
  "payload": {
    "best_length": 37530,
    "longest_length": 37530
  },
  "success": true,
  "messages": []
}

getblockfromhash

Returns the block for the specified hash

Syntax

getblockfromhash <blockHash>

Examples:

#get block given specific hash
getblockfromhash 0000000B1F90DED765A69641F9840568839BCA0DB02EF126

#returns info for a specific command
rpc (77.46.106.162:10500) > {
  "payload": {
    "blocks": [
      {
        "coinbaseReward": 1000000000,
        "transactionFees": 0,
        "size": 0,
        "raw": "CKulAhCcxI7TBRoYAAAACx+Q3tdlppZB+YQFaIObyg2wLvEmIhgAAAAQSRpa2pkGjaMFF0g+7uedXcOynIopfQcAAAAAAAAwof3QwP//////AToWaVLnTYcGoeUPflsiB8rJOoy/viPRGkIk0000003815F944BD02E2AA76E69E7DFBD493D689ADE032ACaICU69wD",
        "number": 37547,
        "timestamp": 1516479004,
        "hash": "0000000B1F90DED765A69641F9840568839BCA0DB02EF126",
        "previous_hash": "00000010491A5ADA99068DA30517483EEEE79D5DC3B29C8A",
        "difficulty": 1917,
        "winning_nonce": -132890975,
        "miner_address": "VazUQm9TaPmbhTWEi6FYUUPp28Eynq",
        "ledgerHash": "D34D34D34DFCD7917DE38043D36136000EFA13AF44EC31410F8F770FAF3D003134DF6002",
        "bitcoin_block_headers": [],
        "transactions": []
      }
    ]
  },
  "success": true,
  "messages": []
}


gethistory

Returns transaction history for specified address or the default if not.

Syntax

gethistory [address]

Examples:

#Get history for a specific address
gethistory VE2TkS4er4JeZJRnPkSKUdSeaAew5E

#returns info for a specific command
rpc (77.46.106.162:10500) > {
  "payload": [
    {
      "balance": 2000,
      "blocks_mined": 0,
      "transactions": [
        {
          "type": "signed",
          "signed": {
            "signature": "3046022100E786556F3693541F6D059165903F261D8971E6DC92316457FA5381C039E3D8F4022100A08D4B8838053B48474ECABE9EF340E83D8A3A330A814316EA75958D510A1B76",
            "public_key": "3056301006072A8648CE3D020106052B8104000A034200042704DEA2E9BDB74133E298C3AAD8E76588E48AED614674869380B959BB49DF69E8DAA1B7EF4E14240952C2BB082C89FB54A528D6502F8934E1BDA95F651F8D29",
            "signature_index": 25,
            "transaction": {
              "size": 56,
              "txid": "B6C62ADB8CFAC18FBAC5F9F5BD3E828249E176A64C71445BD443752C8635787D",
              "data": "",
              "type": "standard",
              "fee": 121,
              "source_amount": 1121,
              "merkle_path": "",
              "source_address": "VazUQm9TaPmbhTWEi6FYUUPp28Eynq",
              "bitcoin_transaction": "",
              "bitcoin_block_header": "",
              "endorsed_block_header": "",
              "outputs": [
                {
                  "address": "VE2TkS4er4JeZJRnPkSKUdSeaAew5E",
                  "amount": 1000
                }
              ]
            }
          }
        },
        {
          "type": "signed",
          "signed": {
            "signature": "3044022042C19F6CC85D64E9D87583011D020D232A056DBDAAECA0499BD711AFF72B87540220010A9D4F7BFC7CF4F3202FC8774542ECFBE94CC1B4876DAB9EFC1CE586959073",
            "public_key": "3056301006072A8648CE3D020106052B8104000A034200042704DEA2E9BDB74133E298C3AAD8E76588E48AED614674869380B959BB49DF69E8DAA1B7EF4E14240952C2BB082C89FB54A528D6502F8934E1BDA95F651F8D29",
            "signature_index": 26,
            "transaction": {
              "size": 56,
              "txid": "7BA24151FA9A8D59D009B952BC259E3228FFE753526C38F8F1C4703EFFA8C115",
              "data": "",
              "type": "standard",
              "fee": 121,
              "source_amount": 1121,
              "merkle_path": "",
              "source_address": "VazUQm9TaPmbhTWEi6FYUUPp28Eynq",
              "bitcoin_transaction": "",
              "bitcoin_block_header": "",
              "endorsed_block_header": "",
              "outputs": [
                {
                  "address": "VE2TkS4er4JeZJRnPkSKUdSeaAew5E",
                  "amount": 1000
                }
              ]
            }
          }
        }
      ]
    }
  ],
  "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 (77.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": []
}


getlastbitcoinblock

Returns the last bitcoin block.

Syntax

getlastbitcoinblock

Example

# input
getlastbitcoinblock

#output
rpc (127.0.0.1:10500) > {
  "payload": "00000020F3E15A9E8C0D18957E6E048311B85014F54EDD6FDB27442809C9A64C00000000324227DB35ECF6AC8E35C403366C84BCBA613F3A8F5C67DA3B40E302731A1BD8A90EA35AFFFF001D6887AE1E",
  "success": true,
  "messages": []
}

getnewaddress

Creates a new address from the wallet

Example

# input
getnewaddress

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

getpeerinfo

Returns a list of connected peers

Syntax

getpeerinfo 

Examples:

rpc (127.0.0.1:10500) > {
  "payload": {
    "configured_endpoints": [
      {
        "address": "93.130.33.180",
        "port": 6500
      },
      {
        "address": "77.46.106.162",
        "port": 6500
      }
    ],
    "connected": [
      {
        "address": "77.46.106.162",
        "port": 6500,
        "application": "VeriBlock NodeCore v0.1.0-rc.28",
        "protocol_version": 1,
        "platform": "Windows Server 2016",
        "start_timestamp": 1520633272
      }
    ],
    "disconnected": [],
    "candidates": [
      {
        "address": "23.96.176.247",
        "port": 6500,
        "application": "VeriBlock NodeCore v0.1.0-rc.28",
        "protocol_version": 1,
        "platform": "Linux",
        "start_timestamp": 1520634269
      },
      {
        "address": "13.95.160.234",
        "port": 6500,
        "application": "VeriBlock NodeCore v0.1.0-rc.24",
        "protocol_version": 1,
        "platform": "Linux",
        "start_timestamp": 1520625288
      }
    ]
  },
  "success": true,
  "messages": []
}


getpendingtransactions

Returns the serialized mempool transactions. Returns nothing if there are no transactions.

Syntax

getpendingtransactions

Examples:

#First send some coins (to ensure there is a transaction), then check for pending transactions.
send 1000 VE2TkS4er4JeZJRnPkSKUdSeaAew5E
getpendingtransactions

#returns info for a specific command
rpc (77.46.106.162:10500) > {
  "payload": [
    {
      "size": 56,
      "txid": "2EB013AC6B62D192FD0EA3D8DBB757BB8D4F6008BC3A17846A42CBB629F27D58",
      "data": "",
      "type": "standard",
      "fee": 121,
      "source_amount": 1121,
      "merkle_path": "",
      "source_address": "VazUQm9TaPmbhTWEi6FYUUPp28Eynq",
      "bitcoin_transaction": "",
      "bitcoin_block_header": "",
      "endorsed_block_header": "",
      "outputs": [
        {
          "address": "VEP6ZjXby6Ska22bb4fcrirL4Dj2Vo",
          "amount": 1000
        }
      ]
    }
  ],
  "success": true,
  "messages": []
}

getpopendorsementsinfo

getpopendorsementsinfo <address> [searchLength]

removenode

Removes the peer address from the configuration

Syntax

removenode <peer>

Example

# input
removenode 93.130.33.180:10500

#output (also run getpeerinfo to see the node removed)
rpc (127.0.0.1:10500) > {
  "payload": {},
  "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 (77.46.106.162:10500) > {
  "payload": {},
  "success": true,
  "messages": []
}

settxfee

Sets the transaction fee. You can view the transaction fee by running getinfo

Syntax

settxfee <transactionFee>

Examples:

#Set the transaction fee
settxfee 0.00001000

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


sigindex

Return the signature index for the specified address

Syntax

sigindex [address]

Examples:

#get the signature index
sigindex VE2TkS4er4JeZJRnPkSKUdSeaAew5E

#returns info for a specific command
rpc (127.0.0.1:10500) > {
  "payload": {
    "addresses": [
      {
        "pool_index": -1,
        "address": "VE2TkS4er4JeZJRnPkSKUdSeaAew5E",
        "blockchain_index": -1
      }
    ]
  },
  "success": true,
  "messages": []
}


signmessage

Signs a message with the addresses private key

Syntax

signmessage <address> <message>

Examples:

#sign a message, infer the private key from the address
signmessage VDonzX9vwXxcL9BapJWkhnBiyAX6ia ThisIsSomeText

#returns info for a specific command
rpc (127.0.0.1:10500) > {
  "payload": "MEYCIQDDxExDiIGkjxrs20cl5RhlbHo5MEgSdub+MmdEE5d21AIhAJk7alAVUAuH/+j3/PuUY7BEuLtH4vIjAFwvGEaLdexh",
  "success": true,
  "messages": []
}

startpool

Starts the built-in pool service in NodeCore.

Requires permissions.

Syntax

startpool

Examples:

#start the UCP pool on an instance
startpool

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

stoppool

Stops the built-in pool service in NodeCore

Syntax

stoppool

Examples:

stoppool

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

validateaddress

Returns details about an address if it's valid

Syntax

validateaddress <address>

Examples:

#Check a specific address
validateaddress VazUQm9TaPmbhTWEi6FYUUPp28Eynq

#returns info for a specific command
rpc (77.46.106.162:10500) > {
  "payload": {
    "address": "VazUQm9TaPmbhTWEi6FYUUPp28Eynq",
    "is_remote": false,
    "public_key": "3056301006072A8648CE3D020106052B8104000A034200042704DEA2E9BDB74133E298C3AAD8E76588E48AED614674869380B959BB49DF69E8DAA1B7EF4E14240952C2BB082C89FB54A528D6502F8934E1BDA95F651F8D29"
  },
  "success": true,
  "messages": []
}