Bitcoin Forum
May 27, 2024, 05:34:41 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
  Home Help Search Login Register More  
  Show Posts
Pages: « 1 2 3 4 5 6 7 8 9 10 11 [12] 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 »
221  Alternate cryptocurrencies / Mining (Altcoins) / Re: Under-overclock image for A2 Innosilicon by Emdje - Extranonce support - V4.0 on: June 02, 2015, 08:12:20 AM

only blue light and one light on side of plate on top of blade.

about logs. tried your image but wasnt lucky.

on image that was installed was reporting no device.

If you look closely on the blades you will see LED's that are marked LED_UA4 - LED_UA3 ...... to LED_UB1. These LED's indicate if the chip is properly working. When blinking they are noticed by the software but not running yet, when they are not blinking they are hashing and when they are off there not working.
222  Alternate cryptocurrencies / Mining (Altcoins) / Re: Under-overclock image for A2 Innosilicon by Emdje - Extranonce support - V4.0 on: June 02, 2015, 06:38:42 AM
Understood, I will have a look later this week to see if I can help you.
Cgminer is started using a Bash Script, which you can see in the index file.
223  Alternate cryptocurrencies / Mining (Altcoins) / Re: Under-overclock image for A2 Innosilicon by Emdje - Extranonce support - V4.0 on: June 01, 2015, 08:54:59 PM
I get NO DEVICE RUNNING
any idea why? is my A2 broken?
got it today:(

Could you post the logs?

If you don't know how: First ssh into the miner: https://www.youtube.com/watch?v=L4iyDFsepxI
second: open the file explorer, than navigate to the /var/www folder and open copy the cgminer.log

And, are the lights on the blade blinking when you start the machine? Or are they burning continiously?
224  Alternate cryptocurrencies / Mining (Altcoins) / Re: Under-overclock image for A2 Innosilicon by Emdje - Extranonce support - V4.0 on: June 01, 2015, 02:54:38 PM
If you have a spare card I would burn a new one and try it with that.
Cgminer is started from the /var/www folder

About your log, your second log should start like the first one you posted.

Hope it helps
225  Alternate cryptocurrencies / Mining (Altcoins) / Re: [AlcheMiner] Limited Special Sale: US $599 only for Alchemist 256!!! on: May 31, 2015, 08:23:39 AM
Limited Special Sale: US $599 only for Alchemist 256!!!
 
As our hosting contract ends, we have ~ 30 units of Alchemists for special sale with limited quantity!
They were used for merely a month, look brand new, and are still very robust!
 
-          US $599 per used Alchemist ( + $260 shipping fee)
-          Used for a month
-          Two-month warranty
-          Limited quantity: 30 units only
 
Seize this unbelievable opportunity! Happy mining!!!

More detail, please find https://www.alcheminer.com

I'll buy two if you put the source code for the firmware, data sheet for the asic, and a block diagram of the system layout on your web site.

If you want to keep that information proprietary I will be happy to do a firmware development in exchange for hardware.

I have seen the source code of the miner, you can just ssh into it and change it. Is written in Python (to large to copy, paste so just part of it):
Code:
#! /usr/bin/python

import time
import json
import base64
import httplib
import sys
import os
import os.path
import binascii
import subprocess
from crypt import crypt
import rdf022
import Queue
from serial import Serial
from threading import Thread, Event
from config import ArgsConfig, AsicConfig
from autobahn.twisted.websocket import WebSocketServerFactory, WebSocketServerProtocol
from twisted.internet import reactor
from twisted.internet.task import LoopingCall
from twisted.internet.serialport import SerialPort
from twisted.protocols.basic import LineReceiver
import binascii
import socket
import requests
from requests.auth import HTTPBasicAuth

VERSION = '1.1.4'

#------- hw.py --------
#from serial import Serial
#import subprocess
#from time import sleep
#import binascii

MAX_BOARDS = 8
MAX_CHIPS = 32
MAX_CLUSTERS = 6
MAX_CORES = 9

g_tail = '00000000000000000000000000000000a78e0100000001000000f615f7ce3b4fc6b8f61e8f89aedb1d0852507650533a9e3b10b9bbcc30639f279fcaa86746e1ef52d3edb3c4ad8259920d509bd073605c9bf1d59983752a6b06b817bb4ea78e011d012d59d4'

class AsicBoard(object):

    def __init__(self, com_port, reset_gpio, prt):
        self.comport_mode = 0               # comport_mode: 0 for synchronous, 1 for asynchronous
        self.com_port = com_port
        self.reset_gpio = reset_gpio
        self.prt = prt
        self.asic = \
        {
            '00': {'00':0x0000, '01':0x0000, '02':0x0000, '03':0x0000, '04':0x0000, '05':0x0000},
            '01': {'00':0x0000, '01':0x0000, '02':0x0000, '03':0x0000, '04':0x0000, '05':0x0000},
            '02': {'00':0x0000, '01':0x0000, '02':0x0000, '03':0x0000, '04':0x0000, '05':0x0000},
            '03': {'00':0x0000, '01':0x0000, '02':0x0000, '03':0x0000, '04':0x0000, '05':0x0000},
            '04': {'00':0x0000, '01':0x0000, '02':0x0000, '03':0x0000, '04':0x0000, '05':0x0000},
            '05': {'00':0x0000, '01':0x0000, '02':0x0000, '03':0x0000, '04':0x0000, '05':0x0000},
            '06': {'00':0x0000, '01':0x0000, '02':0x0000, '03':0x0000, '04':0x0000, '05':0x0000},
            '07': {'00':0x0000, '01':0x0000, '02':0x0000, '03':0x0000, '04':0x0000, '05':0x0000},
            '08': {'00':0x0000, '01':0x0000, '02':0x0000, '03':0x0000, '04':0x0000, '05':0x0000},
            '09': {'00':0x0000, '01':0x0000, '02':0x0000, '03':0x0000, '04':0x0000, '05':0x0000},
            '0a': {'00':0x0000, '01':0x0000, '02':0x0000, '03':0x0000, '04':0x0000, '05':0x0000},
            '0b': {'00':0x0000, '01':0x0000, '02':0x0000, '03':0x0000, '04':0x0000, '05':0x0000},
            '0c': {'00':0x0000, '01':0x0000, '02':0x0000, '03':0x0000, '04':0x0000, '05':0x0000},
            '0d': {'00':0x0000, '01':0x0000, '02':0x0000, '03':0x0000, '04':0x0000, '05':0x0000},
            '0e': {'00':0x0000, '01':0x0000, '02':0x0000, '03':0x0000, '04':0x0000, '05':0x0000},
            '0f': {'00':0x0000, '01':0x0000, '02':0x0000, '03':0x0000, '04':0x0000, '05':0x0000},
            '10': {'00':0x0000, '01':0x0000, '02':0x0000, '03':0x0000, '04':0x0000, '05':0x0000},
            '11': {'00':0x0000, '01':0x0000, '02':0x0000, '03':0x0000, '04':0x0000, '05':0x0000},
            '12': {'00':0x0000, '01':0x0000, '02':0x0000, '03':0x0000, '04':0x0000, '05':0x0000},
            '13': {'00':0x0000, '01':0x0000, '02':0x0000, '03':0x0000, '04':0x0000, '05':0x0000},
            '14': {'00':0x0000, '01':0x0000, '02':0x0000, '03':0x0000, '04':0x0000, '05':0x0000},
            '15': {'00':0x0000, '01':0x0000, '02':0x0000, '03':0x0000, '04':0x0000, '05':0x0000},
            '16': {'00':0x0000, '01':0x0000, '02':0x0000, '03':0x0000, '04':0x0000, '05':0x0000},
            '17': {'00':0x0000, '01':0x0000, '02':0x0000, '03':0x0000, '04':0x0000, '05':0x0000},
            '18': {'00':0x0000, '01':0x0000, '02':0x0000, '03':0x0000, '04':0x0000, '05':0x0000},
            '19': {'00':0x0000, '01':0x0000, '02':0x0000, '03':0x0000, '04':0x0000, '05':0x0000},
            '1a': {'00':0x0000, '01':0x0000, '02':0x0000, '03':0x0000, '04':0x0000, '05':0x0000},
            '1b': {'00':0x0000, '01':0x0000, '02':0x0000, '03':0x0000, '04':0x0000, '05':0x0000},
            '1c': {'00':0x0000, '01':0x0000, '02':0x0000, '03':0x0000, '04':0x0000, '05':0x0000},
            '1d': {'00':0x0000, '01':0x0000, '02':0x0000, '03':0x0000, '04':0x0000, '05':0x0000},
            '1e': {'00':0x0000, '01':0x0000, '02':0x0000, '03':0x0000, '04':0x0000, '05':0x0000},
            '1f': {'00':0x0000, '01':0x0000, '02':0x0000, '03':0x0000, '04':0x0000, '05':0x0000}
        }
        self.good_cores = 0
        self.bad_cores = 0

    def set_comport_sync_mode(self):
        self.comport_mode = 0

    def set_comport_async_mode(self):
        self.comport_mode = 1

    def write_by_hex(self, data):
        if (self.comport_mode == 0):
            self.com_port.write(data.decode('hex')[::-1])
        else:
            reactor.callFromThread(AlcheProtocol.sendLine, self.prt, data.decode('hex')[::-1])

    def reset(self):
        return subprocess.call(['sh', 'reset_board', self.reset_gpio], shell=False)

    def flush(self, count):
        resp = self.com_port.read(count)               # max 10 bytes x 32 chips x 6 cluster = 1920 bytes
        while len(resp) > 0:
            resp = self.com_port.read(count)

    # setup all asics to run on PLL @ 360Mhz
    def set_pll(self):
        for chp in sorted(self.asic):
            payload = '%s'%chp + 'ff000100000000400c00' + g_tail
            self.write_by_hex(payload)
            time.sleep(0.02)
            payload = '%s'%chp + 'ff0001000000a0620c00' + g_tail
            self.write_by_hex(payload)
            time.sleep(0.02)
            payload = '%s'%chp + 'ff0001000000a0220400' + g_tail
            self.write_by_hex(payload)
            time.sleep(0.02)
            payload = '%s'%chp + 'ff0001000000a0220000' + g_tail
            self.write_by_hex(payload)
            ''' # Overdrive 10%
            payload = '%s'%chp + 'ff000100000000400c00' + g_tail
            self.write_by_hex(payload)
            time.sleep(0.02)
            payload = '%s'%chp + 'ff000100000060410c00' + g_tail
            self.write_by_hex(payload)
            time.sleep(0.02)
            payload = '%s'%chp + 'ff000100000060110400' + g_tail
            self.write_by_hex(payload)
            time.sleep(0.02)
            payload = '%s'%chp + 'ff000100000060110000' + g_tail
            self.write_by_hex(payload)
            '''
    def set_all_idle(self):
        payload = 'ffff0001000000a0220200' + g_tail
        self.write_by_hex(payload)

    def set_all_active(self):
        payload = 'ffff0001000000a0220000' + g_tail
        self.write_by_hex(payload)

    def calc_asic_cores(self, scan):
        self.good_cores = 0
        self.bad_cores = 0

        if scan:
            for chp in sorted(self.asic):
                for clst in self.asic[chp]:
                    self.asic[chp][clst] = 0x0000
            for chp in sorted(self.asic):
                print 'Scanning ASIC %s...' % chp
                # set diagnosis mode
                payload = chp + 'ff0001000000a0220100' + g_tail
                self.write_by_hex(payload)
                # give golden sample work, expect 'ecff6386ebd9'
                # (chp | 0x80) only for diagnosis mode -- allow all answers get returned
                cc = '%02x' % (int(chp, 16) + 128)
                payload = cc + '0000000000000000000000000000000000000000000000000000a78e0100000001000000f615f7ce3b4fc6b8f61e8f89aedb1d0852507650533a9e3b10b9bbcc30639f279fcaa86746e1ef52d3edb3c4ad8259920d509bd073605c9bf1d59983752a6b06b817bb4ea78e011d012d59d4'
                self.write_by_hex(payload)
                cnt = 0
                while True:
                    resp = self.com_port.read(9)
                    if len(resp) == 9:
                        _chpid = resp[8].encode('hex')
                        if (_chpid > '1f'):
                            print 'chpid err!'
                        _clsid = resp[7].encode('hex')
                        if (_clsid > '05'):
                            print 'clsid err!'
                        _corid = ord(resp[6])
                        if (_corid > 8):
                            print 'corid err!'
                        _nonce = resp[3::-1].encode('hex')
                        #core_status = _nonce in 'ecff6386ebd9'
                        core_status = _nonce in '6386ebd9'
                        if core_status:
                            self.good_cores += 1
                            #print 'Good: %d, %d, %d' % (_chpid, _clsid, _corid)
                            self.asic[_chpid][_clsid] |= (1 << _corid)
                        else:
                            self.bad_cores += 1
                            print 'Bad: %s, %s, %s, %d' % (_nonce, _chpid, _clsid, _corid)

                        cnt = 0
                    cnt += 1
                    if (cnt > 5):
                        break
        else:
            #print self.asic
            for _chpid in self.asic:
                for _clsid in self.asic[_chpid]:
                    mask = 0x0100
                    while mask > 0:
                        if ((self.asic[_chpid][_clsid] & mask) != 0):
                            self.good_cores += 1
                        else:
                            self.bad_cores += 1
                        mask >>= 1

    def config_workspace(self, start_of_nonce, multiple):
        n_offset = start_of_nonce
        for chp in sorted(self.asic):
            # setup nonce incremental = 0x0001
            payload = ('%s' % chp) + 'ff0001000000a0220000' + g_tail
            time.sleep(0.01)
            self.write_by_hex(payload)

            for clst in sorted(self.asic[chp]):
                gc = 0
                offset = '%08x' % n_offset
                cores = '%04x' % self.asic[chp][clst]
                payload = '%sfe%s%s%s' % \
                          (chp, clst, \
                           offset.decode('hex')[::-1].encode('hex'), \
                           cores.decode('hex')[::-1].encode('hex')) + \
                          '00'*104
                self.write_by_hex(payload)
                #print '>>> %s' % payload
                core_mask = self.asic[chp][clst]
                for i in range(0, 15, 1):
                    if (core_mask & 0x0001):
                        gc += 1
                    core_mask >>= 1
                n_offset += multiple * gc


    def rev_per_4bytes(self, data):
        x = ''
        for i in range (0, len(data), 8):
            x += data[i+6:i+8] + data[i+4:i+6] + data[i+2:i+4] + data[i:i+2]
        return x

    def give_work(self, chip, target, block):
        header_hex = self.swap4(block[0:160])
        payload = chip + target + header_hex
        #self.write_by_hex(payload)
        return payload.decode('hex')[::-1]

    def swap4(self, binascii_str):
        str = binascii.unhexlify(binascii_str)
        x = len(str) / 4
        rev = ''.join([ str[i*4:i*4+4][::-1] for i in range(0, x) ])
        return binascii.hexlify(rev)

    def revall(self, binascii_str):
        str = binascii.unhexlify(binascii_str)
        rev = str[::-1]
        return binascii.hexlify(rev)



#------- hw.py --------

SUBMIT_Q_THROTTLE = 30
WEB_REFRESH_TIME = 5
LCM_REFRESH_TIME = 5
REFRESH_KHRATE_TIME = 5
STRATUM_CHK_INTERVAL = 30

rst = {'00':None, '01':None, '02':None, '03':None, '04':None, '05':None, '06':None, '07':None}
com = {'00':None, '01':None, '02':None, '03':None, '04':None, '05':None, '06':None, '07':None}
brd = {'00':None, '01':None, '02':None, '03':None, '04':None, '05':None, '06':None, '07':None}
pool_ctrl = {'00':None, '01':None, '02':None, '03':None, '04':None, '05':None, '06':None, '07':None}
alche_protocol = {'00':None, '01':None, '02':None, '03':None, '04':None, '05':None, '06':None, '07':None}
ans_queue = {'00':None, '01':None, '02':None, '03':None, '04':None, '05':None, '06':None, '07':None}

active_brd_num = 0
active_brd = []

miner_ctrl = Event()
for p in pool_ctrl:
    pool_ctrl[p] = Event()
submitter_ctrl = Event()
stat_reset = Event()

stratum_proxy_isRunning = False
ws_client = []

lcm = rdf022.get_lcm()
def lcm_disp(msg):
    msgs = ('IP:'+rdf022.get_ip(), msg)
    lcm.messages = msgs
    lcm.refresh()

class CoinRPC(object):
    def __init__(self, host, port, username, password):
        self.host = host
        self.port = port
        self.username = username
        self.password = password
        self.url = 'http://' + self.host + ':' + self.port

    def reconnect(self, host, port, username, password):
        self.host = host
        self.port = port
        self.username = username
        self.password = password        
        self.url = 'http://' + self.host + ':' + self.port

    def getwork(self, data=None):
        payload = { 'version':'1.1', 'method':'getwork', 'params':[], 'id':'1' }

        payload['params'] = ([] if (data is None) else data)

        try:
            r = requests.post(self.url, \
                                auth=HTTPBasicAuth(self.username, self.password), \
                                data=json.dumps(payload), \
                                timeout=30)
            resp = r.json()
            if (resp['error'] is not None):
                print '-- RPC error!'
                print r.text
                return None
            else:
                return resp['result']

        except requests.ConnectionError:
            print '-- HTTP connection error!'
            return None

        except requests.Timeout:
            print '-- HTTP connection timeout!'
            return None

        except Exception as e:
            print '-- RPC general error!'
            print e
            return None

class Submitter(Thread):
    def __init__(self):
        Thread.__init__(self)
        self.daemon = True
        self.coin_rpc = CoinRPC(config.host, config.port, config.username, config.password)

    def run(self):
        while True:
            if submitter_ctrl.isSet():
                submitter_ctrl.clear()

            (bid, data, target, nonce_bin) = submit_queue.get()
            print '  -- Q (%d) --' % submit_queue.qsize()
            nonce = nonce_bin[::-1].encode('hex')
            solution = data[:152] + nonce + data[160:256]
            param_arr = [ solution ]

            submit_result = None
            for i in range(5):
                submit_result = self.coin_rpc.getwork(param_arr)
                if (submit_result is not None):
                    hash_queue.put((bid, submit_result, target, nonce_bin))
                    break
                else:
                    self.coin_rpc.reconnect(config.host, config.port, config.username, config.password)
                    print '** submit reconnect... **'
                    time.sleep(0.1)

            submit_queue.task_done()
            time.sleep(0.05)

class AlcheProtocol(LineReceiver):
    def __init__(self, bid):
        self.bid = bid
        self._busyReceiving = False
        self._buffer = b''

    def connectionMade(self):
        print self.bid + ' connected in AlcheProtocol.'
        #self.delimiter = b''

    def sendLine(self, line):
        return self.transport.write(line)

    def dataReceived(self, data):
        if self._busyReceiving:
            self._buffer += data
            return
        try:
            self._busyReceiving = True
            self._buffer += data
            while self._buffer and not self.paused:
                if (len(self._buffer) >= 9):
                    line = self._buffer[0:9]
                    self._buffer = self._buffer[9:]
                    why = self.ansReceived(line)
                    if (why or self.transport and self.transport.disconnecting):
                        return why
                else:
                    return
        finally:
            self._busyReceiving = False  

    def ansReceived(self, data):
        ans_queue[self.bid].put(data)

class Miner(Thread):
    def __init__(self, bid, board, arg_config, alcheprotocol):
        Thread.__init__(self)
        self.bid = bid
        self.daemon = True
        self.brd = board
        self.config = arg_config
        self.time_start = time.time()
        self.work_timeout = 3
        self.targetstr = ''
        self.diff = 1
        self.alche_protocol = alcheprotocol
        self.coin_rpc = CoinRPC(config.host, config.port, config.username, config.password)

    def do_work(self, datastr, targetstr):
        if (targetstr != self.targetstr):
            self.targetstr = targetstr
            self.diff = 0x0000ffff00000000 / long(targetstr[48:64].decode('hex')[::-1].encode('hex'), 16)
            #self.work_timeout = self.diff * 65536 / 1000000 / 32
            self.work_timeout = self.diff * 3.54 / brd[self.bid].good_cores
            if (self.work_timeout < 8):
                self.work_timeout = 8
        t = '0' * 48 + targetstr[48:64]
        payload = self.brd.give_work('ff', t, datastr)
        print '--(%s)-- diff: %0.2f, work_timeout: %0.2f' % (self.bid, self.diff, self.work_timeout)
        self.time_start = time.time()
        reactor.callFromThread(AlcheProtocol.sendLine, self.alche_protocol, payload)

        try:
            data = ans_queue[self.bid].get(timeout=self.work_timeout)
            dt = time.time() - self.time_start
            if (data == 'ffffffffffffffffff'):
                print '==(%s)== clean job! <%0.2f>' % (self.bid, dt)
                com_resp = ''
            else:
                print '==(%s)== %s <%0.2f>' % (self.bid, data.encode('hex'), dt)
                com_resp = data
        except Queue.Empty:
            com_resp = ''

        return com_resp[:4]

    def iterate(self):
        work = None
        for i in range(5):
            work = self.coin_rpc.getwork()
            if (work is not None):
                break
        if work is None:
            print 'ERR: Work is None'
            return False

        nonce_bin = self.do_work(work['data'], work['target'])

        if len(nonce_bin) == 4:
            submit_queue.put((self.bid, work['data'], work['target'], nonce_bin))
            if (submit_queue.qsize() > SUBMIT_Q_THROTTLE):
                print '...Nap for %0.2f sec...' % (active_brd_num * submit_queue.qsize() / SUBMIT_Q_THROTTLE)
                time.sleep(active_brd_num * submit_queue.qsize() / SUBMIT_Q_THROTTLE)

        return True

    def run(self):

        iterate_result = False

        while True:
            miner_ctrl.wait()
            if pool_ctrl[self.bid].isSet():
                iterate_result = False
                pool_ctrl[self.bid].clear()
            if (iterate_result == False):
                self.coin_rpc.reconnect(config.host, config.port, config.username, config.password)
            iterate_result = self.iterate()

class Stat(Thread):
    def __init__(self):
        Thread.__init__(self)
        self.daemon = True
        self.acc_kh = {'00':0.00, '01':0.00, '02':0.00, '03':0.00, '04':0.00, '05':0.00, '06':0.00, '07':0.00}
        self.khrate = {'00':0.00, '01':0.00, '02':0.00, '03':0.00, '04':0.00, '05':0.00, '06':0.00, '07':0.00, 'accepted':0, 'rejected':0, 'since':0}
        self.total_accepted = 0
        self.total_rejected = 0
        self.miner_stt_time = time.time()
        self.reset_stt_time()

    def reset_stt_time(self):
        self.miner_stt_time = time.time()
        self.khrate['since'] = self.miner_stt_time

    def reset_stat(self):
        for b in ['00', '01', '02', '03', '04', '05', '06', '07']:
            self.acc_kh[b] = 0.00
            self.khrate[b] = 0.00
        self.khrate['accepted'] = 0
        self.khrate['rejected'] = 0
        self.total_accepted = 0
        self.total_rejected = 0
        self.reset_stt_time()

    def refresh_khrate(self):
        for i in ['00', '01', '02', '03', '04', '05', '06', '07']:
            self.khrate[i] = self.acc_kh[i] / (time.time() - self.miner_stt_time)

    def run(self):
        while True:
            (bid, sr, tgt, nnc_bin) = hash_queue.get()

            diff = 0x0000ffff00000000 / long(tgt[48:64].decode('hex')[::-1].encode('hex'), 16)
            _acc_kh = self.acc_kh[bid]
            _acc_kh += diff * 65.536 * 1
            self.acc_kh[bid] = _acc_kh
            self.khrate[bid] = _acc_kh / (time.time() - self.miner_stt_time)

            if sr:
                self.total_accepted += 1
                self.khrate['accepted'] = self.total_accepted
            else:
                self.total_rejected += 1
                self.khrate['rejected'] = self.total_rejected

            hash_queue.task_done()




class StratumProxy(object):
    def __init__(self):
        self.proxy = None
        self.isRunning = False
        self.stratum_host = None
        self.stratum_port = None

    def get_params(self):
        return (self.stratum_host, self.stratum_port)

    def start(self, stratum_host, stratum_port, getwork_port, username, password):
        self.stratum_host = stratum_host
        self.stratum_port = stratum_port

        if not self.isRunning:
            if ('ghash.io' in stratum_host):
                self.proxy = subprocess.Popen(['/usr/bin/python', 'stratum-mining-proxy/mining_proxy.py', \
                                                '-o', stratum_host, '-p', stratum_port, '-gp', getwork_port , \
                                                '-cu', username, '-cp', password, '-pa', 'scrypt', \
                                                '-nm', '-q'], stdout=subprocess.PIPE, shell=False)
            else:
                self.proxy = subprocess.Popen(['/usr/bin/python', 'stratum-mining-proxy/mining_proxy.py', \
                                                '-o', stratum_host, '-p', stratum_port, '-gp', getwork_port , \
                                                '-cu', username, '-cp', password, '-pa', 'scrypt', \
                                                '-nm', '-cd', '-q'], stdout=subprocess.PIPE, shell=False)
            self.isRunning = True

    def stop(self):
        if self.isRunning:
            self.proxy.kill()
            os.wait()
            self.isRunning = False


class WebUIProtocol(WebSocketServerProtocol):
    def __init__(self):
        self.command_option = {'version': self.web_version, \
                               'login': self.web_login, \
                               'control': self.web_control, \
                               'hashrate': self.web_hashrate, \
                               'pool_config': self.web_pool_config, \
                               'host_config': self.web_host_config, \
                               'access_ctrl': self.web_access_ctrl, \
                               'upgrade': self.web_upgrade, \
                               'diag_report': self.web_diag_report, \
                               'clean_job': self.clean_job
                              }
        self.stratum_proxy = None

    def onConnect(self, request):
        print 'Connecting...'

    def onOpen(self):
        if (self.transport.getPeer().host != '127.0.0.1'):
            ws_client.append(self)
        print 'Opening...[%s]' % self.transport.getPeer().host

    def onClose(self, wasClean, code, reason):
        try:
            ws_client.remove(self)
        except ValueError:
            pass
        print 'Close...[%s]' % self.transport.getPeer().host

    def onMessage(self, data, isBinary):
        #if (data == 'hashrate'):
        #    self.sendMessage(json.dumps(global_khrate), isBinary=False)
        try:
            web_req = json.loads(data)
            if (web_req == None):
                print 'Unrecognized command!'
            mtd = web_req['method']
            self.command_option[mtd](web_req)
        except Exception, e:
            #print e
            print data
            rsp = {'result':False, 'error':'command error!' + str(e), 'id':'0'}
            print json.dumps(rsp)
            self.sendMessage(json.dumps(rsp))
            return False

    def web_version(self, req):
        ws_client.append(self)
        rsp = {'result':False, 'error':None, 'id':None}
        rsp['id'] = req['id']
        rsp['result'] = VERSION
        self.sendMessage(json.dumps(rsp))

        return

    def web_login(self, req):
        rsp = {'result':False, 'error':None, 'id':None}
        pwd = req['params'][0]
        rsp['id'] = req['id']

        f = open('access_code', 'r')
        crypted_pwd = f.readline().rstrip()
        f.close()
        #print '(%s)(%s)' % (pwd, crypted_pwd)
        if (crypt(pwd, crypted_pwd) == crypted_pwd):
            rsp['result'] = True
        else:
            rsp['result'] = False

        self.sendMessage(json.dumps(rsp))

        return

    def web_control(self, req):
        print 'control...'
        if (req['params'][0] == 'go'):
            config.read_config()
            print '>start...'
            if (config.protocol == 'stratum+tcp:'):
                stratum_host = config.host
                stratum_port = config.port
                config.host = 'localhost'
                config.port = '8332'
                # startup stratum mining proxy
                print '>startup stratum proxy...'
                stratum_proxy.start(stratum_host, stratum_port, config.port, config.username, config.password)
                time.sleep(3)
            # startup miner threads...
            miner_ctrl.set()
        else:
            # stop all miner thread
            miner_ctrl.clear()
            stat_reset.set()
            # set all board to be idle
            for b in sorted(brd):
                brd[b].set_all_idle()
            try:
                print '>stop stratum proxy...'
                stratum_proxy.stop()
            except OSError:
                pass
            # Reset stat
            stat.reset_stat()

        return

    def web_hashrate(self, req):
        print 'report_hashrate...'
        rsp = {'result':False, 'error':None, 'id':None}
        rsp['result'] = json.dumps(global_khrate)
        rsp['id'] = req['id']
        self.sendMessage(json.dumps(rsp))
        return

    def web_pool_config(self, req):
        rsp = {'result':False, 'error':None, 'id':None}

        if len(req['params']) == 0:
            config.read_config()
            rsp['result'] = [config.protocol, config.host, config.port, config.username, config.password]
            rsp['error'] = None
            rsp['id'] = req['id']
            self.sendMessage(json.dumps(rsp))
        else:
            stratum_mtr.stop()
            (protocol, host, port, username, password) = (i for i in req['params'])
            (config.protocol, config.host, config.port, config.username, config.password) = (protocol, host, port, username, password)
            cr = config.save_config()
            if (cr):
                rsp['result'] = ["ok"]
                rsp['error'] = None
                rsp['id'] = req['id']
                self.sendMessage(json.dumps(rsp))
                # Inform all thread to change pool information
                for p in pool_ctrl:
                    pool_ctrl[p].set()
                submitter_ctrl.set()

                # Reset stat
                stat.reset_stat()

                # stop all miner thread
                miner_ctrl.clear()
                stat_reset.set()
                # set all board to be idle
                for b in sorted(brd):
                    brd[b].set_all_idle()
                try:
                    print '>stop stratum proxy...'
                    stratum_proxy.stop()
                except OSError:
                    pass

                time.sleep(1)

                # start all miner thread
                if (config.protocol == 'stratum+tcp:'):
                    stratum_host = config.host
                    stratum_port = config.port
                    config.host = 'localhost'
                    config.port = '8332'
                    # startup stratum mining proxy
                    print '>startup stratum proxy...'
                    stratum_proxy.start(stratum_host, stratum_port, config.port, config.username, config.password)
                    time.sleep(3)
                # startup minter threads...
                miner_ctrl.set()
            stratum_mtr.start(STRATUM_CHK_INTERVAL)

    def web_host_config(self, req):
        rsp = {'result':False, 'error':None, 'id':None}

        if len(req['params']) == 0:
            f = open('/etc/network/interfaces', 'r')
            fif = f.readlines()
            f.close()
            binding = ''
            ipaddr = ''
            netmask = ''
            gateway = ''
            dns = ''
            fixed = False
            for i in fif:
                a = '' if i.lstrip().startswith('#') else i
                if ('dhcp' in a) and ('eth1' in a):
                    binding = 'dhcpc'
                    break
                if ('static' in a) and ('eth1' in a):
                    binding = 'fixedip'
                    fixed = True
                    continue
                if fixed:
                    aa = a.split()
                    for j in range(len(aa)):
                        if 'address' in aa[j]:
                            ipaddr = aa[j+1]
                        if 'netmask' in aa[j]:
                            netmask = aa[j+1]
                        if 'gateway' in aa[j]:
                            gateway = aa[j+1]
                        if 'dns-nameservers' in aa[j]:
                            dns = aa[j+1]
            rsp['result'] = [binding, ipaddr, netmask, gateway, dns]
            rsp['error'] = None
            rsp['id'] = req['id']
            self.sendMessage(json.dumps(rsp))
        else:
            (binding, ipaddr, netmask, gateway, dns) = (i for i in req['params'])
            f = open('/etc/network/interfaces', 'w+')
            f.write('# loopback network interface\n')
            f.write('auto lo\n')
            f.write('iface lo inet loopback\n\n')
            f.write('# primary network interface\n')
            f.write('auto eth1\n')
            if (binding == 'dhcpc'):
                f.write('iface eth1 inet dhcp\n')
            else:
                f.write('iface eth1 inet static\n')
                f.write('address ' + ipaddr + '\n')
                f.write('netmask ' + netmask + '\n')
                f.write('gateway ' + gateway + '\n')
                f.write('dns-nameservers ' + dns + '\n')
            f.close()

            rsp['result'] = ["ok"]
            rsp['error'] = None
            rsp['id'] = req['id']
            self.sendMessage(json.dumps(rsp))

            time.sleep(0.5)
            subprocess.call(['/sbin/ifdown', 'eth1'], shell=False)
            time.sleep(0.5)
            subprocess.call(['/sbin/ifup', 'eth1'], shell=False)

    def web_access_ctrl(self, req):
        rsp = {'result':False, 'error':None, 'id':None}
        print 'access_ctrl...'
        (old_password, new_password) = (req['params'][0], req['params'][1])
        f = open('access_code', 'r')
        crypted_pwd = f.readline().rstrip()
        f.close()
        if (crypt(old_password, crypted_pwd) == crypted_pwd):
            f = open('access_code', 'w')
            new_crypt = crypt(new_password, 'TomSoong')
            f.write(new_crypt + '\n')
            f.close()
            rsp['result'] = ['ok']
        else:
            rsp['result'] = ['wrong']
        rsp['id'] = req['id']
        self.sendMessage(json.dumps(rsp))

        return

    def web_upgrade(self, req):
        print 'upgrade...'
        return
-------------------------
--------------------------
--------------------------
226  Alternate cryptocurrencies / Mining (Altcoins) / Re: Under-overclock image for A2 Innosilicon by Emdje - Extranonce support - V4.0 on: May 31, 2015, 08:17:27 AM
I downloaded the latest underclocking version a few weeks back. It ran fine for a while, yesterday, it stopped. It tries to start, but exits. Sometimes it reports no A2 boards, other times, it reports no pools, and exits. /var/www/cgminer.log below 5 boards is correct, I'm pulling 1 at a time to underclock some more. I can copy cgminer into my minereu firmware card for now, but that had an annoying habit of dropping boards, which emdje firmware doesn't. I'm using same servers with minereu firmware, which runs ok. I can pull more logs if you tell me where to look. Starting manually doesn't work either. I used

sudo /var/www/cgminer -o stratum+tcp://eu-01.miningrigrentals.com:3333#xnsub -u pictsidhe.10165 -p x -o stratum+tcp://us-central01.miningrigrentals.com:3333#xnsub -u pictsidhe.10165 -p x -o stratum+tcp://us-west01.miningrigrentals.com:3333#xnsub -u pictsidhe.10165 -p x --A1Pll1 1000 --A1Pll2 1000 --A1Pll3 1100 --A1Pll4 1100 --A1Pll5 1100 --A1Pll6 1100

and sometimes it starts but can't find pools then exits, other times it finds no boards:

Code:
[2015-04-19 17:03:58] Started cgminer 3.9.0
 [2015-04-19 17:03:58] Run Reset=0
 [2015-04-19 17:03:58] SPI Speed 4000 kHz
 [2015-04-19 17:03:58] ST MCU - Disable
 [2015-04-19 17:03:58] A2 = 1000,9
 [2015-04-19 17:03:58] A2 PLL Clock = 1000MHz
 [2015-04-19 17:03:58] A2 = 1000,9
 [2015-04-19 17:03:58] A2 PLL Clock = 1000MHz
 [2015-04-19 17:03:58] A2 = 1100,8
 [2015-04-19 17:03:58] A2 PLL Clock = 1100MHz
 [2015-04-19 17:03:58] A2 = 1100,8
 [2015-04-19 17:03:58] A2 PLL Clock = 1100MHz
 [2015-04-19 17:03:58] A2 = 1100,8
 [2015-04-19 17:03:58] A2 PLL Clock = 1100MHz
 [2015-04-19 17:03:58] A2 = 1100,8
 [2015-04-19 17:03:58] A2 PLL Clock = 1100MHz
 [2015-04-19 17:03:58] GPIO CS is OFF
 [2015-04-19 17:03:59] Failure(cs0)(20): missing ACK for cmd 0x04
 [2015-04-19 17:03:59] ACK(cs0) timeout:cmd_RESET_BCAST-1.2693s
 [2015-04-19 17:03:59] No any A2 board

No any A2 board
: No such file or directory


removing #xnsub doesn't help

less /var/www/cgminer.log
Code:
 [2015-04-19 16:39:36] Found chip 1 with 54 active cores
 [2015-04-19 16:39:36] Found chip 2 with 54 active cores
 [2015-04-19 16:39:36] Found chip 3 with 54 active cores
 [2015-04-19 16:39:36] Found chip 4 with 52 active cores
 [2015-04-19 16:39:36] Found chip 5 with 54 active cores
 [2015-04-19 16:39:36] Found chip 6 with 53 active cores
 [2015-04-19 16:39:36] Found chip 7 with 54 active cores
 [2015-04-19 16:39:36] Found chip 8 with 52 active cores
 [2015-04-19 16:39:36] Found 8 chips with total 427 active cores
 [2015-04-19 16:39:37] spidev0.0(cs2): Found 8 A2 chips
 [2015-04-19 16:39:37] Found chip 1 with 54 active cores
 [2015-04-19 16:39:37] Found chip 2 with 54 active cores
 [2015-04-19 16:39:37] Found chip 3 with 54 active cores
 [2015-04-19 16:39:37] Found chip 4 with 54 active cores
 [2015-04-19 16:39:37] Found chip 5 with 54 active cores
 [2015-04-19 16:39:37] Found chip 6 with 54 active cores
 [2015-04-19 16:39:37] Found chip 7 with 54 active cores
 [2015-04-19 16:39:37] Found chip 8 with 54 active cores
 [2015-04-19 16:39:37] Found 8 chips with total 432 active cores
 [2015-04-19 16:39:38] spidev0.0(cs3): Found 8 A2 chips
 [2015-04-19 16:39:38] Found chip 1 with 54 active cores
 [2015-04-19 16:39:38] Found chip 2 with 54 active cores
 [2015-04-19 16:39:38] Found chip 3 with 54 active cores
 [2015-04-19 16:39:38] Found chip 4 with 54 active cores
 [2015-04-19 16:39:38] Found chip 5 with 54 active cores
 [2015-04-19 16:39:38] Found chip 6 with 54 active cores
 [2015-04-19 16:39:38] Found chip 7 with 54 active cores
 [2015-04-19 16:39:38] Found chip 8 with 54 active cores
 [2015-04-19 16:39:38] Found 8 chips with total 432 active cores
 [2015-04-19 16:39:39] spidev0.0(cs4): Found 8 A2 chips
 [2015-04-19 16:39:39] Found chip 1 with 54 active cores
 [2015-04-19 16:39:39] Found chip 2 with 54 active cores
 [2015-04-19 16:39:39] Found chip 3 with 54 active cores
 [2015-04-19 16:39:39] Found chip 4 with 54 active cores
 [2015-04-19 16:39:39] Found chip 5 with 54 active cores
 [2015-04-19 16:39:39] Found chip 6 with 54 active cores
 [2015-04-19 16:39:39] Found chip 7 with 54 active cores
 [2015-04-19 16:39:39] Found chip 8 with 54 active cores
 [2015-04-19 16:39:39] Found 8 chips with total 432 active cores
 [2015-04-19 16:39:40] spidev0.0(cs5): Found 8 A2 chips
 [2015-04-19 16:39:40] Found chip 1 with 54 active cores
 [2015-04-19 16:39:40] Found chip 2 with 54 active cores
 [2015-04-19 16:39:40] Found chip 3 with 53 active cores
 [2015-04-19 16:39:40] Found chip 4 with 54 active cores
 [2015-04-19 16:39:40] Found chip 5 with 54 active cores
 [2015-04-19 16:39:40] Found chip 6 with 53 active cores
 [2015-04-19 16:39:40] Found chip 7 with 54 active cores
 [2015-04-19 16:39:40] Found chip 8 with 54 active cores
 [2015-04-19 16:39:40] Found 8 chips with total 430 active cores
 [2015-04-19 16:39:40] A2 boards=5, active cores=2153, Efficient=99%, speed=61.4M
 [2015-04-19 16:39:40] Probing for an alive pool
 [2015-04-19 16:39:50] Waiting for work to be available from pools.
 [2015-04-19 16:40:40] No servers were found that could be used to get work from.
 [2015-04-19 16:40:40] Please check the details from the list below of the servers you have input
 [2015-04-19 16:40:40] Most likely you have input the wrong URL, forgotten to add a port, or have not set up workers
 [2015-04-19 16:40:40] Pool: 0  URL: stratum+tcp://eu-01.miningrigrentals.com:3333  User: pictsidhe.10165  Password: x
 [2015-04-19 16:40:40] Pool: 1  URL: stratum+tcp://us-central01.miningrigrentals.com:3333  User: pictsidhe.10165  Password: x
 [2015-04-19 16:40:40] Pool: 2  URL: stratum+tcp://us-west01.miningrigrentals.com:3333  User: pictsidhe.10165  Password: x
 [2015-04-19 16:40:40] No servers could be used! Exiting.
let me know if you need other logs, Emdje firmware is on a spare sd card so it's sitting around.

The first log reports that 'Run Reset' as well as 'ST MCU' and 'GPIO CS' are all disabled, which is very weird. That is the reason you aren't hashing in the first log, because they all should be enabled.
In the second log you don't report the first bit, so I can't say anything about that.

Did you use the complete image? Or did you only copy the new cgminer?
227  Alternate cryptocurrencies / Mining (Altcoins) / Re: Under-overclock image for A2 Innosilicon by Emdje - Extranonce support - V4.0 on: May 27, 2015, 02:16:42 PM
The first instruction video of more to come:
How to SSH into the Innosilicon A2

(click and watch to donate the views  Tongue )
228  Alternate cryptocurrencies / Mining (Altcoins) / Re: Electricity savings? on: May 26, 2015, 07:59:12 AM
Get a watt meter and measure your computer with the card mining and without.
That difference is a rough approximation of the energy usage of your card.
So adding another cards would increase you usage with that amount, roughly.
229  Alternate cryptocurrencies / Mining (Altcoins) / Re: Innosilicon A2 on Wheezy pi and Wifi? on: May 17, 2015, 08:54:21 PM
And done, needed to configure the pi as a server.  Grin
230  Alternate cryptocurrencies / Mining (Altcoins) / Re: Innosilicon A2 on Wheezy pi and Wifi? on: May 17, 2015, 08:17:22 PM
Assigned rights to the /var/www folder and the containing files. Cgminer autostarted and is hasing through WiFi so problem 1 is solved.
However I still can't reach the webpage on the IP address. Anyone?
231  Alternate cryptocurrencies / Mining (Altcoins) / Re: Innosilicon A2 on Wheezy pi and Wifi? on: May 17, 2015, 03:04:51 PM
I had put the files outside of the /var/www folder because I have issues with the permission.
So I think the problem lies in the permissions, but that is new to me.
Anyone any info on that?
232  Alternate cryptocurrencies / Mining (Altcoins) / Innosilicon A2 on Wheezy pi and Wifi? on: May 17, 2015, 10:43:05 AM
Hi guys,

I am trying to get my WiFi working on my A2 miner using the Wheezy pi image (I had troubles getting my wifi working using the original image)
But I am running into a few problems for which I hope you guys could help me.
1) cgminer does no autostart (I can start it in the terminal and works on WiFi without issue) Solved
     rc.local file:    
