api_mining - UCHAIN-WORLD/uchain-fullnode GitHub Wiki

title: mining api

API list

  • help

    show command usage.

    • JS Parameters
     { 
       method: 'POST',  
       url: 'http://127.0.0.1:8707/rpc/v3',  
       headers:   
       {  
        'Content-Type': 'application/json'   
       },  
       body: 
       { 
         "jsonrpc": "3.0",  
         "method": "{COMMAND}",  
        "params": [ "test", "123456"],  
         "id": 7    
       },  
       json: true   
    };
    
  • Response (Example for shutdown)

    {
    "id": 7,
    "jsonrpc": "3.0",
    "result": "\nUsage: uc-cli shutdown [-h] [ADMINNAME] [ADMINAUTH]                      \n\n
    Info: stop ucd.                                                          \n\n
    Options (named):\n\n-h [--help]          Get a description and instructions for this command.\n\n
    Arguments (positional):\n\n
    ADMINNAME            admin name.                                         \n
    ADMINAUTH            admin password/authorization.                       \n"
    

}


  • startmining

    start solo mining.
    • JS Parameters
      { 
          method: 'POST',  
          url: 'http://127.0.0.1:8707/rpc/v3',  
          headers:   
          {  
           'Content-Type': 'application/json'   
          },  
          body: 
            { 
                      "jsonrpc": "3.0",  
                      "method":"startmining",
                      "params":[
                	"snake02",
         	       "123456",
                     "UcuW7wVu198Nuzok8eeMDUNEZQoGqQRRz5"
                    ],
                 "id": 7   
                  },  
          json: true   
       };
    
    • Response
    {
    "id" : 7,
    "jsonrpc" : "3.0",
    "result" : "solo mining started at UcuW7wVu198Nuzok8eeMDUNEZQoGqQRRz5"
    }
    

`` ***

  • stopmining

    stop solo mining.
    • JS Parameters
        { 
            method: 'POST',  
            url: 'http://127.0.0.1:8707/rpc/v3',  
            headers:   
            {  
             'Content-Type': 'application/json'   
            },  
            body: 
            { 
                      "jsonrpc": "3.0",  
                  "method":"stopmining",
                  "params":[
                     "snake02",
           	  "123456"
                   ],
                  "id": 7   
                    } 
            json: true   
         };
      
      • Response
      {
      "id" : 7,
      "jsonrpc" : "3.0",
      "result" : "signal STOP sent."
      }
      
      

``


  • showminers

    list miners .

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

``