You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
arnaucode bfa7b29639 working, next step convert REST functions to tcp msg p2p connections 6 years ago
..
blockchainlib working, next step convert REST functions to tcp msg p2p connections 6 years ago
p2plib fixed p2p layer 6 years ago
.gitignore first commit 6 years ago
README.md first commit 6 years ago
config.json first commit 6 years ago
errors.go first commit 6 years ago
log.go first commit 6 years ago
main.go working, next step convert REST functions to tcp msg p2p connections 6 years ago
peer first commit 6 years ago
readConfig.go first commit 6 years ago
restConfig.go first commit 6 years ago
restRoutes.go working, next step convert REST functions to tcp msg p2p connections 6 years ago
restServer.go first commit 6 years ago
tests.sh first commit 6 years ago

README.md

Peer

To run as a normal peer:

./peer

To run as a p2p server:

./peer server

Needs the config.json file:

{
    "ip": "127.0.0.1",
    "port": "3001",
    "serverip": "127.0.0.1",
    "serverport": "3000"
}

Peer REST API

  • GET /

    • Returns the peer.ID (where peer.ID = hash(peer.IP + ":" + peer.Port))
  • GET /peers

    • Returns the peer outcomingPeersList (the peers which the peer have connection)
{
    "PeerID": "VOnL-15rFsUiCnRoyGFksKvWKcwNBRz5iarRem0Ilvo=",
    "peerslist": [
        {
            "id": "VOnL-15rFsUiCnRoyGFksKvWKcwNBRz5iarRem0Ilvo=",
            "ip": "127.0.0.1",
            "port": "3000",
            "role": "server",
            "conn": null
        },
        {
            "id": "Lk9jEP1YcOAzl51yY61GdWADNe35_g5Teh12JeguHhA=",
            "ip": "127.0.0.1",
            "port": "3003",
            "role": "client",
            "conn": {}
        },
        {
            "id": "xj78wuyN2_thFBsXOUXnwij4L8vualxQ9GnVRK6RS4c=",
            "ip": "127.0.0.1",
            "port": "3005",
            "role": "client",
            "conn": {}
        }
    ],
    "date": "0001-01-01T00:00:00Z"
}
  • POST /register
    • Adds the address (pubK of the user) to the blockchain

TODO

  • When a peer connects to the network, sends his last Block, and receives the new Blocks from this last Block --> DONE with REST petitions, maybe is better with tcp conn
  • Delete the peer from the peers list when the connection is closed --> DONE
  • REST:
    • endpoint to get if the address is in the blockchain (to verify users)
  • parameters Date or LastUpdate on the structs needs to be updated values
  • implement rsa encryption between peers
  • store blockchain in a .data file