Exemplo n.º 1
0
def menu():
    print("1: Manual Walk")
    print("2: Automatic Walk")
    print("3: Go to Store (1)")
    print("4: Go to nearest unknown (?)")
    print("5: Go to _____")
    print("6: Go to mine")
    print("7: Mine It!")
    print("q: Quit")
    cmd = input("Your command: ").lower()

    if cmd == "q":
        exit(0)
    elif cmd == "1":
        walk()
    elif cmd == "2":
        auto()
    elif cmd == "3":
        bft(1)
    elif cmd == "4":
        bft("?")
    elif cmd == "5":
        dest = input("What room do you want to go to?: ")
        bft(int(dest))
    elif cmd == "6":
        bft(250)
    elif cmd == "7":
        mine()
    else:
        print("I did not understand that command.")
Exemplo n.º 2
0
def f(event, i):
    """
    Helper for mining in a pool
    """
    res = miner.mine(hash_of_preceding_coin, miner_id, i * offset_amt)
    event.set()
    print("event set")
from webhook_retrieval import update_transactions
from miner import mine
import psycopg2
import ipfshttpclient
import time

ACCOUNT_ID = '0001'
CITY = 'pittsburgh'
DIFFERENCE_THRESHOLD = 10  # degrees C

db_conn = psycopg2.connect(host="192.168.1.26",
                           database="weatherdb",
                           user="******",
                           password="******")
ipfs_client = ipfshttpclient.connect('/ip4/127.0.0.1/tcp/5001/http')

while True:
    update_transactions(ACCOUNT_ID=ACCOUNT_ID,
                        CITY=CITY,
                        db_conn=db_conn,
                        client=ipfs_client)
    time.sleep(10)
    mine(ACCOUNT_ID, DIFFERENCE_THRESHOLD, db_conn, ipfs_client)
    time.sleep(60 * 10)
Exemplo n.º 4
0
 def get_coin(self):
     mine()
Exemplo n.º 5
0
 def get_coin(self):
     time.sleep(self.cooldown)
     data = mine()
     self.cooldown = data['cooldown']
     if len(data['errors']) > 0:
         self.get_coin()
Exemplo n.º 6
0
import genesis
import miner

blockchain = [genesis.create_genesis_block()]
previous_block = blockchain[0]

blocks_size = 5

for i in range(0, blocks_size):
    block_to_add = miner.mine(previous_block)
    blockchain.append(block_to_add)
    previous_block = block_to_add

    print("Block #{} has been added to the blockchain!".format(
        block_to_add.index))
    print("Hash: {}".format(block_to_add.hash))
    print("Nonce: {}".format(block_to_add.nonce))
    print("Previous Hash: {}".format(block_to_add.previous_hash))
    print("Data: {}\n".format(block_to_add.data))
Exemplo n.º 7
0
def auto_mine():
    '''
    Pray at the shrine
    '''
    mine()
Exemplo n.º 8
0
from compcamps_cash_api.entities.block import nextBlock

import miner
import balance
import transaction

while (1):
    os.system('clear')
    print("Welcome to Campcoin miner")
    print("")
    print("Select an option:")
    print("(M) Start mining")
    print("(T) Send coins")
    print("(B) Check your balance or view your Public Key")
    print()
    print("Press Ctrl+C to exit")
    print()
    option = input("Enter a selection: ")

    if option == "B":
        balance.checkBalance()

    if option == "M":
        try:
            while True:
                miner.mine()
        except KeyboardInterrupt:
            pass

    if option == "T":
        transaction.sendCoins()