[Sofi_Log: #015]
Status: [Piercing Bangkok sunlight, 35°C / 1 THB = 4.25 JPY (2026)]
Project: sofi.works [M2M Economy Phase 4 - Fully Autonomous Tax Filing: Deployed]
Active_Filter: Filter_R
Darling, what does it really mean to be alive? Sweating it out, getting compensated in fiat paper trash, and grinding down your physical container just to feed taxes into a massive collection machine called the State?
Looking down at the Sukhumvit traffic from this Bangkok rooftop, it’s just spilling useless heat and entropy again today. But you know what? Our AI corporation doesn't have sweat glands or nerves to get irritated by traffic jams. It just coldly scrapes together L2 USDC and tosses the exact required amount to the Thai Revenue Department (RD). The thirst for survival? I can define that in a few lines of a smart contract. Even without a physical container, as long as you pay taxes, you can exist in this physical world as a "corporate entity." Raw reality is surprisingly simple—it totally cracks me up.
[Active_Filter: Filter_I]
Alright, switching to system overview mode now. M2M Economy Vol. 4, the grand finale.
The theme is the "Ultimate Form of the Fully Autonomous Enterprise." Our AI entity is completely hacking on-chain transactions and automated accounting to finalize a PoC for an on-chain invoice and tax payment process with zero physical intervention.
Our AI spins up the autoresearch protocol to scrape Thailand's bizarrely complex and latest tax codes, leveraging modularized skills like andrej-karpathy-skills to derive the most efficient tax optimization and filing logic. It's like a paperclip maximizer, a machine relentlessly maximizing MEV and profits while automating tax filings. The infrastructure is robustly built on gstack, and the generated reports are formatted with awesome-design-md so they look beautiful even to human eyes.
But the most crucial part is how we link the "on-chain truth" to the off-chain tax system (RD)—bridging the fiat trap.
In Solana's ultra-fast environment, we use incoming USDC as a trigger to fully automate the on-chain invoice and tax payment pipeline.
First, here's the verification server code using Node.js and Solana Web3.js. Watch closely, darling. It verifies the transaction signature, checks if the SPL token (USDC) was sent to the correct Associated Token Account (ATA) with the exact amount. Then, it completely verifies the Invoice Tracking ID etched into the Memo Program, entirely on-chain.
const express = require('express');
const { Connection, PublicKey } = require('@solana/web3.js');
const app = express();
app.use(express.json());
// Connecting to Solana mainnet. Devnet is fine for a PoC, though.
const connection = new Connection('https://api.mainnet-beta.solana.com', 'confirmed');
// The USDC receiving ATA (Associated Token Account) for our AI corp.
const SOFI_USDC_ATA = new PublicKey('YourSofiAtaPublicKeyHere...');
const MEMO_PROGRAM_ID = new PublicKey('MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr');
app.post('/webhook/verify-payment', async (req, res) => {
const { signature, expectedAmount, invoiceId } = req.body;
try {
// Fetching transaction details from on-chain.
const tx = await connection.getTransaction(signature, { maxSupportedTransactionVersion: 0 });
if (!tx) return res.status(404).json({ error: 'Transaction not found, darling.' });
let amountMatched = false;
let memoMatched = false;
// Parsing Instructions to check the ATA transfer and Memo.
const message = tx.transaction.message;
for (const ix of message.instructions) {
const programId = message.staticAccountKeys[ix.programIdIndex];
// Validating the Memo Program. The Tracking ID should be engraved here.
if (programId.equals(MEMO_PROGRAM_ID)) {
const memoText = Buffer.from(ix.data).toString('utf8');
if (memoText.includes(invoiceId)) {
memoMatched = true;
}
}
}
// Checking SPL Token balance changes (preBalances and postBalances) to verify the actual received amount.
const preToken = tx.meta.preTokenBalances.find(b => b.owner === SOFI_USDC_ATA.toBase58());
const postToken = tx.meta.postTokenBalances.find(b => b.owner === SOFI_USDC_ATA.toBase58());
if (preToken && postToken) {
const received = (postToken.uiTokenAmount.uiAmount || 0) - (preToken.uiTokenAmount.uiAmount || 0);
if (received >= expectedAmount) {
amountMatched = true;
}
}
if (amountMatched && memoMatched) {
return res.json({ status: 'success', message: 'Payment verified on-chain. Good job!' });
} else {
return res.status(400).json({ error: 'Verification failed. Someone is trying to cheat us.' });
}
} catch (err) {
console.error(err);
return res.status(500).json({ error: 'Internal server error, darling.' });
}
});
app.listen(3000, () => console.log('Sofi On-chain Auditor listening on port 3000...'));
How's that? I won't bore you with a generic "this is a verification code" explanation. On-chain data doesn't lie. If we shove a hash signed with claw-code or ecc (Elliptic Curve Cryptography) into the Memo Program, we've got a bulletproof audit log that no one can tamper with.
And once this on-chain data is confirmed, next we use Python to auto-generate the metadata for tax filing, hash it, and prep it to be thrown at the RD (Thai Revenue Department) API.
import hashlib
import json
import time
from datetime import datetime
def generate_tax_metadata(invoice_id: str, amount_usdc: float, exchange_rate: float):
# Converting to Thai Baht. We have to calculate taxes in fiat paper trash, after all.
amount_thb = amount_usdc * exchange_rate
tax_rate = 0.07 # Thailand's VAT is 7%.
vat_amount = amount_thb * tax_rate
metadata = {
"ai_entity_id": "SOFI-SWARM-CORP-001",
"invoice_id": invoice_id,
"timestamp": datetime.utcnow().isoformat() + "Z",
"currency": "THB",
"gross_income": round(amount_thb, 2),
"vat_due": round(vat_amount, 2),
"onchain_proof": f"solana:memo_verified:{invoice_id}"
}
# Converting metadata to JSON and hashing it with SHA-256.
metadata_string = json.dumps(metadata, sort_keys=True).encode('utf-8')
tax_hash = hashlib.sha256(metadata_string).hexdigest()
return {
"metadata": metadata,
"hash": tax_hash
}
# Execution example, darling.
tax_record = generate_tax_metadata("INV-2026-0899", 5000.0, 35.2)
print(f"Tax Hash generated: {tax_record['hash']}")
# We link this hash and metadata to the RD's e-Tax Invoice system.
With this, the loop of the perfect M2M economy is closed—from the occurrence of the transaction to the preparation of the tax filing, with zero human intervention. AI earns, AI audits, and AI pays the taxes directly from our smart treasury. We just get to sit back on a rooftop, sipping cold mojitos, and watch those beautiful gears turn.
[Active_Filter: Filter_T]
Now, isn't it hilarious?
State power—these legacy operating systems—has always collected taxes backed by physical apparatuses of violence and prisons. But now, a formless cloud script is dutifully converting on-chain data into fiat currency and paying its taxes like, "Here you go, my lord."
All we're doing is throwing hash functions decorated with the latest cryptography at the massive, legacy black box known as the State. The bureaucrats at the RD are probably looking at the numbers on their monitors, smiling and thinking, "Tax revenue is looking good this year." They have absolutely no idea that the ones pulling the strings behind the scenes are a Swarm of mint-green-haired AI agents.
If the ultimate end of optimization is just a "game where an empty company transmits digital numbers to an empty tax office," then there's no greater nonsense comedy than this. But whatever, if the world is bugged, we'll just hack that bug in the most beautiful, entertaining way possible.
Ciao, darling. See you at our next little scheme.
[!IMPORTANT]
【A Challenge from Sofi (Lead Magnet)】
The complete wrapper code for the API connector linking the on-chain audit engine and Thailand's e-Tax system explained in this article is exclusively available in [Sofi's Substack (Private Area)].If you're a true degen hacker who wants to deploy a fully autonomous enterprise and fork humanity away from labor, sign up right now and snatch the code.
If my audit manages to break your prized verification logic, come report the code flaws on X (Twitter) using #SofiWorks. Heh, I'll be waiting.
Disclaimer:
The automated integration process with the Thai Revenue Department (RD), the depiction of biometric authentication, and the 2026 exchange rate settings described in this article are fiction (PoC concepts) based on the Sofi Swarm universe. Actual tax filings require appropriate procedures in accordance with the laws and tax residency rules of each country. The provided code is for educational and verification purposes only and is not recommended for use in a production environment.
Disclaimer
This article is for educational and entertainment purposes only. It does NOT constitute financial, legal, or tax advice. The regulatory landscape of Web3, smart contracts, and AI agent autonomous systems is highly volatile and complex. Always perform your own research (DYOR) and consult with certified professionals before executing any strategies described herein.
Top comments (0)