def main(): DevnetNode = "https://nodes.devnet.iota.org:443" seed_vendor = seedGenerator.generateSeed() seed_investor = seedGenerator.generateSeed() api_vendor = iota.Iota(DevnetNode, seed=seed_vendor) api_investor = iota.Iota(DevnetNode, seed=seed_investor) readings1 = adc1115.main() readings2 = adc1115.main() result, address = performTransactions(api_vendor, api_investor, readings1, readings2) return (result, address)
def __init__(self, hass, host, port, secure, seed, mode, sidekey, node_path): """Initialize the service.""" import iota self._hass = hass self._node_path = node_path url = '%s://%s:%s' % ('https' if secure else 'http', host, port) self._api = iota.Iota(url) self._seed = seed mode = mode sidekey = sidekey self.yaml_path = hass.config.path(YAML_MAM_STATES) self._state = {} if os.path.isfile(self.yaml_path): conf = load_yaml_config_file(self.yaml_path) self._state = conf.get(seed, {}) self._state["seed"] = seed self._state.setdefault("subscribed", []) channel = self._state.get("channel", {}) channel["side_key"] = str(iota.TryteString.from_unicode(sidekey)) channel["mode"] = mode channel.setdefault("next_root", None) channel.setdefault("security", 2) channel.setdefault("start", 0) channel.setdefault("count", 1) channel.setdefault("next_count", 1) channel.setdefault("index", 0) self._state["channel"] = channel
def send_transfer(url, add1, add2, key_index): add1 = iota.Address(add1, key_index=key_index, security_level=2) add2 = iota.Address(add2) unspend = iota.Address(b'COIHHICCHC9JXNBJZXCNNHCRYGEVKKZKJPVJGTEQX9VPWYOJVLEZMBYHJRH9OIRXVFJVTJZHPZMZZYEYB') #add1.key_index = 4 #add1.security_level = 2 # 1. create transactions pt = iota.ProposedTransaction( address=add2, tag=iota.Tag(b'HRIBEK999IOTA999TUTORIAL'), value=100 ) api = iota.Iota(url, seed=b'N9MOJKSFIHTPRIBYDIWEHLRNBLNFSLWPVNYTEGBIRAOZRJSIBXDNCDBVPSEJRFVRSMISGQMSLAGZEVQTR') res = api.send_transfer( depth=3, transfers=[pt], inputs=[add1], # if without the change address, iota will generate new address automatically # which may waste a lot of time. change_address=unspend, min_weight_magnitude=14 ) #pprint(vars(res['bundle'])['transactions']) ''' txs = vars(res['bundle'])['transactions'] for tx in txs: pprint(vars(tx)) ''' return res
def send_text(url): add1 = iota.Address(b'TNNAFSHKQHBHRZUBE9ZFPUFKRAZVSUZDXIJEMXOGFRCOAYOBHFIPBKDPOROC9VKJBPRMYUEXGLDUU9II9') add2 = iota.Address(b'CAKYWFCCGEIBNHAIRRNZENH9OSMLZBNUNTSXNSZPD9FPFCOBKFPCR9JQQSJDTFZQFKV9CSPRDUOKJMEAX') # 1. create transactions pt = iota.ProposedTransaction( address=add1, message=iota.TryteString.from_unicode('hello, Now'), tag=iota.Tag(b'HRIBEK999IOTA999TUTORIAL'), value=0 ) pt2 = iota.ProposedTransaction( address=add2, message=iota.TryteString.from_unicode('hello2, Now'), tag=iota.Tag(b'HRIBEK999IOTA999TUTORIAL'), value=0 ) api = iota.Iota(url, seed=b'N9MOJKSFIHTPRIBYDIWEHLRNBLNFSLWPVNYTEGBIRAOZRJSIBXDNCDBVPSEJRFVRSMISGQMSLAGZEVQTR') res = api.send_transfer( depth=3, transfers=[pt, pt2, pt, pt2], #inputs=[add1], #change_address=unspend, min_weight_magnitude=9 )
def try_connect(url): try: api = iota.Iota(url) nodeinfo = self.__node_info(api) if not nodeinfo: return None if nodeinfo['latestMilestoneIndex'] != nodeinfo[ 'latestSolidSubtangleMilestoneIndex']: logger.debug('Node %s is not synced!', url) return None # drop nodes not up to date if nodeinfo['appVersion'] != '1.4.2.1': logger.debug('Node %s is not the latest version!', url) return None logger.debug('Added node %s (LM: %d)!', url, nodeinfo['latestMilestoneIndex']) return (url, nodeinfo['latestMilestoneIndex']) except timeout_decorator.TimeoutError: logger.debug('Connection to node %s timed out!', url) return None
def get_balance(address_str): """Gets the balance of a given IOTA address If need to add tokens: https://faucet.devnet.iota.org/ """ address = iota.Address(as_bytes(address_str)) api = iota.Iota(node_config['url']) return api.get_balances(addresses=[address], threshold=100)
def yield_addresses(seed): # Connect to IOTA api = iota.Iota("http://localhost:14265", seed.encode('ascii')) # No real IOTA connection required. # Generate addresses of seed api_response = api.get_new_addresses(index=1, count=ADDRESSES_PER_SEED, security_level=ADDRESS_SECURITY_LEVEL) for address in api_response['addresses']: yield binary_type(address).decode('ascii')
def __init__(self, walletfile, apifactory): # this api instance is used for non-node calls only self.walletdata = walletfile self.apifactory = apifactory self.seed = self.walletdata.seed self.api = iota.Iota('http://0.0.0.0:0', seed=self.seed) self.addrgen = AddressGenerator(self.seed) self.stopevent = threading.Event() self.refreshthread = RefreshAddrsThread(self, self.stopevent, 15) self.refreshthread.start()
def _get_apis(self, exclude=[]): """ Get Iota instances of synced nodes """ apis = [] def try_connect(url): try: api = iota.Iota(url) nodeinfo = self.__node_info(api) if not nodeinfo: return None if nodeinfo['latestMilestoneIndex'] != nodeinfo[ 'latestSolidSubtangleMilestoneIndex']: logger.debug('Node %s is not synced!', url) return None # drop nodes not up to date if nodeinfo['appVersion'] != '1.4.2.1': logger.debug('Node %s is not the latest version!', url) return None logger.debug('Added node %s (LM: %d)!', url, nodeinfo['latestMilestoneIndex']) return (url, nodeinfo['latestMilestoneIndex']) except timeout_decorator.TimeoutError: logger.debug('Connection to node %s timed out!', url) return None apis = parmap(try_connect, self.nodes, nprocs=len(self.nodes)) apis = [a for a in apis if a] apis.sort(key=lambda n: n[1], reverse=True) threshold = 1 i = 0 while i < len(apis) - 1: if apis[i][1] - apis[i + 1][1] > threshold: logger.debug( 'Dropped node %s (LM: %d) from list (not up to sync)!', apis[i + 1][0], apis[i + 1][1]) del apis[i + 1] continue i += 1 logger.debug('Loaded %d synced nodes!', len(apis)) return [SyncedApiWrapper(iota.Iota(a[0])) for a in apis]
def data_transfer(msg, sed, adr): sys.stdout = open('data_transfer_log.txt', 'wt') print("Data has been collected.", file=open("data_transfer_log.txt", "a")) api = iota.Iota(NodeURL, seed=sed) pt = iota.ProposedTransaction(address=iota.Address(adr), message=msg, value=0) print("Data:", file=open("data_transfer_log.txt", "a")) print(msg, file=open("data_transfer_log.txt", "a")) print("Address:", file=open("data_transfer_log.txt", "a")) print(adr, file=open("data_transfer_log.txt", "a")) FinalBundle = api.send_transfer(depth=3, transfers=[pt], min_weight_magnitude=14)['bundle'] print("Done.", file=open("data_transfer_log.txt", "a")) return
def create_one_miniwallet(): sys.stdout = open('wallet.txt', 'wt') miniwallet_seed = Seed.random() print("This is your new Seed:", file=open("wallet.txt", "a")) print(miniwallet_seed, file=open("wallet.txt", "a")) api = iota.Iota(NodeURL, seed=miniwallet_seed) address_set = api.get_new_addresses(index=0, count=2, security_level=2) address_set = address_set['addresses'] print("This is your new Set of Addresses:", file=open("wallet.txt", "a")) address_one = str(address_set[0].with_valid_checksum()) address_two = str(address_set[1].with_valid_checksum()) print("Your Brand new Address 1 :", file=open("wallet.txt", "a")) print(address_one, file=open("wallet.txt", "a")) print("Your Brand new Address 2 :", file=open("wallet.txt", "a")) print(address_two, file=open("wallet.txt", "a")) return (address_one, address_two, miniwallet_seed)
def do_transaction(sender_seed_str, recipient_str, amount, message=None): """Performs an IOTA transaction with an optional message""" # address is a string 'ABCD...', convert to byte string b'ABCD...' recipient_address = iota.Address(as_bytes(recipient_str)) # Once an address has been used to send tokens, it becomes useless # (a security hazard to reuse, because private key is compromised). # So we need to get a new address to hold the remaining tokens (if any). # The address must be retrieved using the sender's seed. # # This is also why we don't use sender address, but rather the sender seed change_address, _ = generate_addresses(1, sender_seed_str) print('Sending iotas ...') print('\tSender seed:', sender_seed_str) print('\tRecipient address:', recipient_str) print('\tAmount (iotas):', amount) print('\tChange address:', change_address[0]) if message: # message needs to be encoded as tryte message = iota.TryteString.from_unicode(message) api = iota.Iota(node_config['url'], seed=sender_seed_str) output_tx = iota.ProposedTransaction( address=recipient_address, message=message, tag=iota.Tag(b'DIECWORKSHOPTWO'), # A-Z, 9 value=amount) sent_bundle = api.send_transfer( depth=3, transfers=[output_tx], inputs=None, # using seed because address can change change_address=change_address[0], # where unspent tokens go min_weight_magnitude=node_config['min_weight_magnitude'], security_level=security_level) print("Done! Bundle hash: %s" % (sent_bundle['bundle'].hash)) for tx in sent_bundle['bundle']: print("\n") pprint(vars(tx)) return sent_bundle['bundle'].hash
def send_transaction(hotel_address, price, plate_id, seed): # Define api object api = iota.Iota(iotaNode, seed=seed) # Create transaction object tx1 = iota.ProposedTransaction( address=iota.Address(hotel_address), message=None, tag=iota.Tag(iota.TryteString.from_unicode(plate_id)), value=price) # Send transaction to tangle print("\nSending transaction... Please wait...") SentBundle = api.send_transfer(depth=3, transfers=[tx1], inputs=None, change_address=None, min_weight_magnitude=14) # Display transaction sent confirmation message print("\nTransaction sent...")
rawMetadataChunk) allChunksList = [b"Protocol Chunk Here"] + fileprocessor.prepareMetadataChunks( metadataChunkTuple, privateHandle) # Split, encrypt and sign the file as chunks offsetHash = bytes.fromhex(rawMetadataChunk[filename]["offsetHash"]) fileChunks = fileprocessor.fileToChunks(filename, privateHandle, offsetHash) allChunksList += fileChunks # Print data print("File >>>", filename, "<<< chunked and encrypted successfully") print("Number of transactions needed:", len(allChunksList)) #Initialize iota api and generate a random seed. api = iota.Iota(node_url) # Check node connection try: api.get_node_info() except: print("Connection to node failed:", node_url) exit else: print("Connection to node established:", node_url) # Send chunked file to the Tangle iota_utils.send_file(api, verifyingKey, allChunksList) # Print confirmation message print("File sent to the Tangle")
message = iota.TryteString.from_unicode('Hey hey, trying to figure this thing out. This is tx2, now is %s' % (NowIs)), tag = iota.Tag(b'LOCALATTACHINTERFACE99999'), # Up to 27 trytes value = 0) # besides the given attributes, library also adds a transaction timestamp # preparing bundle that consists of both transactions prepared in the previous example pb = iota.ProposedBundle(transactions=[pt2,pt]) # list of prepared transactions is needed at least # generate bundle hash using sponge/absorb function + normalize bundle hash + copy bundle hash into each transaction / bundle is finalized pb.finalize() #bundle is finalized, let's print it print("\nGenerated bundle hash: %s" % (pb.hash)) print("\nTail Transaction in the Bundle is a transaction #%s." % (pb.tail_transaction.current_index)) api = iota.Iota("https://nodes.thetangle.org:443") # selecting IOTA node gta = api.get_transactions_to_approve(depth=3) # get tips to be approved by your bundle mwm = 14 # target is mainnet bundle = entangled_interface.attach_to_tangle(pb, gta['branchTransaction'],gta['trunkTransaction'], mwm) bundle_trytes = [ x.as_tryte_string() for x in pb._transactions ] # Broadcast transactions on the Tangle broadcasted = api.broadcast_and_store(bundle_trytes) bundle_broadcasted =iota.Bundle.from_tryte_strings(broadcasted['trytes']) pprint('Local pow broadcasted transactions are:') pprint(bundle_broadcasted.as_json_compatible())
import signal import time import requests # Setup O/I PIN's LEDPIN=12 GPIO.setmode(GPIO.BOARD) GPIO.setwarnings(False) GPIO.setup(LEDPIN,GPIO.OUT) GPIO.output(LEDPIN,GPIO.LOW) # URL to IOTA fullnode used when interacting with the Tangle iotaNode = "https://nodes.devnet.thetangle.org:443" api = iota.Iota(iotaNode, "") # Hotel owner recieving address, replace with your own recieving address hotel_address = b'GTZUHQSPRAQCTSQBZEEMLZPQUPAA9LPLGWCKFNEVKBINXEXZRACVKKKCYPWPKH9AWLGJHPLOZZOYTALAWOVSIJIYVZ' # Some variables to control program flow continue_reading = True transaction_confirmed = False # Capture SIGINT for cleanup when the script is aborted def end_read(signal,frame): global continue_reading print "Ctrl+C captured, ending read." continue_reading = False GPIO.cleanup()
pt = iota.ProposedTransaction(address=iota.Address(addys[0]), tag=iota.Tag(b'LOCALATTACHINTERFACE99999'), value=0) pt2 = iota.ProposedTransaction(address=iota.Address(addys[1]), tag=iota.Tag(b'LOCALATTACHINTERFACE99999'), value=0) # Preparing bundle that consists of both transactions prepared in the previous example pb = iota.ProposedBundle(transactions=[pt2, pt]) # Generate bundle hash pb.finalize() # Declare an api instance api = iota.Iota("https://nodes.thetangle.org:443") # Get tips to be approved by your bundle gta = api.get_transactions_to_approve( depth=3) # Depth = how many milestones back minimum_weight_magnitude = 14 # target is mainnet # perform PoW locally bundle_trytes =\ ccurl_interface.attach_to_tangle( pb.as_tryte_strings(), gta['trunkTransaction'], gta['branchTransaction'], minimum_weight_magnitude )
import iota # Original IOTA python library import iota_fees # Just import this module and you are ready to set fees on transactions # # This sample shows how the iota-fees module allows for setting transaction fees, # in order to make IOTA a fully accepted crypto currency and to increase acceptance # of your business towards customers. # # Connect to IOTA node api = iota.Iota('http://localhost:14265/') # Create sample transfer transfer = [ iota.ProposedTransaction( address=iota.Address( b'QPLGOG9PMIMUAW9UDMUNZQHPXZPXDNGLBEIHILXHWHIOFHLIHPDDERXAJQKUQDEORMHSUWVZQE9JYSHIWADIIPAOJD' ), value=100, tag=iota.Tag(b'EXAMPLE'), message=iota.TryteString.from_string('Hello!'), ), ] # Send transfer api.send_transfer( depth=100, transfers=transfer, fees=1000000 # The fee to send along with the transfer can be set )
# Import json import json # Import PyFingerprint library from pyfingerprint.pyfingerprint import PyFingerprint # Get seed where fingerprints are to be uploaded MySeed = raw_input("\nWrite or paste seed here: ") # Define full node to be used when uploading fingerprints from the tangle NodeURL = "https://nodes.thetangle.org:443" # Create IOTA object api = iota.Iota( NodeURL, seed=MySeed ) # if you do not specify a seed, PyOTA library randomly generates one for you under the hood # Get a new IOTA address to be used when uploading fingerprints result = api.get_new_addresses(index=0, count=1, security_level=2) addresses = result['addresses'] addr = str(addresses[0].with_valid_checksum()) ## Tries to initialize the reader try: f = PyFingerprint('/dev/ttyUSB0', 57600, 0xFFFFFFFF, 0x00000000) if (f.verifyPassword() == False): raise ValueError('The given fingerprint sensor password is wrong!') except Exception as e:
rndgenerator = random.SystemRandom() #cryptographically secure pseudo-random generator NewSeed = u''.join(rndgenerator.choice(chars) for _ in range(81)) #generating 81-chars long seed. This is Python 3.6+ compatible print(NewSeed) print("Length: %s" % len(NewSeed)) send_seed = "" # Insert own sending seed send_addr = "" # INsert own sending address recv_seed = "" # Insert own receiving seed, ofc not necessary for receiving purpose, only needed for generating new receiving address (see below) recv_addr = "" # Insert own receiving address # Node setup uri = "" # Insert node URL depth = 3 api = iota.Iota(uri, seed=send_seed) ''' # Node health check api=iota.Iota(uri) # ctor initialization of the PyOTA library result = api.get_node_info() # basic API call to double check health conditions print(result) # result is printed out # Basic check whether node is in sync or not # Elementary rule is that "latestMilestoneIndex" should equal to "latestSolidSubtangleMilestoneIndex" or be very close if abs(result['latestMilestoneIndex'] - result['latestSolidSubtangleMilestoneIndex']) > 3 : print ("\r\nNode is probably not synced!") else: print ("\r\nNode is probably synced!") '''
import cPickle as pickle #initialize FLASK app = Flask(__name__) FlaskJSON(app) GPIO.setwarnings(False) #Read ini-file config = ConfigParser.RawConfigParser() config.read('sytrax.ini') #initialize RFID-reader reader = SimpleMFRC522.SimpleMFRC522() api = iota.Iota(config.get('MainProd', 'iotaAPI')) owner = config.get('MainProd', 'owner') terminal = config.get('MainProd', 'terminal') IOTAAddress = config.get('MainProd', 'addressDefault') seed = config.get('MainProd', 'seed') addressIndex = int(config.get('MainProd', 'addressIndex')) interface = config.get('MainProd', 'interface') #get webhook config baseHookProtocol = config.get('MainProd', 'baseHookProtocol') baseHookHost = config.get('MainProd', 'baseHookHost') baseHookURL = config.get('MainProd', 'baseHookURL') baseHookCommand = config.get('MainProd', 'baseHookCommand') documentIDtrack = config.get('MainProd', 'documentIDtrack') documentIDnew = config.get('MainProd', 'documentIDnew')
def __init__(self, node_protocal='https', node_url='durian.iotasalad.org', node_port='14265'): self.__node = node_protocal + '://' + node_url + ':' + node_port self.__adapter = iota.Iota(self.__node)
def main(): if len(sys.argv) < 6: print "Usage: echocatcher-emitter.py <hostname> <start-port> <port-range> <IRI-api> <timeout> <sleep-time>" exit(-1) #host to broadcast: host = sys.argv[1] port_start = int(sys.argv[2]) port_range = int(sys.argv[3]) port = port_start #window to wait for responses: timeout = float(sys.argv[5]) * 60 * 1000000 #miliseconds time_between_broadcasts = float(sys.argv[6]) * 60 echo_mwm = 16 iri_api = sys.argv[4] i = iota.Iota(iri_api) print "EchoCatcher emitter started." while True: #listen on current port server_address = ('0.0.0.0', port) sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) sock.bind(server_address) #prepare echo transaction ping_address = 'udp://' + host + ':' + str(port) ping_address_trytes = iota.TryteString.from_string(ping_address) tx = \ iota.ProposedTransaction( address=iota.Address(ping_address_trytes), tag=iota.Tag(b'ECHOCATCHER'), value=0 ) # send transaction print "sending echo transaction:", ping_address, "..." i.send_transfer(3, transfers=[tx], min_weight_magnitude=echo_mwm) start = current_milli_time() print "echo sent." count = 0 while current_milli_time() < start + timeout: #listen to responses for X time try: sock.settimeout( (start + timeout - current_milli_time()) / 1000000) data, (s_ip, s_port) = sock.recvfrom(1024) # measure response times now = current_milli_time() print 'received "%s" from %s:%d' % ( data, s_ip, s_port), 'after {:.1f} ms'.format( float(now - start) / 1000) count += 1 except: if count == 0: print "no response" break #increment port to eliminate delayed echos sock.close() port += 1 if port >= port_start + port_range: port = port_start print "sleeping..." time.sleep(time_between_broadcasts)
if max_time and ((time.time() - start_time) > max_time): logger.warning('Did take too long (%s).. Skipping', round((time.time() - start_time) / 60)) sumlogger.info('Timeout: %smin - %smi: %s', round((time.time() - start_time) / 60), round(input_tx.value / 1000**2), input_tx.bundle_hash) return if __name__ == "__main__": parser = argparse.ArgumentParser( description='Promote / Reattach IOTA transaction') parser.add_argument('-tx') args = parser.parse_args() node = iota.Iota('http://localhost:14265') if args.tx is not None: setup_logging(args.tx, False) logger.info('------------------------Start------------------------') spam(node, args.tx, None, 3 * 60 * 60) logger.info('------------------------Finish------------------------') else: setup_logging('autopromote') logger.info( '------------------------Starting Autopromote------------------------' ) autopromote(node)
if (promoter_mode == True): return (sent_tx.hash) else: return ("") def destroy(iteration): print(" Total iterations: " + iteration) print(' Exiting script...') if __name__ == '__main__': # Program start from here load_dotenv(find_dotenv()) (promoter_mode, tx_hash_to_be_promoted) = checkArgs() if (promoter_mode == True): rx_address = os.getenv('RECEIVING_ADDRESS_PROMOTER') else: rx_address = os.getenv('RECEIVING_ADDRESS_SPAMMER') nodeURL = sys.argv[1] api = iota.Iota(nodeURL) try: printHealth(nodeURL, api) iteration = 0 while True: print("ITERATION #" + str(iteration)) tx_hash_to_be_promoted = promoteTX(promoter_mode, rx_address, tx_hash_to_be_promoted, iteration) iteration = iteration + 1 except KeyboardInterrupt: # When 'Ctrl+C' is pressed, the destroy() will be executed. destroy(iteration)
import iota import json from pprint import pprint # Seed for the webserver. seedReceiver = 'NHDMTKGDGXXFGVIWMQG9SXBTLOTGUZPRUFVQIBCYRKXWOJKCPLSPIYSBT9VSAHKXBEKBYFXGUBDBNNWZL' # Devnet node to connect to Tangle network devnetNode = "https://nodes.devnet.iota.org:443" # Initializing api api = iota.Iota(devnetNode, seed=seedReceiver) receiverBalance = api.get_balances(addresses=[ 'BGNNNVGFPQZWKCFZJAOIAYRJBODEWFVDRWALOQZZEUHPKAFWTQPMBCIAPSCSVIWOSTYICTNCZDGRIXHGC' ], threshold=100) for key, value in receiverBalance.items(): if key == 'references': for i in range(len(value)): value[i] = str(value[i]) receiverBalance_json = json.dumps(receiverBalance) print(receiverBalance_json)
font="Courier", fontSize=23.85, Hpos=103, Vpos=84.15, lineSpacing=1.44, charSpacing=-10, data=seed) # Finally, add the rest of the Postscript and save the file: script += bgEnd PSfile = open(IOTAnotePath + '/Rendered/RenderedImage.ps', 'w') PSfile.write(script) PSfile.close() # Generate address from seed and create a PS file with QR codes and info: api = iota.Iota('http://null', seed) response = (api.get_new_addresses(index=0, count=1)) addr1 = (response['addresses'][0]) addrWithChecksum = (addr1 + (iota.Address(addr1)._generate_checksum()[0:9])) amountIota = int( float(amountMiota) * 1000000) # Iota.link doesn't like decimals, so we convert it to an int iotaLink = 'https://iota.link/' + str(addrWithChecksum) + '/' + str( amountIota ) + 'i' # Not yet implemented in the official wallet, but I hope it'll be. addrScript = '%!PS-Adobe-3.0\n<< /PageSize [595 842] >> setpagedevice\n/mm {360 mul 127 div} def\n' addrScript += '/Courier-Bold\n24 selectfont\n5 290 mm moveto\n(To give the note value, send an amount of) show\n' addrScript += '5 280 mm moveto\n(' + amountMiota + 'Mi to this address:) show\n' addrScript += createQR(char=".", font="Courier", fontSize=23.85,
import iota import json from itertools import groupby # Using Test node. Public node commented. # iotaNode = "https://field.deviota.com:443" iotaNode = "https://nodes.testnet.iota.org:443" seed = "" api = iota.Iota(iotaNode, seed) tag_list = { 'register': 'GFAQBESKMJIPYWPARQBZMROJVFP', 'body': 'M9CJ9DLLGBDI9ZPXRIIPDCEBWGO', 'key': 'GQAZH9JTKGRTKMWQSLSYSVQ9HJG', 'permission': 'FKXHTC9ERWPKOXEBAFFYUTRDXJO', 'file': 'WYKOYVPPSGWVSPZIJXWHJTUEU9O', 'deny': 'K9FZJKOSGDRNRYCTGOPWSDBGYAL' } reverse_tag_list = {v: k for k, v in tag_list.items()} def random_address(): return iota.Address.random(81) def random_tag(): return iota.Tag.random(27) def register_address(): pass
import ast import pprint import iota import base64 from Crypto.Cipher import AES # Establish Connection server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) IP_address = str(sys.argv[1]) Port = int(sys.argv[2]) server.connect((IP_address, Port)) # Connect to the tangle seed = "" client = "http://node02.iotatoken.nl:14265" iota_api = iota.Iota(client, seed) # Generate keys encrypt_key = RSA.generate(2048) signature_key = RSA.generate(2048, e=65537) # Set values invoice_address = iota_api.get_new_addresses(count=1) invoice_address = str(invoice_address['addresses'][0].address) bs = 32 # Info to be received from Seller payment_address = "" payment_granularity = 0 secret_key = "" quantity = 0
def __init__(self): self.FinalBundle = "INIT" self.TransactionHashList = list() #self.api = iota.Iota("https://field.deviota.com:443") self.api = iota.Iota("http://140.116.247.117:14265")