Skip to content

feat: init keystore support VRF and P2P network#8

Open
carlhh369 wants to merge 11 commits into
sanata-project:betafrom
carlhh369:dev
Open

feat: init keystore support VRF and P2P network#8
carlhh369 wants to merge 11 commits into
sanata-project:betafrom
carlhh369:dev

Conversation

@carlhh369
Copy link
Copy Markdown
Collaborator

@carlhh369 carlhh369 commented Mar 13, 2024

Demo Peer Instruction

Build

cargo build --release

Startup fullnode

mkdir fullnode

cd fullnode

../target/release/peer --pport 5001 --sport 3001

This command start fullnode with p2p network listen port 5001 and web server listen port 3001.

Copy Fullnode multiaddress in log

[2024-04-11T13:27:40.615Z INFO  beta::p2p::behaviour] Local node is listening on "/ip4/127.0.0.1/tcp/5001/p2p/12D3KooWDALh1fbe7g8HP8pFJsrPCzoYtFV15gVyyRH7tTgMuinJ"

Multiaddress: /ip4/127.0.0.1/tcp/6336/p2p/12D3KooWDALh1fbe7g8HP8pFJsrPCzoYtFV15gVyyRH7tTgMuinJ

Startup light nodes

startup lightnode A

mkdir lightA
cd lightA
../target/release/peer --pport 6001 -f /ip4/127.0.0.1/tcp/5001/p2p/12D3KooWDALh1fbe7g8HP8pFJsrPCzoYtFV15gVyyRH7tTgMuinJ

startup lightnode B

mkdir lightB
cd lightB
../target/release/peer --pport 6002 -f /ip4/127.0.0.1/tcp/5001/p2p/12D3KooWDALh1fbe7g8HP8pFJsrPCzoYtFV15gVyyRH7tTgMuinJ

...

Test Put/Get Data

Put Data

curl --location 'http://localhost:3001/put' \
--form 'file=@"/Users/admin/Downloads/abc.txt"'

Copy the response CID

something like: 0b592ea6074ab5a4cc369e392475a613ce5858b6ef9340e9ef7e7e2ddf4d266c

Get Data

curl --location 'http://localhost:3001/get/0b592ea6074ab5a4cc369e392475a613ce5858b6ef9340e9ef7e7e2ddf4d266c' > abc.txt

Test data chunks send and ack

full node send a 1MBytes data chunk to 100 light nodes each and wait for ack responses concurrently. Local test on 4c16g,request and response total takes 275ms.

  1. Start full node
net --p2p --port <port> -b 100
  1. Start 100 light nodes as above

  2. Full node print log

[2024-03-26T13:33:04.193Z INFO  net] send chunks and wait ack takes 275 ms

Copy link
Copy Markdown
Contributor

@hertarr hertarr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's bad to handle action events in p2p module.

Comment thread beta/src/keystore.rs Outdated
Comment thread beta/src/bin/net.rs Outdated
@@ -0,0 +1,182 @@
use anyhow::Result;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Format used libraries.

Copy link
Copy Markdown
Collaborator Author

@carlhh369 carlhh369 Mar 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure changed to this error

Comment thread beta/src/p2p/behaviour.rs
pub struct Behaviour {
request_response: request_response::cbor::Behaviour<PeerRequest, PeerResponse>,
kademlia: kad::Behaviour<kad::store::MemoryStore>,
gossipsub: gossipsub::Behaviour,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gossipsub doesn't meet requirements for extensibility.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should use simple request and response protocol for full node and light nodes messaging

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants