if (FAUCET): print(f" Faucet: '{FAUCET}'") if (not ENDPOINT): raise Exception('No endpoint provided.') if ((not FAUCET) and (not PRIVATE_KEY)): raise Exception('Neither of faucet or private key were provided.') # Get network type with client.NodeHTTP(ENDPOINT) as http: node_info = http.get_node_info() network_type = node_info.network_identifier # Get generation hash and main mosaic with client.BlockchainHTTP(ENDPOINT) as http: block = http.get_block_by_height(1) gen_hash = block.generation_hash nemesis = block.signer receipts = http.get_block_receipts(2) for statement in receipts.transaction_statements: for receipt in statement.receipts: if (receipt.type == models.ReceiptType.VALIDATE_FEE): mosaic_id = receipt.mosaic.id break # Checking the divisibility with client.MosaicHTTP(ENDPOINT) as http: mosaic_info = http.get_mosaic(mosaic_id) divisibility = 10**mosaic_info.properties.divisibility
for mosaic in account_info.mosaics: with client.MosaicHTTP(endpoint) as http: mosaic_info = http.get_mosaic(mosaic.id) mosaic_names = http.get_mosaic_names([mosaic.id]) divisibility = 10**mosaic_info.properties.divisibility name = mosaic_names[0].names[0] # Get network type with client.NodeHTTP(endpoint) as http: node_info = http.get_node_info() network_type = node_info.network_identifier # Get generation hash of this blockchain with client.BlockchainHTTP(endpoint) as http: block_info = http.get_block_by_height(1) # Get the XPX mosaic by its namespace alias. Mosaics don't have names, you can only asign an alias to them. # Namespace will give us the mosaic id. with client.NamespaceHTTP(endpoint) as http: namespace_info = http.get_namespace(models.NamespaceId('prx.xpx')) # Get mosaic info by its id. with client.MosaicHTTP(endpoint) as http: xpx = http.get_mosaic(namespace_info.alias.value) alice = models.Account.create_from_private_key( "6b2a97945d0f318114215ee80c012a5ea2ad39a3cd472a9ff2caf7488c4c2ede", network_type)
#!/usr/bin/python from xpxchain import client # Get the current chain height of the Sirius test net with client.BlockchainHTTP('bctestnet1.brimstone.xpxsirius.io:3000') as http: reply = http.get_blockchain_height() print(reply)