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 c5fc0a53a7 implemented the blockchain, implemented the blocks propagation throught peers, implemented REST GetPeers and PostUser (address, pubK). Everything without any kind of blockchain verification. No cryptography yet. 7 years ago
..
README.md implemented the blockchain, implemented the blocks propagation throught peers, implemented REST GetPeers and PostUser (address, pubK). Everything without any kind of blockchain verification. No cryptography yet. 7 years ago
blockchain.go implemented the blockchain, implemented the blocks propagation throught peers, implemented REST GetPeers and PostUser (address, pubK). Everything without any kind of blockchain verification. No cryptography yet. 7 years ago
config.json implemented peersList propagation, each peer connects with each other 7 years ago
connections.go implemented the blockchain, implemented the blocks propagation throught peers, implemented REST GetPeers and PostUser (address, pubK). Everything without any kind of blockchain verification. No cryptography yet. 7 years ago
errors.go implemented peers communication to send the peersList 7 years ago
log.go peers connection working 7 years ago
main.go implemented the blockchain, implemented the blocks propagation throught peers, implemented REST GetPeers and PostUser (address, pubK). Everything without any kind of blockchain verification. No cryptography yet. 7 years ago
messages.go implemented the blockchain, implemented the blocks propagation throught peers, implemented REST GetPeers and PostUser (address, pubK). Everything without any kind of blockchain verification. No cryptography yet. 7 years ago
peer peers connection working 7 years ago
peers.go implemented the blockchain, implemented the blocks propagation throught peers, implemented REST GetPeers and PostUser (address, pubK). Everything without any kind of blockchain verification. No cryptography yet. 7 years ago
readConfig.go added REST server to peer, implementing peersList propagation 7 years ago
restConfig.go implemented the blockchain, implemented the blocks propagation throught peers, implemented REST GetPeers and PostUser (address, pubK). Everything without any kind of blockchain verification. No cryptography yet. 7 years ago
restRoutes.go implemented the blockchain, implemented the blocks propagation throught peers, implemented REST GetPeers and PostUser (address, pubK). Everything without any kind of blockchain verification. No cryptography yet. 7 years ago
restServer.go added REST server to peer, implementing peersList propagation 7 years ago
tests.sh implemented the blockchain, implemented the blocks propagation throught peers, implemented REST GetPeers and PostUser (address, pubK). Everything without any kind of blockchain verification. No cryptography yet. 7 years ago
utils.go implemented the blockchain, implemented the blocks propagation throught peers, implemented REST GetPeers and PostUser (address, pubK). Everything without any kind of blockchain verification. No cryptography yet. 7 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
  • Delete the peer from the peers list when the connection is closed
  • 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