committing to cleanup

This commit is contained in:
Peter Harpending
2026-09-04 19:40:44 -07:00
parent edf2030b34
commit c23eed3a4d
6 changed files with 126 additions and 15 deletions
+31
View File
@@ -0,0 +1,31 @@
/**
* Rubicon contract
*
* Author: Peter Harpending <peterharpending@qpq.swiss>
* Date: 2026-09-04
*/
contract Rubicon =
// this could/should be a record, but records aren't really
// portable across contracts/languages/APIs
//
// record rbx =
// {ip : string,
// port : int,
// protocol : string, // "tcp", "udp", "sctp", etc
// noise : string, // Noise_Foo_Bar_Baz_Quux
// pubkey : address, // responder static pubkey (noise rs field)
// prologue : option(bytes)} // noise prologue (empty = no prologue)
// (ip, port, protocol, noise, pubkey, prologue)
type rbx_tuple = string * int * string * string * address * option(bytes)
type state = list(rbx_tuple)
entrypoint init(tuples: list(rbx_tuple)): state =
tuples
stateful entrypoint set(tuples: list(rbx_tuple)): unit =
require(Call.caller == Contract.creator, "Not allowed")
put(tuples)
entrypoint lookup(): list(rbx_tuple) =
state
+38 -3
View File
@@ -4,7 +4,6 @@
-author("Peter Harpending").
-copyright("Peter Harpending").
-export([start/1]).
@@ -13,7 +12,43 @@
start(ArgV) ->
ok = application:ensure_started(hakuzaru),
ok = hz:chain_nodes([{"testnet.tsuriai.jp", 3013},
{"testnet.gajumaru.io", 3013}]),
ok = hz:tls(true),
ok = hz:chain_nodes(hz_nodes()),
ok = io:format("Hello, World! Args: ~tp~n", [ArgV]),
ok = io:format("hz status: ~tp~n", [hz:status()]),
ok = io:format("rbx_tuples: ~tp~n", [rbx_tuples()]),
ok = io:format("my akstr:~n~ts~n~n", [dummy_akstr()]),
zx:silent_stop().
dummy_seed() ->
crypto:hash(sha3_512, <<"p@ssw0rd">>).
dummy_keypair() ->
ecu_eddsa:sign_seed_keypair(dummy_seed()).
% bytes32
dummy_pubkey32() ->
maps:get(public, dummy_keypair()).
dummy_akstr() ->
unicode:characters_to_list(gmser_api_encoder:encode(account_pubkey, dummy_pubkey32())).
hz_nodes() ->
[ {"tsuriai.jp", 4013}
%, {"testnet.gajumaru.io", 4013}
].
rbx_tuples() ->
NoiseStr = "Noise_NK_25519_ChaChaPoly_BLAKE2b",
ServicePubkey =
<<116, 159, 91, 248, 138, 250, 73, 40, 231, 50,
81, 110, 137, 163, 44, 76, 48, 130, 225, 95,
168, 121, 93, 44, 148, 42, 180, 103, 11, 40,
168, 96>>
,
NoisePrologue = <<>>,
[{"127.0.0.1", 6969, "tcp", NoiseStr, ServicePubkey, <<>>}].
+5 -1
View File
@@ -6,7 +6,11 @@
{prefix,none}.
{desc,[]}.
{package_id,{"otpr","rq",{0,1,0}}}.
{deps,[{"otpr","hakuzaru",{0,9,1}}]}.
{deps,[{"otpr","base58",{0,1,1}},
{"otpr","eblake2",{1,0,1}},
{"otpr","gmserialization",{0,1,3}},
{"otpr","ec_utils",{1,0,0}},
{"otpr","hakuzaru",{0,9,1}}]}.
{key_name,none}.
{a_email,[]}.
{c_email,[]}.