mirror of https://github.com/waku-org/nwaku.git
Start of start_network
This commit is contained in:
parent
0e343a79a5
commit
6771c924e2
|
@ -60,5 +60,4 @@ task wakunode2, "Build Experimental Waku cli":
|
|||
|
||||
task wakusim2, "Build Experimental Waku simulation tools":
|
||||
buildBinary "quicksim", "waku/node/v2/", "-d:chronicles_log_level=DEBUG"
|
||||
# TODO
|
||||
#buildBinary "start_network", "waku/node/v2/", "-d:chronicles_log_level=DEBUG"
|
||||
buildBinary "start_network", "waku/node/v2/", "-d:chronicles_log_level=DEBUG"
|
||||
|
|
|
@ -14,6 +14,8 @@ template sourceDir: string = currentSourcePath.rsplit(DirSep, 1)[0]
|
|||
const sigWakuPath = &"{sourceDir}{DirSep}rpc{DirSep}wakucallsigs.nim"
|
||||
createRpcSigs(RpcHttpClient, sigWakuPath)
|
||||
|
||||
# TODO: This should have start_network
|
||||
|
||||
# More minimal than v1 quicksim, just RPC client for now
|
||||
|
||||
let node1 = newRpcHttpClient()
|
||||
|
@ -23,15 +25,6 @@ let node1 = newRpcHttpClient()
|
|||
# Using with static nodes, hardcoded "works":
|
||||
# /ip4/127.0.0.1/tcp/55505/ipfs/16Uiu2HAkufRTzUnYCMggjPaAMbC3ss1bkrjewPcjwSeqK9WgUKYu
|
||||
|
||||
# static node parsing ignored for now
|
||||
#./build/wakunode2 --staticnode:/ip4/hallibaba/foo --ports-shift:1
|
||||
|
||||
# node 1:
|
||||
# WRN 2020-05-01 12:20:13+08:00 no handlers for tid=24636 protocol=/vac/waku/2.0.0-alpha0 topic=Multistream
|
||||
|
||||
|
||||
|
||||
|
||||
# Need to figure out rw stuff as well, perhaps we can start a few nodes and see if we get some pingpong
|
||||
# Unclear how to mount waku on top of gossipsub tho
|
||||
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
import
|
||||
strformat, os, osproc, net, confutils, strformat, chronicles, json, strutils,
|
||||
libp2p/multiaddress,
|
||||
libp2p/crypto/crypto,
|
||||
libp2p/protocols/protocol,
|
||||
libp2p/peerinfo
|
||||
|
||||
type
|
||||
NodeInfo* = object
|
||||
cmd: string
|
||||
address: string
|
||||
label: string
|
||||
|
||||
# TODO: initNodeCmd and get multiaddress here
|
||||
# TODO: Then, setup a star network
|
||||
|
||||
# TODO: Create Node command, something like this:
|
||||
# "build/wakunode --log-level:DEBUG --log-metrics --metrics-server --rpc --waku-topic-interest:false --nodekey:e685079b7fa34dd35d3ffb2e40ab970360e94aa7dcc1262d36a8e2320a2c08ce --ports-shift:2 --discovery:off "
|
||||
# What's equivalent of nodekey for libp2p? It is keypair.seckey in v1
|
||||
# desc: "P2P node private key as hex.",
|
||||
# Should be straightforward
|
||||
# Ok cool so it is config.nim parseCmdArg, then use fromHex
|
||||
proc initNodeCmd(): NodeInfo =
|
||||
let
|
||||
privKey = PrivateKey.random(Secp256k1)
|
||||
keys = KeyPair(seckey: privKey, pubkey: privKey.getKey())
|
||||
peerInfo = PeerInfo.init(privKey)
|
||||
# XXX
|
||||
DefaultAddr = "/ip4/127.0.0.1/tcp/55505"
|
||||
hostAddress = MultiAddress.init(DefaultAddr)
|
||||
|
||||
peerInfo.addrs.add(hostAddress)
|
||||
|
||||
result.cmd = "./build/foo"
|
||||
|
||||
# TODO: main and toHex fromHex private keys, then in config as nodekey
|
Loading…
Reference in New Issue