Difference between revisions of "NodeCore CommandLine"

From Veriblock Wiki
Jump to: navigation, search
Line 71: Line 71:
 
*getlastbitcoinblock
 
*getlastbitcoinblock
 
*getpeerinfo
 
*getpeerinfo
*getpendingtransactions
+
*~getpendingtransactionsreadable --> same output as getpendingtransactions
*getpendingtransactionsreadable
 
 
*getpop
 
*getpop
 
*getrawblockfromhash <blockHash> [searchLength]
 
*getrawblockfromhash <blockHash> [searchLength]
Line 422: Line 421:
 
   "messages": []
 
   "messages": []
 
}
 
}
 +
</pre>
 +
 +
=== getpendingtransactions ===
 +
 +
Returns the serialized mempool transactions. Returns nothing if there are no transactions.
 +
 +
Syntax
 +
<pre>
 +
getpendingtransactions
 +
</pre>
 +
 +
Examples:
 +
<pre>
 +
#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 (78.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": []
 +
}
 +
 
</pre>
 
</pre>
  

Revision as of 02:58, 21 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.


TODO --> add in these commands

  • addnode <peer>
  • getblocktemplate [mode] [capabilities]
  • ~getblocktimes [historyLength] --> BUG, not returning anything
  • getlastbitcoinblock
  • getpeerinfo
  • ~getpendingtransactionsreadable --> same output as getpendingtransactions
  • getpop
  • getrawblockfromhash <blockHash> [searchLength]
  • ~getrawblockfromindex <blockIndex>
  • ~getrawtransaction <txId> [searchLength]
  • ~gettransaction <txId> [searchLength]
  • removenode <peer>
  • settxfee <transactionFee>
  • submitblock <rawBlock>
  • submitpop <endorsedBlockHeader> <bitcoinTransaction> <bitcoinMerklePathToRoot> <bitcoinBlockHeader> [address]
  • submitttx <rawTransaction>

Note, these sets of commands are currently identical, but both commands (in both sets) will change, so not adding them yet:

  • getrawtransaction vs. gettransaction
  • getrawblockfromindex vs. getblock

disconnect

Simply disconnects from the current NodeCore instance

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": []
}


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": []
}

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 (78.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 (78.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 (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": []
}


getnewaddress

Creates a new address from the wallet

Example

# input
getnewaddress

#output
rpc (78.46.106.162:10500) > {
  "payload": "VCGeXVDjH9EHv8zkGmh6VwL5mHXfpm",
  "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 (78.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": []
}

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": []
}

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 (78.46.106.162:10500) > {
  "payload": {
    "address": "VazUQm9TaPmbhTWEi6FYUUPp28Eynq",
    "is_remote": false,
    "public_key": "3056301006072A8648CE3D020106052B8104000A034200042704DEA2E9BDB74133E298C3AAD8E76588E48AED614674869380B959BB49DF69E8DAA1B7EF4E14240952C2BB082C89FB54A528D6502F8934E1BDA95F651F8D29"
  },
  "success": true,
  "messages": []
}