Code:
	#!/bin/sh -e 
sudo -i
        sleep 30
cd /home/pi/cgminer/www
./run.sh
exit 0
2) Can't reach webppage thought WiFi Ip address Solved

Anyone any ideas?
233  Alternate cryptocurrencies / Mining (Altcoins) / Re: Under-overclock image for A2 Innosilicon by Emdje - Extranonce support - V4.0 on: May 15, 2015, 08:05:18 AM
Are these new images compatible with the A2 Mega? Or is everyone overclocking the original 88 MH/s A2's? 
Unfortunately the A2 Mega uses a different board design which is not compatible with this image. I tried several times to make it work with the new A2's but I don't own one so it is very hard to try stuff out.
234  Alternate cryptocurrencies / Mining (Altcoins) / Re: Under-overclock image for A2 Innosilicon by Emdje - Extranonce support - V4.0 on: May 10, 2015, 04:58:38 PM
It's mainly a hobby for me as well.

Unrelated, the Raspberry Pi in mine let out the magic smoke, and none of the local distributors had any of the "original" RPIs in stock, so I ordered a Raspberry Pi 2.  I've modified the mounting plate to fit it and bent two of the GPIO pins back to accommodate the cable the miner uses, and it powers on, boots, etc., but doesn't seem to be able to talk to the blades.  I'll get the actual error and post it here, but it's complaining of something along the lines of "Unable to set CS pin 0x4...".  The first twenty-six GPIO pins are the same, so that's not the issue.  Any idea what's going on?

