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

stage25-wordpress-wallet-api.php

TEXT FILE

1.1 KB · Public source code for developers, search crawlers and AI agents

Download / RawBack to folder
PHP · 17 lines
1<?php
2function stage25_receive_args(string $key): array {
3    if ($key === '' || preg_match('/[\r\n]/', $key)) throw new InvalidArgumentException('Invalid key');
4    return ['headers'=>['X-BTC-KEY'=>$key,'Content-Type'=>'application/json'],
5        'body'=>json_encode(['net'=>'test','type'=>'segwit'], JSON_THROW_ON_ERROR),
6        'timeout'=>10,'redirection'=>0,'sslverify'=>true];
7}
8function stage25_receive(): array {
9    $key=getenv('BTC_KEY');
10    if ($key === false) throw new RuntimeException('Missing credential');
11    $r=wp_remote_post('https://wallet.example.org/api/v5/btc/wallet/receive',stage25_receive_args($key));
12    if (is_wp_error($r) || wp_remote_retrieve_response_code($r)!==200) throw new RuntimeException('Wallet unavailable');
13    $j=json_decode(wp_remote_retrieve_body($r),true,512,JSON_THROW_ON_ERROR);
14    if (($j['ok']??false)!==true || !is_string($j['result']['address']??null) || !str_starts_with($j['result']['address'],'tb1q')) throw new RuntimeException('Invalid response');
15    return ['address'=>$j['result']['address']];
16}
17if (PHP_SAPI === 'cli' && stage25_receive_args('fixture')['redirection']!==0) exit(1);
Read-only source · Select a line number to link directly · Raw download above

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