block and transaction - UCHAIN-WORLD/uchain-fullnode GitHub Wiki

title: block

  • showblockheight

    Get last height. Alias as fetch-height.
    • Parameters (positional)
    1. ADMINNAME admin name.
    2. ADMINAUTH admin password/authorization.
    • Example
    $ uc-cli showblockheight tony4 456789
    {
    	"id" : 1,
    	"jsonrpc" : "2.0",
    	"result" : 63516
    }
    

  • showblock

    Get sepcified block header from wallet.

    • Parameters (named)
    1. json use json format or not, default is true, that is '--json=true'
    2. tx_json use json format or not for txs, default is true, that is '--tx_json=true'
    • Parameters (positional)
    1. HASH_OR_HEIGH block hash or block height.
    params:[
        "HASH_OR_HEIGH"
    ]
    
    • Example
    $ uc-cli showblock 30
    {
    	"hash" : "4fbd4f55e93ebeb6f887d6395727e8ca6f625173c1d206b6a966ef3f1cf0615a",
    	"merkle_tree_hash" : "04f8d7f5c508887fa16f57d84e4f5cbe48eccdb8ef70930679ef430e76bbf564",
    	"number" : 30,
    	"previous_block_hash" : "45a42b4d3405ab4833058079eac49fe85c50c87f7bc067ace54d7e05c78d22d6",
    	"timestamp" : 1543374059,
    	"transaction_count" : 1,
    	"transactions" : 
    	[
    		{
    			"hash" : "04f8d7f5c508887fa16f57d84e4f5cbe48eccdb8ef70930679ef430e76bbf564",
    			"inputs" : 
    			[
    				{
    					"address" : "UXFQvGKWh8GzEtV1RNw2Vo1abnynPy58u1",
    					"previous_output" : 
    					{
    						"hash" : "5c3ba9b8c4f8d1eeb7b42ed7db9dd69e9897da0652d255a629310c4e8a8889fa",
    						"index" : 0
    					},
    					"script" : "[ 3044022070ff835ee6fd72fa53c038962f89d46e8679ede1fef41273a7fd2c7d29eb092602200cde4a62da657f78eb4dc30b2c2e148cded49a46354760cbf37aeb6cd70fc05b01 ] [ 026c05f0fe5306fc9c5282600f09305199da99664a6a90f430b59fae8b09cc7aeb ]",
    					"sequence" : 4294967295
    				}
    			],
    			"lock_time" : "0",
    			"outputs" : 
    			[
    				{
    					"address" : "UXFQvGKWh8GzEtV1RNw2Vo1abnynPy58u1",
    					"asset" : 
    					{
    						"quantity" : 30,
    						"symbol" : "BLOCK",
    						"type" : "token-transfer"
    					},
    					"index" : 0,
    					"locked_height_range" : 0,
    					"script" : "dup hash160 [ 65a28a57f631d6d6da1a0036e72942a60b95743d ] equalverify checksig",
    					"value" : 0
    				}
    			],
    			"version" : "2"
    		}
    	],
    	"version" : 1
    }
    

  • showblockheader

    get best blockheader alias as fetch-header/getbestblockhash/getbestblockheader

    • Parameters (named)
    1. -s [--hash] The Base16 block hash.
    2. -t [--height] The block height.
    • Example
    $ uc-cli showblockheader -t 30
    {
    	"hash" : "4fbd4f55e93ebeb6f887d6395727e8ca6f625173c1d206b6a966ef3f1cf0615a",
    	"merkle_tree_hash" : "04f8d7f5c508887fa16f57d84e4f5cbe48eccdb8ef70930679ef430e76bbf564",
    	"number" : 30,
    	"previous_block_hash" : "45a42b4d3405ab4833058079eac49fe85c50c87f7bc067ace54d7e05c78d22d6",
    	"timestamp" : 1543374059,
    	"transaction_count" : 1,
    	"version" : 1
    }
    

    • showblockheaders

    get best blockheader in range

    • Parameters (named)
    1. -e [--height] Get block headers according height eg: -e start-height:end-height will return tx between [start-height, end-height).
    • Example
    $ uc-cli showblockheader -e 0:2
    [
    {
    	"hash" : "e3b1dbc8aa72ba41585c2b2910c7870a91f9abbd0298a9a06be2c736c929ded5",
    	"merkle_tree_hash" : "56e0ad1f4209e1168fcc1faf637d47ec913b1da53e2d50a41d60f6a6541f574a",
    	"number" : 0,
    	"previous_block_hash" : "0000000000000000000000000000000000000000000000000000000000000000",
    	"timestamp" : 1550073600,
    	"transaction_count" : 1,
    	"version" : 1
    },
    {
    	"hash" : "94f00e35fa3777326f2e678bdeb4d060894dc602b1b5ce96e3709d36a66c90bb",
    	"merkle_tree_hash" : "21919ae6e118dca40781fe06d2b81f20448f74cf1ecd106bb0fbe4452a343136",
    	"number" : 1,
    	"previous_block_hash" : "e3b1dbc8aa72ba41585c2b2910c7870a91f9abbd0298a9a06be2c736c929ded5",
    	"timestamp" : 1545810065,
    	"transaction_count" : 1,
    	"version" : 1
    },
    {
    	"hash" : "406f8f12841133a778826258a991c51585504d4a65cd9c848cde9e9dd461b382",
    	"merkle_tree_hash" : "11237543819acfbd0219881f5dfe66e61abdb3e2474589cebc5e5394cf301b70",
    	"number" : 2,
    	"previous_block_hash" : "94f00e35fa3777326f2e678bdeb4d060894dc602b1b5ce96e3709d36a66c90bb",
    	"timestamp" : 1545810065,
    	"transaction_count" : 1,
    	"version" : 1
    }
    ]
    
    

  • showheaderext

    similar to showblockheader

    • Parameters (positional)
    1. WALLET_NAME Wallet name.
    2. WALLET_AUTH Wallet password/authorization.
    • Example
    $ uc-cli showheaderext tony4 456789 30
    {
    	"hash" : "4fbd4f55e93ebeb6f887d6395727e8ca6f625173c1d206b6a966ef3f1cf0615a",
    	"merkle_tree_hash" : "04f8d7f5c508887fa16f57d84e4f5cbe48eccdb8ef70930679ef430e76bbf564",
    	"number" : 30,
    	"previous_block_hash" : "45a42b4d3405ab4833058079eac49fe85c50c87f7bc067ace54d7e05c78d22d6",
    	"timestamp" : 1543374059,
    	"transaction_count" : 0,
    	"version" : 1
    }
    

  • showmemorypool

    Returns all transactions in memory pool.

    • Parameters (named)
    1. -j or [--json] Json format or Raw format, default is Json(true).
    • Parameters (positional)
    1. ADMINNAME Administrator required.(administrator_required is true).
    2. ADMINAUTH Administrator password required.
    • Example
    $ uc-cli showmemorypool tony4 456789
    [
    	{
    		"hash" : "1362c7e68badbed8837d5ae6b9022c92df4ba50b06aae488582e0ca6475aad94",
    		"inputs" : 
    		[
    			{
    				"address" : "UiyoSgUnCbfSFVKcufwMZALVMURmiEfswq",
    				"previous_output" : 
    				{
    					"hash" : "664527536c5016c48b92b3b26f358eed01a06759b51393f2e4f213e35700025e",
    					"index" : 1
    				},
    				"script" : "[ 3045022100ccbc075db7ba3bf35ceb815add70f6c8586ca2b49ccc8e86079eeb5304029b3e0220515026d70dbfde16e9dc413ec8d4389d107c1c10184fe6634e80fcd42e3defa401 ] [ 03bec77692da62f861065c04d09de5b217c14be033453a9235a1c67853cccf3ea9 ]",
    				"sequence" : 4294967295
    			}
    		],
    		"lock_time" : "0",
    		"outputs" : 
    		[
    			{
    				"address" : "38fZvvVpYCKjtq3i7m1rsYffSQDBK97ktZ",
    				"asset" : 
    				{
    					"type" : "ucn"
    				},
    				"index" : 0,
    				"locked_height_range" : 0,
    				"script" : "hash160 [ 4c82c42ad2fd65e9fbc98688df20e56b99818f89 ] equal",
    				"value" : 10000
    			},
    			{
    				"address" : "UiyoSgUnCbfSFVKcufwMZALVMURmiEfswq",
    				"asset" : 
    				{
    					"type" : "ucn"
    				},
    				"index" : 1,
    				"locked_height_range" : 0,
    				"script" : "dup hash160 [ e65032659d90b0c770f649a385949001f6a4ddfd ] equalverify checksig",
    				"value" : 19999930000
    			}
    		],
    		"version" : "4"
    	}
    ]
    
    

  • showtx

    Get the information of specified transaction.

    • Parameters (positional)
    1. JSON Json/Raw format, default is '--json=true'.
    2. HASH The Base16 transaction hash of the transaction to get. If not specified the transaction hash is read from STDIN.
    • Example
    $ uc-cli showtx 1362c7e68badbed8837d5ae6b9022c92df4ba50b06aae488582e0ca6475aad94
    {
    	"hash" : "1362c7e68badbed8837d5ae6b9022c92df4ba50b06aae488582e0ca6475aad94",
    	"height" : 65041,
    	"inputs" : 
    	[
    		{
    			"address" : "UiyoSgUnCbfSFVKcufwMZALVMURmiEfswq",
    			"previous_output" : 
    			{
    				"hash" : "664527536c5016c48b92b3b26f358eed01a06759b51393f2e4f213e35700025e",
    				"index" : 1
    			},
    			"script" : "[ 3045022100ccbc075db7ba3bf35ceb815add70f6c8586ca2b49ccc8e86079eeb5304029b3e0220515026d70dbfde16e9dc413ec8d4389d107c1c10184fe6634e80fcd42e3defa401 ] [ 03bec77692da62f861065c04d09de5b217c14be033453a9235a1c67853cccf3ea9 ]",
    			"sequence" : 4294967295
    		}
    	],
    	"lock_time" : "0",
    	"outputs" : 
    	[
    		{
    			"address" : "38fZvvVpYCKjtq3i7m1rsYffSQDBK97ktZ",
    			"asset" : 
    			{
    				"type" : "ucn"
    			},
    			"index" : 0,
    			"locked_height_range" : 0,
    			"script" : "hash160 [ 4c82c42ad2fd65e9fbc98688df20e56b99818f89 ] equal",
    			"value" : 10000
    		},
    		{
    			"address" : "UiyoSgUnCbfSFVKcufwMZALVMURmiEfswq",
    			"asset" : 
    			{
    				"type" : "ucn"
    			},
    			"index" : 1,
    			"locked_height_range" : 0,
    			"script" : "dup hash160 [ e65032659d90b0c770f649a385949001f6a4ddfd ] equalverify checksig",
    			"value" : 19999930000
    		}
    	],
    	"version" : "4"
    }
    
    

  • showtxs

    List transactions details of this wallet.

    • Parameters (named)
    1. -a or [--address] Address.
    2. -e or [--height] Get tx according height. eg: -e start-height:end-height will return tx between [start-height, end-height)
    3. -i or [--index] Page index.
    4. -l or [--limit] Transaction count per page.
    5. -s or [--symbol] Asset symbol.
    • Parameters (positional)
    1. WALLET_NAME Wallet name.
    2. WALLET_AUTH Wallet password/authorization.
    • Example
    $ uc-cli showtxs -e 34:36 tony4 123456 
    {
    	"current_page" : 1,
    	"total_page" : 1,
    	"transaction_count" : 2,
    	"transactions" : 
    	[
    		{
    			"direction" : "send",
    			"hash" : "6d3fd8d722dc239f2e172066ec8376322f875ebe8477b34ce5b1918b8980f84a",
    			"height" : 35,
    			"inputs" : 
    			[
    				{
    					"address" : "UXFQvGKWh8GzEtV1RNw2Vo1abnynPy58u1",
    					"script" : "[ 3045022100ecd1c34c4d86092381e8f371592d186568ad74c994c67358a10377eddc8ce95902206aadb12f0175e2cda067f5460a892055328a966371f1d6a87db5590aa3224c3601 ] [ 026c05f0fe5306fc9c5282600f09305199da99664a6a90f430b59fae8b09cc7aeb ]"
    				}
    			],
    			"outputs" : 
    			[
    				{
    					"address" : "UXFQvGKWh8GzEtV1RNw2Vo1abnynPy58u1",
    					"asset" : 
    					{
    						"decimal_number" : 1,
    						"quantity" : 35,
    						"symbol" : "BLOCK",
    						"type" : "token-transfer"
    					},
    					"locked_height_range" : 0,
    					"own" : true,
    					"script" : "dup hash160 [ 65a28a57f631d6d6da1a0036e72942a60b95743d ] equalverify checksig",
    					"ucn_value" : 0
    				}
    			],
    			"timestamp" : 1543374062
    		},
    		{
    			"direction" : "send",
    			"hash" : "2ce8a253fa3357789db2f2b6a5841b8a2f35b238f70d72d2f2a8164e055e2e7f",
    			"height" : 34,
    			"inputs" : 
    			[
    				{
    					"address" : "UXFQvGKWh8GzEtV1RNw2Vo1abnynPy58u1",
    					"script" : "[ 3045022100f0489577c36c3d1bb4a194b561f352256103e512606d74b084dc89fef4a6c3ee0220290897cd06b319ccf6920dac3e5c10db0494ff875cc22e32f6532777fbe5473b01 ] [ 026c05f0fe5306fc9c5282600f09305199da99664a6a90f430b59fae8b09cc7aeb ]"
    				}
    			],
    			"outputs" : 
    			[
    				{
    					"address" : "UXFQvGKWh8GzEtV1RNw2Vo1abnynPy58u1",
    					"asset" : 
    					{
    						"decimal_number" : 1,
    						"quantity" : 34,
    						"symbol" : "BLOCK",
    						"type" : "token-transfer"
    					},
    					"locked_height_range" : 0,
    					"own" : true,
    					"script" : "dup hash160 [ 65a28a57f631d6d6da1a0036e72942a60b95743d ] equalverify checksig",
    					"ucn_value" : 0
    				}
    			],
    			"timestamp" : 1543374061
    		}
    	]
    }