From 2e35db71e4f8828f35fbc3e8c6e97ff3ed337e14 Mon Sep 17 00:00:00 2001
From: rhodey <mike@rhodey.org>
Date: Mon, 23 Feb 2026 07:35:54 -0500
Subject: [PATCH] rename a few things to match latest lock.host-wasm-js

---
 README.md                        | 10 +++++-----
 justfile                         | 21 ++-------------------
 python/add-funds.py              | 26 --------------------------
 python/add-funds.sh              |  4 ----
 python/app.py                    | 21 +++++++++------------
 python/ask-funds.sh              |  4 ----
 python/{ask-funds.py => joke.py} |  2 +-
 python/joke.sh                   |  4 ++++
 8 files changed, 21 insertions(+), 71 deletions(-)
 delete mode 100644 python/add-funds.py
 delete mode 100755 python/add-funds.sh
 delete mode 100755 python/ask-funds.sh
 rename python/{ask-funds.py => joke.py} (98%)
 create mode 100755 python/joke.sh

diff --git a/README.md b/README.md
index 9c75f82..7ebc39f 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@ Lock.host python example, see: [Lock.host](https://github.com/rhodey/lock.host)
 This demonstration uses OpenAI to control a Solana wallet:
 + Unmodified OpenAI lib
 + Unmodified Solana lib
-+ Hit /api/ask?message=your best joke&addr=abc123
++ Hit /api/joke?message=your best joke&addr=abc123
 + OAI is asked "You are to decide if a joke is funny or not"
 + If so 0.001 SOL is sent to addr
 
@@ -17,9 +17,9 @@ just build-app
 {
   "Measurements": {
     "HashAlgorithm": "Sha384 { ... }",
-    "PCR0": "e6227931d1d846e84ba568a33fbab583d24ce6f016e465eb6735af6f65048fd583911979233d1f53784a7a28c612878f",
+    "PCR0": "25411de098dd21a83a252fcb64bb2a28d7a5fe26df1a820f59abb73222a91f6cc9605d376ca37838d297c4e0e5e187a7",
     "PCR1": "4b4d5b3661b3efc12920900c80e126e4ce783c522de6c02a2a5bf7af3a2b9327b86776f188e4be1c1c404a129dbda493",
-    "PCR2": "8e2166ac3d0a5afcc2461eb4009b0dde9b600f9d7216c90c8c2ae2331912d82bb502ef1bbc5914f456ba8b7864b22562"
+    "PCR2": "ee5d87b4c5f0f5ab6b3a0abb79bfb161f52e455f6ab66e7f3c38e98e2cba710e63ae9bfd340a106535afaf9729886b4e"
   }
 }
 ```
@@ -34,7 +34,7 @@ just serve-alpine
 just build-test-app make-test-fifos
 cp example.env .env
 docker compose up -d
-just ask-funds 'why did the worker quit his job at the recycling factory? because it was soda pressing.'
+just joke 'why did the worker quit his job at the recycling factory? because it was soda pressing.'
 ...
 addr = A7xYaa6PGwUFGYY5FYfMrZe6HJp5pSY7dBthdnPNbFE
 sol = 0.025
@@ -45,7 +45,7 @@ json = {
   "thoughts": "The joke is a clever play on words, combining the concept of being 'so depressing' with 'soda pressing' related to recycling. It's humorous and lighthearted."
 }
 sol = 0.026
-(look inside python/ask-funds.py)
+(look inside python/joke.py)
 ```
 
 ## Atsocat
diff --git a/justfile b/justfile
index 76610b2..3d46db5 100644
--- a/justfile
+++ b/justfile
@@ -1,5 +1,4 @@
 sudo := "$(docker info > /dev/null 2>&1 || echo 'sudo')"
-certs := "$(cat cert.key > /dev/null 2>&1 && echo '-v ./cert.key:/runtime/cert.key -v ./cert.crt:/runtime/cert.crt')"
 
 #########################
 ## Reproducible builds ##
@@ -59,24 +58,8 @@ build-test-app:
     just make-test-net
     {{sudo}} docker buildx build --platform="linux/amd64" --build-arg PROD=false -f Dockerfile.app -t lockhost-python-test-app .
 
-add-funds:
-    {{sudo}} docker run --rm --entrypoint /app/add-funds.sh --env-file .env lockhost-python-test-app
-
-ask-funds joke:
-    {{sudo}} docker run --rm --entrypoint /app/ask-funds.sh --network locknet --env-file .env lockhost-python-test-app http://atsocat:8889 {{joke}}
-
-mkcert:
-    echo "authorityKeyIdentifier=keyid,issuer" > domains.ext
-    echo "basicConstraints=CA:FALSE" >> domains.ext
-    echo "keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment" >> domains.ext
-    echo "subjectAltName = @alt_names" >> domains.ext
-    echo "[alt_names]" >> domains.ext
-    echo "DNS.1 = localhost" >> domains.ext
-    openssl req -x509 -nodes -new -sha256 -days 1024 -newkey rsa:2048 -keyout ca.key -out ca.pem -subj "/C=US/CN=Lock-Host-CA"
-    openssl x509 -outform pem -in ca.pem -out ca.crt
-    openssl req -new -nodes -newkey rsa:2048 -keyout cert.key -out cert.csr -subj "/C=US/ST=YourState/L=YourCity/O=Example-Certificates/CN=localhost"
-    openssl x509 -req -sha256 -days 1024 -in cert.csr -CA ca.pem -CAkey ca.key -CAcreateserial -extfile domains.ext -out cert.crt
-    rm ca.key ca.pem ca.srl cert.csr domains.ext
+joke joke:
+    {{sudo}} docker run --rm --entrypoint /app/joke.sh --network locknet --env-file .env lockhost-python-test-app http://atsocat:8889 {{joke}}
 
 
 #########################
diff --git a/python/add-funds.py b/python/add-funds.py
deleted file mode 100644
index ebbb2d3..0000000
--- a/python/add-funds.py
+++ /dev/null
@@ -1,26 +0,0 @@
-import os
-import base64
-import asyncio
-from solders.keypair import Keypair
-from solana.rpc.async_api import AsyncClient
-
-# add funds to wallet for testing
-async def main():
-    # persistent keys arrive soon
-    sol_key = "2oRZ/SaFEQRo+hyf4SrZS1W6yNVcovMwDPhGJ0nkGji1gNIodfEGlzzravS6oQbFngilk9fchPv8Cfl9Iqkkhg=="
-    sol_key = base64.b64decode(sol_key)
-    sol_key = Keypair.from_bytes(sol_key)
-    print(f"addr = {sol_key.pubkey()}")
-
-    solana_env = os.environ["solana_environment"]
-    async with AsyncClient(solana_env) as sol_client:
-        signature = await sol_client.request_airdrop(sol_key.pubkey(), 1_000_000_000)
-        latest_blockhash = await sol_client.get_latest_blockhash()
-        await sol_client.confirm_transaction(tx_sig=signature.value, last_valid_block_height=latest_blockhash.value.last_valid_block_height)
-        balance = await sol_client.get_balance(sol_key.pubkey())
-        balance = balance.value / 1_000_000_000
-        print(f"sol = {balance}")
-
-
-if __name__ == "__main__":
-    asyncio.run(main())
diff --git a/python/add-funds.sh b/python/add-funds.sh
deleted file mode 100755
index 584d8a8..0000000
--- a/python/add-funds.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/sh
-set -e
-
-python -u add-funds.py "$@"
diff --git a/python/app.py b/python/app.py
index cc988a0..5968204 100644
--- a/python/app.py
+++ b/python/app.py
@@ -45,8 +45,8 @@ async def add_cors_headers(request, handler):
     return response
 
 # called by user
-async def wallet_handler(request):
-    print("got wallet request")
+async def balance_handler(request):
+    print("get balance")
     pubkey = request.query.get("addr", "")
     pubkey = Pubkey.from_string(pubkey) if pubkey != "" else sol_key.pubkey()
     sol_client = request.app["sol_client"]
@@ -76,8 +76,8 @@ async def wallet_handler(request):
 }]
 
 # called by user
