Bitcoin Forum
May 24, 2024, 11:56:35 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: ccminer api usage  (Read 1525 times)
duffann (OP)
Full Member
***
Offline Offline

Activity: 178
Merit: 102


View Profile
September 04, 2017, 05:13:32 PM
 #1

Hello,

I use this command at the end of the bat :
-b 127.0.0.1:4068

When I try 127.0.0.1:4068 on my browser i get :
ERR_EMPTY_RESPONSE on chrome.

How can i access the api , i can reach api easily with ebwf but not with ccminer.

thanks
car1999
Full Member
***
Offline Offline

Activity: 350
Merit: 100


View Profile
September 06, 2017, 08:04:54 AM
 #2

use websocket to consume the api, there is an example under api folder in the source code.
zenono
Newbie
*
Offline Offline

Activity: 22
Merit: 0


View Profile
November 07, 2017, 09:17:27 AM
 #3

I also can't use this api.

I tried -b 127.0.0.1:4068 and -b 0.0.0.0:4068

Running http://127.0.0.1:4068 or websocket.htm has no effect.
joenova
Newbie
*
Offline Offline

Activity: 17
Merit: 0


View Profile
April 13, 2018, 06:14:11 PM
 #4

did you get it to work? Im having the same issue
serg_shu
Newbie
*
Offline Offline

Activity: 1
Merit: 0


View Profile
September 24, 2018, 08:27:14 AM
 #5

Use Socket or TcpClient
kineda
Newbie
*
Offline Offline

Activity: 51
Merit: 0


View Profile
September 24, 2018, 12:16:01 PM
 #6

here is a quick python api script you can use that will export the api data as json. save it as a .py file "filename.py <ip of miner> <port for the api> <command>"  i listed the api commands you can query in the commented section.  

Code:
import socket
import sys

def get_ccminer_api_stats(miner, api_port, command):
    sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    server_address = (miner, int(api_port))
    print ("Connecting to API@" + miner + ":" + str(api_port))
    try:
        sock.connect((server_address))
        print ("Connected to API")
        sock.sendall(command)
        data = sock.recv(4096)
        data = data.replace('|\x00','')
        data_split = data.split(';')
        keys = []
        values = []
        for item in data_split:
            item_split = item.split('=')
            keys.append(item_split[0])
            values.append(item_split[1])
        api_json = {}
        i = 0
        while i < len(keys):
            api_json[keys[i]] = values[i]
            i+=1
    except Exception as err:
        api_json = {}
        if command == 'summary':
            api_json['KHS'] = 'crashed'
        
    return api_json
        
#api_commands = ['help', 'summary', 'threads', 'pool', 'histo', 'hwinfo', 'meminfo']

miner = sys.argv[1]
api_port = sys.argv[2]
command = sys.argv[3]

stats = get_ccminer_api_stats(miner, api_port, command)
print (stats)
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!