Bitcoin Forum
October 18, 2018, 02:47:28 PM *
News: Make sure you are not using versions of Bitcoin Core other than 0.17.0 [Torrent], 0.16.3, 0.15.2, or 0.14.3. More info.
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: ccminer api usage  (Read 1362 times)
duffann
Full Member
***
Offline Offline

Activity: 152
Merit: 100


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
1539874048
Hero Member
*
Offline Offline

Posts: 1539874048

View Profile Personal Message (Offline)

Ignore
1539874048
Reply with quote  #2

1539874048
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1539874048
Hero Member
*
Offline Offline

Posts: 1539874048

View Profile Personal Message (Offline)

Ignore
1539874048
Reply with quote  #2

1539874048
Report to moderator
1539874048
Hero Member
*
Offline Offline

Posts: 1539874048

View Profile Personal Message (Offline)

Ignore
1539874048
Reply with quote  #2

1539874048
Report to moderator
1539874048
Hero Member
*
Offline Offline

Posts: 1539874048

View Profile Personal Message (Offline)

Ignore
1539874048
Reply with quote  #2

1539874048
Report to moderator
car1999
Full Member
***
Offline Offline

Activity: 336
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: 15
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: 33
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:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!