Algo-quantum-transactions
Guide for running Algorand post-quantum (Falcon-1024) transactions on Ubuntu/WSL.
Algorand supports post-quantum accounts using Falcon-1024 signatures, and algokey pq provides the commands for PQ key management and transaction signing. See the official Algorand Post-Quantum Accounts documentation.
⚠️ MainNet warning: This guide sends real ALGO. Always verify the address, amount, transaction count, fee, and balance before running the script.
Open PowerShell as Administrator:
wsl --install -d UbuntuRestart Windows if requested, then open Ubuntu.
sudo apt update
sudo apt upgrade -ysudo apt install -y python3 python3-pip python3-venv
python3 --versionInstall the current Algorand software using the official installation instructions. algokey is included with the Algorand node software, and the PQ commands include generate, import, info, sign, and check-address.
Official documentation:
- https://dev.algorand.co/reference/algokey/
- https://dev.algorand.co/nodes/installation/manual-installation/
sudo apt install -y gnupg2 curl software-properties-common
curl -o - https://releases.algorand.com/key.pub | sudo tee /etc/apt/trusted.gpg.d/algorand.asc
sudo add-apt-repository "deb [arch=amd64] https://releases.algorand.com/deb/ stable main"
sudo apt update
sudo apt install -y algorand
Verify:
algokey --version
algokey pq --helpmkdir -p ~/algo-transfer
cd ~/algo-transfer
python3 -m venv venv
source venv/bin/activateInstall the Python SDK:
pip install py-algorand-sdk msgpack
python -c "import algosdk; print('Algorand SDK OK')"Use your Pera Quantum 25-word recovery phrase locally to recreate the Falcon-1024 key.
Never send the recovery phrase to anyone and never put it in GitHub.
read -s PQ_MNEMONICPaste the new quantum wallet recovery phrase and press Enter.
Then:
algokey pq import -m "$PQ_MNEMONIC" -k ~/pera_quantum.key
unset PQ_MNEMONICCheck the account:
algokey pq info -k ~/pera_quantum.keyCheck PQ compliance:
algokey pq check-address YOUR_QUANTUM_ADDRESSCreate the Python file:
cd ~/algo-transfer
nano transfer_100_pq.pyIn below script change the sender address with your public address & Paste shown working transaction automation script into the file.
import os
import subprocess
import time
from algosdk import encoding
from algosdk.v2client import algod
from algosdk.transaction import PaymentTxn, SignedTransaction
SENDER = "YOUR_QUANTUM_PUBLIC_ADDRESS"
RECIPIENT = SENDER
COUNT = 500
AMOUNT_MICROALGO = 100_000 # 0.1 ALGO
FEE_MICROALGO = 3_000 # 0.003 ALGO each
ALGOD_ADDRESS = "https://mainnet-api.algonode.cloud"
KEYFILE = os.path.expanduser("~/pera_quantum.key")
client = algod.AlgodClient("", ALGOD_ADDRESS)
print("=== Quantum MainNet Transfer ===")
print("Sender :", SENDER)
print("Recipient:", RECIPIENT)
print("Amount : 0.1 ALGO")
print("Count :", COUNT)
print("Fee : 0.003 ALGO each")
print()
balance = client.account_info(SENDER)["amount"]
required = COUNT * (AMOUNT_MICROALGO + FEE_MICROALGO)
print(f"Balance : {balance / 1_000_000:.6f} ALGO")
print(f"Required : {required / 1_000_000:.6f} ALGO")
if balance < required:
raise SystemExit("Insufficient ALGO balance.")
confirm = input(
"\nType START500 to send 500 transactions: "
).strip()
if confirm != "START500":
raise SystemExit("Cancelled.")
successful = 0
with open("transactions_500.txt", "a") as log:
for i in range(1, COUNT + 1):
try:
params = client.suggested_params()
params.fee = FEE_MICROALGO
params.flat_fee = True
txn = PaymentTxn(
sender=SENDER,
sp=params,
receiver=RECIPIENT,
amt=AMOUNT_MICROALGO,
)
stxn = SignedTransaction(txn, None)
encoded = encoding.msgpack_encode(stxn)
raw_txn = __import__("base64").b64decode(encoded)
with open("unsigned.txn", "wb") as f:
f.write(raw_txn)
subprocess.run(
[
"algokey",
"pq",
"sign",
"-k",
KEYFILE,
"-t",
"unsigned.txn",
"-o",
"signed.txn",
"--overwrite",
],
check=True,
)
result = subprocess.run(
[
"curl",
"-sS",
"-X",
"POST",
"-H",
"Content-Type: application/msgpack",
"--data-binary",
"@signed.txn",
f"{ALGOD_ADDRESS}/v2/transactions",
],
capture_output=True,
text=True,
check=True,
)
response = json.loads(result.stdout)
if "txId" not in response:
raise RuntimeError(
f"Submission failed: {result.stdout}"
)
txid = response["txId"]
successful += 1
print(
f"[{i:03}/{COUNT}] SUCCESS | {txid}"
)
log.write(f"{i:03} | {txid}\n")
log.flush()
time.sleep(0.2)
except Exception as e:
print(
f"[{i:03}/{COUNT}] ERROR: {e}"
)
print("STOPPING to prevent duplicate transactions.")
break
print()
print("=== COMPLETE ===")
print(f"Successful: {successful}")
print("Transaction log: transactions_500.txt")
Save in nano:
Ctrl + OEnterCtrl + X
If your setup also uses make_tx.py:
nano make_tx.pyIn below script change the sender & Receiver address with your public address - Paste your working helper script and save it.
from algosdk.v2client import algod
from algosdk.transaction import PaymentTxn, SignedTransaction
from algosdk import encoding
SENDER = "YOUR_QUANTUM_PUBLIC_ADDRESS"
RECIPIENT = "YOUR_QUANTUM_PUBLIC_ADDRESS"
client = algod.AlgodClient(
"",
"https://mainnet-api.algonode.cloud"
)
params = client.suggested_params()
# Falcon-1024 transaction minimum fee
params.fee = 3000
params.flat_fee = True
txn = PaymentTxn(
sender=SENDER,
sp=params,
receiver=RECIPIENT,
amt=1_000_000
)
# Put the unsigned payment inside a SignedTxn container.
stxn = SignedTransaction(txn, None)
# algokey expects raw MessagePack bytes.
encoded = encoding.msgpack_encode(stxn)
raw_msgpack = base64.b64decode(encoded)
Save in nano:
Ctrl + OEnterCtrl + X
Check the files:
ls -laYou should have something similar to:
algo-transfer/
├── make_tx.py
├── transfer_100_pq.py
└── venv/
For the MainNet Algod endpoint used in this guide:
ALGOD_ADDRESS = "https://mainnet-api.algonode.cloud"Always run a syntax check first:
python -m py_compile transfer_100_pq.pyNo output means the syntax check passed.
Check your Quantum account:
algokey pq info -k ~/pera_quantum.keyBefore a real MainNet run, confirm:
- Sender address
- Recipient address
- Transaction amount
- Transaction count
- Fee
- Available ALGO balance
cd ~/algo-transfer
source venv/bin/activate
python transfer_100_pq.pyYour script can record successful transaction IDs in a log such as:
transactions_100.txt
Make sure the account has enough balance for the total amount plus fees.
After installing WSL, Python, Algorand tools, and the project:
cd ~/algo-transfer
source venv/bin/activate
algokey pq info -k ~/pera_quantum.key
python -m py_compile transfer_100_pq.py
python transfer_100_pq.pyDo not copy the old venv directory to a new PC. Recreate it with Section 5.
Check Algorand tools:
algokey --versionCheck Quantum key:
algokey pq info -k ~/pera_quantum.keyCheck address:
algokey pq check-address YOUR_QUANTUM_ADDRESSActivate the project:
cd ~/algo-transfer
source venv/bin/activateRun the script:
python transfer_100_pq.pynftsathya/Algo-quantum-transactions