From 51d617e70f90a972185917ea0096c1ecef2bfa8b Mon Sep 17 00:00:00 2001 From: Bitflash-sh Date: Fri, 24 Jul 2026 11:18:11 -0300 Subject: Bitflash: fair-launch release Satoshi's bitcoin-0.1.0 reborn with RandomX CPU proof of work, anonymous .btf addressing over Nostr with CGNAT rendezvous, automatic peer discovery, a headless Linux node, and Windows GUI wallet. Fair launch, no premine, 21M cap. --- src/btftunnel.h | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 src/btftunnel.h (limited to 'src/btftunnel.h') diff --git a/src/btftunnel.h b/src/btftunnel.h new file mode 100644 index 0000000..1fa4f01 --- /dev/null +++ b/src/btftunnel.h @@ -0,0 +1,49 @@ +// Copyright (c) 2026 Bitflash developers +// Distributed under the MIT/X11 software license. +// +// Transparent anonymous tunnel. Gives the existing CNode a plain local socket +// while, behind it, a pair of pump threads bridge plaintext <-> echan <-> +// rendezvous. CNode reads/writes normally and never knows its bytes travel +// end-to-end encrypted through a meeting node (the Itzal `wrap()` pattern). +// +// Client side: resolve a `.btf` -> meeting node + service enc key (done by the +// caller), then BtfClientTunnel connects through the relay, runs the echan +// handshake, and returns a local SOCKET to hand a new outbound CNode. +// +// Service side: after RvServiceRegister pairs us with a client, BtfServiceWrap +// completes the echan handshake and returns a local SOCKET for an inbound CNode. + +#ifndef BITFLASH_BTFTUNNEL_H +#define BITFLASH_BTFTUNNEL_H + +#include "btfrv.h" + +#ifdef _WIN32 +#include +typedef SOCKET btf_socket_t; +#else +typedef int btf_socket_t; +#define INVALID_SOCKET (-1) +#endif + +namespace btf +{ + +// Initialize (sockets + libsodium). Idempotent. +bool TunnelInit(); + +// Client: dial the service registered under `target_pubkey` at the meeting node +// (host:port), box to its static x25519 `service_enc_pub`, and return a local +// plaintext SOCKET tunneled end-to-end to the service. INVALID_SOCKET on error. +btf_socket_t BtfClientTunnel(const char* meeting_host, unsigned short port, + const unsigned char target_pubkey[32], + const unsigned char service_enc_pub[32]); + +// Service: wrap an already-paired rendezvous socket (from RvServiceRegister) +// with echan using my static x25519 secret, returning a local plaintext SOCKET +// for an inbound CNode. Consumes `rv` (closed when the tunnel tears down). +btf_socket_t BtfServiceWrap(RvSocket rv, const unsigned char my_enc_sk[32]); + +} // namespace btf + +#endif -- cgit v1.2.3