Hello dear team!
I got to complete all the required features with some caveats:
- The logs deffer a lot, sorry I ran out of time
- I couldn't figure out the correct way to discover all the
peers
only by using@hyperswarm/rpc
so I used a normalhyperswarm
with a harcodedtopic
. SORRY - Some times, some peers don't connect to the
swarm
I still have to debug. - Some times when you
ctr + c
anypeer
, the otherpeers
get a disconnection error that I still have to debug. - The
sell_orders
database is currently initialized byserver.mjs
. IMO there should be a configuration step before startingserver.mjs
andclient.mjs
that takes care of initializing the requried databases. - I wouldd also loved to have time to refactor the code so that the access to the database is easier for follow, right now to make it easier to read I left everything in
server.mjs
there is nodb
access inclient.mjs
- NOTE: I would love to know the best way to share the
swarm topic
with all thepeers
, right now I have hardcoded it.
# in the root of the project run
npm install
# create the bootstrap node with:
hyperdht --bootstrap --host 127.0.0.1 --port 30001
# start one peer per terminal session, MAKE SURE TO PASS THE NAME: it is important because that is how I create a db folder for each peer
# npm start <peer-name>
npm start alice
# the app will capture the stdin and interpret commands everytime you hit enter
## Available commands
# A health check for the own server
ping
# A sell product command
sell:<prod>:<initial-price>
# A bid command
# <peer-pub-key> is logged after running
# > npm start alice
bid:<prod>:<bid-price>:<peer-pub-key>
# A terminate sell command
terminate:<prod>
- Peer Client: create
sell
command - Peer Client/Server: notify other parties about the new auction
- Peer Server: create
bid
command - Peer Server: propagate/notify other parties about the new bid
- Peer Client: create
terminate
sell command - Peer Client: propagate/notify other parties about the termination of the
sell_order
- Peer Server: propagate auction status
- Get client example running
- Get server example running
- Modify server and client to accept
peerName
- Modify Server and Client to destroy
rpc
anddht
when process finishes - Use peer public key to make RPC calls
- OPTIONAL rpc call to get peer prefered name (
peer-name
) to improveUX
- Show a prompt when peer disconets
- Peer Server: fail
bid
ifsell_order
isterminated
- Peer Server: fail
bid
if the price is not bigger than current