Try installing the new bcm 2835 library. Probably the one I installed on the image is not compatible with the PI 2 : http://www.airspayce.com/mikem/bcm2835/index.html
235  Alternate cryptocurrencies / Mining (Altcoins) / Re: Under-overclock image for A2 Innosilicon by Emdje - Extranonce support - V4.0 on: May 05, 2015, 08:38:39 AM
With firmware 3 is no such problem.
So prolema still in firmware instead of 4 in the pool.

Weird because I use version 4 as well and have no issues with it.

Can you post the logs, so I can take a look? Pretty hard to find the problem if I can't recreate it.


Yeah, same problem here. Sometimes when pool 0 goes off, cgminer stops mining with "no work available from pools" message. Didnt see this in earlier versions (with old stratum code). But I noticed this behaviour only with pool 0 = BetaRigs, pool 1 = mining rig rentals.

Btw, do you guys use any cgminer watcher? Since Im (from the beginning) loosing e.g. one blade in 14 days and then I need to restart manually.

Hmm two people with the same issue. Will look into it when I get back from my holliday. Most likely put in the old stratum code.
236  Alternate cryptocurrencies / Mining (Altcoins) / Re: Under-overclock image for A2 Innosilicon by Emdje - Extranonce support - V4.0 on: May 05, 2015, 08:37:40 AM
so if i want to get more hz (let's say the default is 1200, i want 1300-1350) all i have to do is to buy a stronger PSU?
the current one is 850w gold.

I would measure what the PSU draws right now. Overclock one blade, measure again and calculate if your PSU can handle it. PSU's are most effective when used intensively (but not over their limit of course). If it is not enough than you can buy another one. Or use an extra smaller one for one or two blades.
237  Alternate cryptocurrencies / Mining (Altcoins) / Re: Under-overclock image for A2 Innosilicon by Emdje - Extranonce support - V4.0 on: May 01, 2015, 10:57:47 AM
With firmware 3 is no such problem.
So prolema still in firmware instead of 4 in the pool.

Weird because I use version 4 as well and have no issues with it.

Can you post the logs, so I can take a look? Pretty hard to find the problem if I can't recreate it.
238  Alternate cryptocurrencies / Mining (Altcoins) / Re: Under-overclock image for A2 Innosilicon by Emdje - Extranonce support - V4.0 on: May 01, 2015, 07:53:17 AM
I installed 4 - version of firmware.
And now I have a problem.
When the first pool stops, Asik is not transferred to the reserve pool. but simply continues without a solution.

1) pool
stratum+tcp://eu-01.miningrigrentals.com:3333#xnsub
2) pool
stratum+tcp://stratum.nicehash.com:3333#xnsub

AVG = 5s):00.00M (avg):00.00Mh/s (pool):00.00Mh/s



I tested it out by making a typo in the first pool (so it is 'dead'), but it just continues to the backup pool with me:


I do see you have miningrigrentals as a fist pool, meaning you have other pools configured on there. I think you should look there for a solution.
239  Alternate cryptocurrencies / Mining (Altcoins) / Re: Under-overclock image for A2 Innosilicon by Emdje - Extranonce support - V4.0 on: April 29, 2015, 01:22:38 PM
$234 for six plus an extra ~$130 to see it in less than a couple of months is almost as much as I paid for the miner itself.

Heat sink is already here, and was 30 bucks for 2, so doable. And hey it's just a hobby, just looking how much I can change the thing. You guys might get some good info out of it. And it keeps me of the streets  Tongue
240  Alternate cryptocurrencies / Pools (Altcoins) / Re: [ANN][POOL][MULTI] xHash.net - VARDIFF, Stratum, PROP, 0% fee, 1% donation on: April 29, 2015, 01:17:04 PM
Pool is a bit slow. Can something be done about that?
Pages: « 1 2 3 4 5 6 7 8 9 10 11 [12] 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 »
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!