Ejemplo n.º 1
0
def post_api(choice, amount, dash_amount):
    payload = {
        "product": choice,
        "amount": amount,
        "dash_amount": dash_amount,
        "machine": MACHINE_ID
    }
    headers = {"Authorization": MACHINE_API_KEY,
               "Content-Type":"application/json"}
    try:
        r = requests.post(MACHINE_API_URL, data=json.dumps(payload), headers=headers)
        info(r.content)
    except Exception as e:
        info(e)
    return
Ejemplo n.º 2
0
    listener = GuiListener(65448, dataQueue)
    #DONE
    listener.setDaemon(True)
    listener.start()

    while True:
        try:
            c = Client('127.0.0.1', 65449)
            break
        except:
            pass
        print('Connecting...')
        time.sleep(1)
    # End init GUI

    info("connecting to dashd, waiting for masternode and budget sync")
    dashrpc.connect()
    while (not dashrpc.ready()):
        time.sleep(10)

    rpcaddress = RPCAddress(mainnet=MAINNET, dashrpc=dashrpc)

    vend.set_address_chain(rpcaddress)  # attach address
    vend.set_dashrpc(dashrpc)  # attach local wallet for refunds

    #Used for ibeacon
    #parser = Parser(dataQueue = dataQueue)
    #parser.setDaemon(True)
    #parser.start()

    phl = PiHatListener(dataQueue=dataQueue)
Ejemplo n.º 3
0
from dashvend.vend import Vend  # main app and hardware interface

from dashvend.config import MAINNET  # dash network to use
from dashvend.config import VENDING_COST  # dash amount required for purchase


if __name__ == "__main__":
    dashrpc = DashRPC(mainnet=MAINNET)
    dashzmq = DashZMQ(mainnet=MAINNET,dashrpc=dashrpc)

    vend = Vend()
    dashzmq.connect()
    dashzmq.set_vend(vend)


    info("connecting to dashd, waiting for masternode and budget sync")
    dashrpc.connect()
    while(not dashrpc.ready()):
        time.sleep(10)

    addressGen = RPCAddress(mainnet=MAINNET, dashrpc=dashrpc)

    vend.set_address_chain(addressGen)  # attach address chain
    vend.set_product_cost(VENDING_COST)  # set product cost in dash
    vend.set_dashrpc(dashrpc)  # attach local wallet for refunds

    while True:
        dashrpc.connect()
        info("waiting for dashd to finish synchronizing")
        while(not dashrpc.ready()):
            time.sleep(10)
Ejemplo n.º 4
0
from dashvend.dashrpc import DashRPC  # local daemon - balances/refunds
from dashvend.dash_ix import InstantX  # dash instantx processing
from dashvend.dash_p2p import DashP2P  # dash network monitor
from dashvend.vend import Vend  # main app and hardware interface

from dashvend.config import MAINNET  # dash network to use
from dashvend.config import VENDING_COST  # dash amount required for purchase


if __name__ == "__main__":
    dashrpc = DashRPC(mainnet=MAINNET)
    dashp2p = DashP2P(mainnet=MAINNET)

    vend = Vend()

    info("connecting to dashd, waiting for masternode and budget sync")
    info("this can take between one to two hours on rpi2")
    dashrpc.connect()
    while(not dashrpc.ready()):
        time.sleep(60)

    bip32 = Bip32Chain(mainnet=MAINNET, dashrpc=dashrpc)

    ix = InstantX()
    vend.set_instantx(ix)  # attach instantx detection
    vend.set_address_chain(bip32)  # attach address chain
    vend.set_product_cost(VENDING_COST)  # set product cost in dash
    vend.set_dashrpc(dashrpc)  # attach local wallet for refunds

    while True:
        dashrpc.connect()