talking to testnet node
This commit is contained in:
parent
67252eff87
commit
bd7c7a28b9
30
README.md
30
README.md
@ -1032,7 +1032,9 @@ index 44d206d..3abd46f 100644
|
||||
+slogan(500) -> "Internal Server Error".
|
||||
```
|
||||
|
||||
## Video 2: Talking to the gm testnet
|
||||
## Video 2: Talking to the gm testnet (2025-09-25)
|
||||
|
||||
-
|
||||
|
||||
### Adding hz as a dependency
|
||||
|
||||
@ -1040,3 +1042,29 @@ index 44d206d..3abd46f 100644
|
||||
\[application\] (applications are the subset of what in another language you
|
||||
would call "libraries" that spawn processes, essentially...) for talking to
|
||||
the blockchain from an Erlang application.
|
||||
|
||||
```
|
||||
$ zx list versions hakuzaru
|
||||
0.6.1
|
||||
0.6.0
|
||||
0.5.2
|
||||
0.5.1
|
||||
0.5.0
|
||||
0.4.0
|
||||
0.3.2
|
||||
0.3.1
|
||||
0.3.0
|
||||
0.2.0
|
||||
0.1.0
|
||||
$ zx set dep otpr-hakuzaru-0.6.1
|
||||
```
|
||||
|
||||
If we just try to use this naively, we will run into errors whenever we try to
|
||||
call code that calls into hz's dependencies.
|
||||
|
||||
So we also have to manually include all of hz's dependencies.
|
||||
|
||||
Thankfully, hz is also subject to this same constraint, so we only have to just
|
||||
copy them from hz's zomp.meta file.
|
||||
|
||||
### talking to testnet
|
||||
|
||||
@ -69,10 +69,28 @@ start() ->
|
||||
start(normal, _Args) ->
|
||||
Result = gh_sup:start_link(),
|
||||
% auto-listen to port 8000
|
||||
ok = hz(),
|
||||
ok = listen(8000),
|
||||
ok = io:format("~p~n", [hz:status()]),
|
||||
Result.
|
||||
|
||||
|
||||
hz() ->
|
||||
ok = application:ensure_started(hakuzaru),
|
||||
ok = hz:chain_nodes([testnet_node()]),
|
||||
ok = zx:tell("hz status: ~tp", [hz:status()]),
|
||||
ok.
|
||||
|
||||
testnet_ip() ->
|
||||
{84, 46, 242, 9}.
|
||||
|
||||
testnet_port() ->
|
||||
3013.
|
||||
|
||||
testnet_node() ->
|
||||
{testnet_ip(), testnet_port()}.
|
||||
|
||||
|
||||
-spec stop(term()) -> ok.
|
||||
%% @private
|
||||
%% Similar to start/2 above, this is to be called by the "application" part of OTP,
|
||||
|
||||
@ -5,7 +5,18 @@
|
||||
{author,"Peter Harpending"}.
|
||||
{desc,"Gajumaru Exchange HTTP Daemon"}.
|
||||
{package_id,{"otpr","gex_httpd",{0,1,0}}}.
|
||||
{deps,[{"otpr","hakuzaru",{0,6,1}},{"otpr","qhl",{0,1,0}}]}.
|
||||
{deps,[
|
||||
{"otpr","hakuzaru",{0,6,1}},
|
||||
{"otpr","sophia",{9,0,0}},
|
||||
{"otpr","gmserialization",{0,1,3}},
|
||||
{"otpr","gmbytecode",{3,4,1}},
|
||||
{"otpr","base58",{0,1,1}},
|
||||
{"otpr","eblake2",{1,0,1}},
|
||||
{"otpr","ec_utils",{1,0,0}},
|
||||
{"otpr","zj",{1,1,0}},
|
||||
{"otpr","getopt",{1,0,2}},
|
||||
{"otpr","qhl",{0,1,0}}
|
||||
]}.
|
||||
{key_name,none}.
|
||||
{a_email,"peterharpending@qpq.swiss"}.
|
||||
{c_email,"peterharpending@qpq.swiss"}.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user