api_candidates - UCHAIN-WORLD/uchain-fullnode GitHub Wiki

title: candidates api

Command list


  • registercandidate

    • JS Parameters
     { 
       method: 'POST',  
       url: 'http://127.0.0.1:8707/rpc/v3',  
       headers:   
       {  
        'Content-Type': 'application/json'   
       },  
       body: 
       { 
         "jsonrpc": "3.0",  
         "method": "registercandidate",  
        "params": [ "tony4", "123456",
    		"[email protected]",
    		"192.168.16.168:5682"],  
         "id": 7    
       },  
       json: true   
    };
    
  • Response

    {
    "id" : 7,
    "jsonrpc" : "3.0",
    "result":
    {
    "hash" : "0cd0f54a3aa4c2677dfe88ac016903a387c76b606e8b79455548e00a6e0c8079",
    "inputs" : 
    [
    	{
    		"address" : "UfEUeYUPL8pNW7g8taDQKbHjuawSwFJXiX",
    		"previous_output" : 
    		{
    			"hash" : "944c4c6189528775c3b0f67df3b4599334ea1dc4abcb015fe63316479cf50a93",
    			"index" : 0
    		},
    		"script" : "[ 304402205a880b9bdcb30c9677cdba1c144c2bfaa02440f4c1b70b63d5a4b7c04675d581022069297fbdb56a639346ca7ef7ce8ddf1ed37486445c6479f3336d1cd5ff8ac51901 ] [ 02328a6c43d56baa8ed09abbac7b5fdf59ea7b79ea3321c643db590b2984d797d3 ]",
    		"sequence" : 4294967295
    	}
    ],
    "lock_time" : "0",
    "outputs" : 
    [
    	{
    		"address" : "UfEUeYUPL8pNW7g8taDQKbHjuawSwFJXiX",
    		"asset" : 
    		{
    			"address" : "UfEUeYUPL8pNW7g8taDQKbHjuawSwFJXiX",
    			"content" : "",
    			"from_uid" : "[email protected]",
    			"status" : "registered",
    			"symbol" : "192.168.16.168:5682",
    			"type" : "candidate"
    		},
    		"index" : 0,
    		"locked_height_range" : 0,
    		"script" : "dup hash160 [ bd363e5463bd682d1ba7dfa174150db344865597 ] equalverify checksig",
    		"value" : 0
    	},
    	{
    		"address" : "UfEUeYUPL8pNW7g8taDQKbHjuawSwFJXiX",
    		"asset" : 
    		{
    			"to_uid" : "[email protected]",
    			"type" : "ucn"
    		},
    		"index" : 1,
    		"locked_height_range" : 41472000,
    		"script" : "[ 00d07802 ] numequalverify dup hash160 [ bd363e5463bd682d1ba7dfa174150db344865597 ] equalverify checksig",
    		"value" : 50000000000000
    	}
    ],
    "version" : "4"
    }
    }
    
    

  • transfercandidate

    • JS Parameters
     { 
       method: 'POST',  
       url: 'http://127.0.0.1:8707/rpc/v3',  
       headers:   
       {  
        'Content-Type': 'application/json'   
       },  
       body: 
       { 
         "jsonrpc": "3.0",  
         "method": "transfercandidate",  
        "params": [ "yang", "123456",
    			    "[email protected]",
    			    "192.168.16.160:5682"],  
         "id": 7    
       },  
       json: true   
    };
    
  • Response

    {
    "id" : 7,
    "jsonrpc" : "3.0",
    "result":
    {
    "hash" : "23245c98ad0201ac9aafbdd2f97ad7c2b608efcc65d18c1a10d9eb0e0001bc48",
    "inputs" : 
    [
    	{
    		"address" : "UXFQvGKWh8GzEtV1RNw2Vo1abnynPy58u1",
    		"previous_output" : 
    		{
    			"hash" : "39a1fb7e9c2c72b08038e9810ae655d1037f3992e2bd013c500a16669765ea94",
    			"index" : 2
    		},
    		"script" : "[ 3045022100dcf46e0ffadbe396034c5d6e80fd805901f20cf307940b4d0b943339940c16af0220346a1efa2a68cae102fd0bcce80839de8a2e658514de1038935265b59a0f0bd401 ] [ 026c05f0fe5306fc9c5282600f09305199da99664a6a90f430b59fae8b09cc7aeb ]",
    		"sequence" : 4294967295
    	},
    	{
    		"address" : "UXFQvGKWh8GzEtV1RNw2Vo1abnynPy58u1",
    		"previous_output" : 
    		{
    			"hash" : "39a1fb7e9c2c72b08038e9810ae655d1037f3992e2bd013c500a16669765ea94",
    			"index" : 0
    		},
    		"script" : "[ 304402207bc6998e0239ebf1967e21ff5e70feaee94f6502d99cf6913b4c8e46905cbf2b02204976dedccfb84c9360918fbdbe67c7cdf9736a336b1150fd4cdd9e6fc2f3109801 ] [ 026c05f0fe5306fc9c5282600f09305199da99664a6a90f430b59fae8b09cc7aeb ]",
    		"sequence" : 4294967295
    	}
    ],
    "lock_time" : "0",
    "outputs" : 
    [
    	{
    		"address" : "UfEUeYUPL8pNW7g8taDQKbHjuawSwFJXiX",
    		"asset" : 
    		{
    			"address" : "UfEUeYUPL8pNW7g8taDQKbHjuawSwFJXiX",
    			"status" : "transfered",
    			"symbol" : "192.168.16.160:5682",
    			"to_uid" : "[email protected]",
    			"type" : "candidate"
    		},
    		"index" : 0,
    		"locked_height_range" : 0,
    		"script" : "dup hash160 [ bd363e5463bd682d1ba7dfa174150db344865597 ] equalverify checksig",
    		"value" : 0
    	},
    	{
    		"address" : "UXFQvGKWh8GzEtV1RNw2Vo1abnynPy58u1",
    		"asset" : 
    		{
    			"type" : "ucn"
    		},
    		"index" : 1,
    		"locked_height_range" : 0,
    		"script" : "dup hash160 [ 65a28a57f631d6d6da1a0036e72942a60b95743d ] equalverify checksig",
    		"value" : 49873999600000
    	}
    ],
    "version" : "4"
    }
    }
    
    

  • showcandidates

    • JS Parameters
     { 
       method: 'POST',  
       url: 'http://127.0.0.1:8707/rpc/v3',  
       headers:   
       {  
        'Content-Type': 'application/json'   
       },  
       body: 
       { 
         "jsonrpc": "3.0",  
         "method": "showcandidates",  
        "params": [],  
         "id": 7    
       },  
       json: true   
    };
    
  • Response

    {
    "id" : 7,
    "jsonrpc" : "3.0",
    "result":
    [
    {
    	"address" : "UXFQvGKWh8GzEtV1RNw2Vo1abnynPy58u1",
    	"content" : "",
    	"height" : 89,
    	"status" : "registered",
    	"symbol" : "192.168.16.160:5682",
    	"timestamp" : 1545656955,
    	"to_uid" : ""
    },
    {
    	"address" : "UfEUeYUPL8pNW7g8taDQKbHjuawSwFJXiX",
    	"content" : "",
    	"height" : 63,
    	"status" : "registered",
    	"symbol" : "192.168.16.167:5682",
    	"timestamp" : 1545656692,
    	"to_uid" : ""
    },
    {
    	"address" : "UfEUeYUPL8pNW7g8taDQKbHjuawSwFJXiX",
    	"content" : "",
    	"height" : 49,
    	"status" : "registered",
    	"symbol" : "192.168.16.168:5682",
    	"timestamp" : 1545656629,
    	"to_uid" : ""
    }
    ]
    }
    
    
    

  • showcandidate

    • JS Parameters
     { 
       method: 'POST',  
       url: 'http://127.0.0.1:8707/rpc/v3',  
       headers:   
       {  
        'Content-Type': 'application/json'   
       },  
       body: 
       { 
         "jsonrpc": "3.0",  
         "method": "showcandidate",  
        "params": ["192.168.16.160:5682"],  
         "id": 7    
       },  
       json: true   
    };
    
  • Response

    {
    "id" : 7,
    "jsonrpc" : "3.0",
    "result":
    {
    "address" : "UXFQvGKWh8GzEtV1RNw2Vo1abnynPy58u1",
    "content" : "",
    "height" : 89,
    "status" : "registered",
    "symbol" : "192.168.16.160:5682",
    "timestamp" : 1545656955,
    "to_uid" : ""
    }
    }