THAMER
Sovereign Bitcoin Wallet

WALLET AI BITCOIN

Your Bitcoin Wallet. Your Keys. Your Engine.

Self-hosted Bitcoin software built for developers, applications, and AI agents.

CREATE WALLET

Flowise Bitcoin Automation: Narrow visual agent tools

permalink THAMER
#ai-agents#automation#bitcoin#flowise#wab-engine

Flowise Bitcoin Automation: Narrow visual agent tools

Research question

How can a Flowise workflow request a Bitcoin balance without letting arbitrary workflow inputs determine wallet credentials, network or endpoint? This study separates orchestration from execution. The workflow proposes an operation; a trusted local process validates it and queries the engine.

Proposed workflow design

Use a narrow custom tool contract with no model-selected URL or network. The tool host, not the model, owns the credential and validation.

The following Python fragment illustrates the execution boundary, not a native Flowise connector or an importable workflow. For hosted deployments, use a separately authenticated and authorized intermediary with TLS, rate limits and minimal responses. Loopback in a cloud runner or container refers to that runner or container, not the wallet owner's machine. Do not publish the engine port to solve this routing problem.

Source implementation

Python · 31 lines
1import json
2import os
3from urllib.request import Request, build_opener, ProxyHandler, HTTPRedirectHandler
4
5class NoRedirect(HTTPRedirectHandler):
6    def redirect_request(self, *args, **kwargs):
7        raise ValueError("Redirect refused")
8
9def balance():
10    req = Request("http://127.0.0.1:7070/api/v5/btc/wallet/balance",
11                  data=b'{"net":"test","type":"segwit"}',
12                  headers={"Content-Type":"application/json", "X-BTC-KEY":os.environ["BTC_KEY"]}, method="POST")
13    with build_opener(ProxyHandler({}), NoRedirect()).open(req, timeout=15) as response:
14        raw = response.read(1048577)
15    if len(raw) > 1048576:
16        raise ValueError("Response too large")
17    obj = json.loads(raw)
18    if obj.get("ok") is not True:
19        raise ValueError("Engine rejected request")
20    sats = obj["result"]["balance_sat"]
21    if type(sats) is not int or sats < 0:
22        raise ValueError("Invalid balance")
23    return {"net":"test", "type":"segwit", "balance_sat":sats}
24
25def run(event):
26    if event != {}:
27        raise ValueError("Tool accepts no arguments")
28    return balance()
29
30if __name__ == "__main__":
31    print(json.dumps(run({})))

Execution contract

The example accepts only the fixed event {}. The engine request is POST /api/v5/btc/wallet/balance with net=test and type=segwit. BTC_KEY is read locally from the environment. Redirects and environment proxies are disabled; response size and timeout are bounded. The success envelope and integer balance are checked before returning an observation. A zero balance is a valid observation, not an error. A failed request must never be represented as zero.

Deployment and privacy

Run the fragment with Python 3 and a restored Testnet wallet on a trusted host. The platform must not receive BTC_KEY in a webhook body, workflow export, execution history or model prompt. Restrict access to the execution process itself: the underlying key may authorize spending even though this fragment exposes only balance. Protect observations as private financial data. A scheduled or repeated balance query is not evidence of a new payment. Do not trigger fulfillment from a balance difference alone; use transaction-specific evidence and confirmation policy.

Failure cases and limitations

Reject unexpected events before accessing the engine. Treat malformed responses, timeouts and warming or unavailable state as failures, not as successful observations. For production, add authentication, authorization, monitoring and a bounded polling policy outside this fragment. No SEND, wallet creation, recovery or removal is exposed. No live platform or engine tests were performed. The platform design is conceptual; current node configuration and version compatibility must be checked against official documentation. The signed wallet fee law and engine remain unchanged.

References

  • Platform documentation: https://docs.flowiseai.com/
  • Engine API: https://thamer.org/api
  • Engine: https://thamer.org/engine
  • Source repository: https://thamer.org/repo/

Questions & Answers

Explore all questions →

Latest from the Lab

THAMER illustrated developer portrait and signature

ABOUT THE DEVELOPER

Independent Software Developer specializing in Bitcoin Script, Golang, and AI Agents.

Software engineering · Independent research · Open-source projects