print('Start Block:', contract.functions.startBlock().call())
    return contract


# /* BOOT CONSOLE */
#######################################################################

w3 = init_web3()

myIP = '172.27.1.100'

myTIME = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
myENODE = w3.geth.admin.nodeInfo().enode
myKEY = w3.eth.coinbase

tcpTIME = TCP_server(myTIME, myIP, 40123, True)
tcpENODE = TCP_server(myENODE, myIP, 40421, True)
tcpKEY = TCP_server(myKEY, myIP, 40422, True)


def clock():
    while True:
        myTIME = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
        tcpTIME.data = myTIME


# Initialize background daemon thread
clockTh = threading.Thread(target=clock, args=())
clockTh.daemon = True
clockTh.start()
    print('Start Block:', contract.functions.startBlock().call())
    return contract


# /* BOOT CONSOLE */
#######################################################################

w3 = init_web3()

myIP = '172.27.1.100'

myTIME = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
myENODE = w3.geth.admin.nodeInfo().enode
myKEY = w3.eth.coinbase

tcpTIME = TCP_server(myTIME, myIP, 40123)
tcpENODE = TCP_server(myENODE, myIP, 40421)
tcpKEY = TCP_server(myKEY, myIP, 40422)


def clock():
    while True:
        myTIME = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
        tcpTIME.data = myTIME


# Initialize background daemon thread
clockTh = threading.Thread(target=clock, args=())
clockTh.daemon = True
clockTh.start()
Exemple #3
0
# /* Initialize Sub-modules */
#######################################################################

# /* Init web3.py */
print('Booting Python Geth Console...')
w3 = init_web3()
# /* Init an instance of peer for this Pi-Puck */
myID = open("/boot/pi-puck_id", "r").read().strip()
myEN = w3.geth.admin.nodeInfo().enode
myKEY = w3.eth.coinbase
me = Peer(myID, myEN, myKEY)
# /* Init an instance of peer for the monitor PC */
pc = Peer(pcID)
# /* Init TCP server, __hosting process and request function */
print('Initialising TCP server...')
tcp = TCP_server(me.enode, me.ip, tcpPort)
# /* Init E-RANDB __listening process and transmit function
print('Initialising E-RANDB board...')
erb = ERANDB(erbDist)
# /* Init Ground-Sensors, __mapping process and vote function */
print('Initialising Ground-Sensors...')
gs = GroundSensor()
# /* Init Random-Walk, __walking process */
print('Initialising Random-Walk...')
rw = RandomWalk(rwSpeed)
# /* Init LEDs */
rgb = RGBLEDs()

submodules = [w3.geth.miner, tcp, erb, gs, rw]

# /* Initialize Logging Files */
Exemple #4
0
def getEnodes():
		return [peer.enode for peer in w3.geth.admin.peers()]

def getIds():
		return [readEnode(enode) for enode in getEnodes('geth')]
	

if __name__ == "__main__":

	w3 = init_web3()
	myID  = open("/boot/pi-puck_id", "r").read().strip()
	myEN  = w3.geth.admin.nodeInfo().enode
	myKEY = w3.eth.coinbase
	me = Peer(myID, myEN, myKEY)
	pc = Peer('100')
	

	if len(sys.argv) >= 2:
		if sys.argv[1] == '--mine':

			tcpPort = 40421 
			tcp = TCP_server(me.enode, me.ip, tcpPort)
			tcp.start()
			tcp.unlock()

			peerBuffer = []
			# globalBuffer()
			waitForPC()
			waitForTS()

			w3.geth.miner.start()