I am creating a DApp on the Hedera Blockchain using Hedera-sdk-py, a python wrapper of Hedera SDK in Java. I keep getting JVM exception occurred: exceeded maximum attempts for request with the last exception being com.hedera.hashgraph.sdk.MaxAttemptsExceededException each time I try to create an account. The error occurs at: resp = tran.setKey(newPublicKey).setInitialBalance(Hbar(2)).execute(client). Any help will be appreciated as I have tried repeatedly without success to fix it.
from hedera import (
Hbar,
PrivateKey,
AccountCreateTransaction,
)
from get_client import client
# Generate a Ed25519 private, public key pair
newKey = PrivateKey.generate()
newPublicKey = newKey.getPublicKey()
print("private key = ", newKey.toString())
print("public key = ", newPublicKey.toString())
tran = AccountCreateTransaction()
# need a certain number of hbars, otherwise it can not be deleted later
resp = tran.setKey(newPublicKey).setInitialBalance(Hbar(2)).execute(client)
receipt = resp.getReceipt(client)
print("account = ", receipt.accountId.toString()