For the sake of time, I will not make a guide how to get antctl up and running, I’m sure there is enough of that on the forum already. Otherwise I can recommend copying the github url into chatgpt and asking for a step by step install guide. It works really well.
Uploading Files
First you need to attach your wallet, you do this by setting your private key. I set it as environmental value, that way, upon closing the powershell (windows) window the private key is no longer stored, this is a much safer way. Nonetheless, I recommend everyone to use a separate upload wallet with small amounts of ETH/ANT on it, you really don’t need much to get going. You set it as environment value by doing this
“$env:SECRET_KEY=”Your secret key here”
Uploading a single file is as easy as performing this command after”.
For a file:
ant --network-id 1 file upload -p --retry-failed 1000 --merkle “D:\yourfilename.txt"
For a folder:
ant --network-id 1 file upload -p --retry-failed 1000 --merkle “D:\yourfoldername"
These names are on a disk D. But it’s just the entire path to a file/folder, can be on other disks obviously. included it to make sure people don’t forget to include the disk path.
Uploading batches
Since uploading can still be a bit slow (chunk by chunk), I’ve created a script that can batch multiple files at once. It is slightly more costly, as smaller files will be treated individually, a file of 20 chunks will now have 1 merkle tree payment (±$0.09 at the moment). While if you upload a folder containing 10 files at once, it will merkle tree the payment of 200 chunks into one. Keep that in mind.
$secret = “YourPrivateKey”
$folder = “D:\FolderPath”
$files = Get-ChildItem -Path $folder -File
$secretEsc = $secret.Replace(“'”,“‘’”)
foreach ($f in $files) {
$path = $f.FullName.Replace(‘"’,‘“”’)
$cmd = “$env:SECRET_KEY='$secretEsc'; ant --network-id 1 file upload -p --retry-failed 1000 --merkle “$path`””
$enc = [Convert]::ToBase64String([Text.Encoding]::Unicode.GetBytes($cmd))
Start-Process powershell.exe -ArgumentList “-NoExit -EncodedCommand $enc”
}
Add your private key on the top. At the path to the folder. It will create a new powershell window for each file in the folder and starting to upload that individual file. Keep in mind, it does require quite a bit of NAT connections, so for non-specialized home routers I wouldn’t recommend more than 5 files at once. I personally found that my PC really starts struggeling with 100 files+.
Downloading files:
ant file download “DataString” “D:\AutonomiDownloadFolder\namefile.extension”
Add the file data string. Then add the path where it should be downloaded, with namefile.extension being the file name and extension. For folders, dont add the extension.
Batch Downloading files:
This script below will look for a textfield downloads.txt that on each line contains the data string, followed by a space and “namefile.extension” So for example:
3837010a4d28a1f86948734743ad9c75db1d07e84bba939f07ed326f4949 “Testfile.iso”
For each line, it will create a powershell window, downloading the file onto the destination folder provided at the top of the script as well.
# Inputs
$downloadsFile = “D:\downloads.txt”
$destFolder = “D:\AutonomiDownloadFolder”
# Optional, only if your downloads require it
# $secret = “key”
New-Item -ItemType Directory -Force -Path $destFolder | Out-Null
$lines = Get-Content -LiteralPath $downloadsFile
#If you set $secret above
if (Get-Variable secret -Scope Script -ErrorAction SilentlyContinue) {
$secretEsc = $secret.Replace(“'”,“‘’”)
}
foreach ($lineRaw in $lines) {
$line = $lineRaw.Trim()
if (-not $line) { continue }
if ($line.StartsWith(“#”)) { continue }
#Split into: first token = data key, rest of the line = filename (can contain spaces)
$parts = $line -split ‘\s+’, 2
if ($parts.Count -lt 2) {
Write-Warning “Skipping line (expected: ): $line”
continue
}
$dataKey = $parts[0].Trim()
$fileName = $parts[1].Trim().Trim(‘"’)
$destPath = Join-Path $destFolder $fileName
$cmd = “ant file download "$dataKey” "$destPath""
if (Get-Variable secret -Scope Script -ErrorAction SilentlyContinue) {
$cmd = “`$env:SECRET_KEY=‘$secretEsc’; $cmd”
}
$enc = [Convert]::ToBase64String([Text.Encoding]::Unicode.GetBytes($cmd))
Start-Process powershell.exe -ArgumentList “-NoExit -EncodedCommand $enc”
}