def publicMining(self, raw):
    ver = super.ver
    super.ver += 1
    predecessor = self.block_id
    m = hashlib.sha256()
    m.update(bytes(raw, 'utf-8'))
    sha256 = m.hexdigest()
    self.block_ptr = sha256
    block_id = ''
    nonce = ''
    while True:
        if block_id.startswith('f'):
            self.block_id = block_id
            self.nonce = nonce
            break
        nonce = uuid.uuid4().hex
        with Popen(('./mining', sha256, nonce), stdout=PIPE) as p:
            block_id = p.stdout.read()
    m = hashlib.sha256()
    m.update(bytes(block_id, 'utf-8'))
    sha256_id = m.hexdigest()
    self.counter += 1
    super.session.execute(self.updateBlock, [sha256_id, block_id, ver, raw, sha256, nonce, 'Mersenne15Mersenne14', predecessor, self.counter])
def publicMining(self, raw):
    ver = super.ver
    super.ver += 1
    predecessor = self.block_id
    m = hashlib.sha256()
    m.update(bytes(raw, 'utf-8'))
    sha256 = m.hexdigest()
    self.block_ptr = sha256
    block_id = 
    nonce = 
    while True:
        if block_id.startswith('f'):
            self.block_id = block_id
            self.nonce = nonce
            break
        nonce = uuid.uuid4().hex
        with Popen(('./mining', sha256, nonce), stdout=PIPE) as p:
            block_id = p.stdout.read()
    m = hashlib.sha256()
    m.update(bytes(block_id, 'utf-8'))
    sha256_id = m.hexdigest()
    self.counter += 1
    super.session.execute(self.updateBlock, [sha256_id, block_id, ver, raw, sha256, nonce, 'Mersenne15Mersenne14', predecessor, self.counter])