-async def ask_handler(request):
-    print("got oai request")
+async def joke_handler(request):
+    print("get joke")
     addr = request.query.get("addr", "")
     addr = Pubkey.from_string(addr)
     message = unquote(request.query.get("message", ""))
@@ -93,14 +93,12 @@ async def ask_handler(request):
 
     reply = reply.choices[0].message.tool_calls[0]
     reply = json.loads(reply.function.arguments)
-    print(f"got oai reply {reply}")
+    print(f"oai reply {reply}")
     funny = reply["decision"] == "funny"
 
     if funny == False:
-        print("oai = not funny")
         return web.json_response({"thoughts": reply["thoughts"]})
 
-    print("oai = funny")
     lamports_to_send = 1_000_000
     ixns = [transfer(
         TransferParams(
@@ -115,7 +113,6 @@ async def ask_handler(request):
     latest_blockhash = await sol_client.get_latest_blockhash()
     txn = Transaction([sol_key], message, latest_blockhash.value.blockhash)
     signature = await sol_client.send_transaction(txn)
-    print(f"signature = {str(signature.value)}")
 
     latest_blockhash = await sol_client.get_latest_blockhash()
     await sol_client.confirm_transaction(tx_sig=signature.value, last_valid_block_height=latest_blockhash.value.last_valid_block_height)
@@ -129,10 +126,10 @@ async def create_app():
     sol_client = await MySolClient.create()
     app = web.Application(middlewares=[add_cors_headers])
     app["sol_client"] = sol_client
-    app.router.add_route("OPTIONS", "/api/wallet", cors_handler)
-    app.router.add_route("OPTIONS", "/api/ask", cors_handler)
-    app.router.add_route("GET", "/api/wallet", wallet_handler)
-    app.router.add_route("GET", "/api/ask", ask_handler)
+    app.router.add_route("OPTIONS", "/api/balance", cors_handler)
+    app.router.add_route("OPTIONS", "/api/joke", cors_handler)
+    app.router.add_route("GET", "/api/balance", balance_handler)
+    app.router.add_route("GET", "/api/joke", joke_handler)
     return app
 
 # connections arrive from runtime
diff --git a/python/ask-funds.sh b/python/ask-funds.sh
deleted file mode 100755
index 606c4e5..0000000
--- a/python/ask-funds.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/sh
-set -e
-
-python -u ask-funds.py "$@"
diff --git a/python/ask-funds.py b/python/joke.py
similarity index 98%
rename from python/ask-funds.py
rename to python/joke.py
index 7abe407..490de9a 100644
--- a/python/ask-funds.py
+++ b/python/joke.py
@@ -33,7 +33,7 @@ async def main():
 
     # send request
     api = sys.argv[1]
-    api = f"{api}/api/ask"
+    api = f"{api}/api/joke"
     data = requests.get(api, params=params)
     data = data.json()
     pretty = json.dumps(data, indent=2)
diff --git a/python/joke.sh b/python/joke.sh
new file mode 100755
index 0000000..65a8399
--- /dev/null
+++ b/python/joke.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+set -e
+
+python -u joke.py "$@"
