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 06b34d74b8 added GetBlockchain in REST API of the serverCA, also added the visualization to the serverCA webapp 7 years ago
..
README.md peers propagation working fine, started to implement serverCA 7 years ago
blockchain.go added GetBlockchain in REST API of the serverCA, also added the visualization to the serverCA webapp 7 years ago
config.json reconstructBlockchainFromBlock, deletePeerFromPeersList when conn is closed, REST routes: GenesisBlock, NextBlock, LastBlock 7 years ago
connections.go peers propagation working fine, started to implement serverCA 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 peers propagation working fine, started to implement serverCA 7 years ago
messages.go peers propagation working fine, started to implement serverCA 7 years ago
peer added GetBlockchain in REST API of the serverCA, also added the visualization to the serverCA webapp 7 years ago
peers.go peers propagation working fine, started to implement serverCA 7 years ago
readConfig.go reconstructBlockchainFromBlock, deletePeerFromPeersList when conn is closed, REST routes: GenesisBlock, NextBlock, LastBlock 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 reconstructBlockchainFromBlock, deletePeerFromPeersList when conn is closed, REST routes: GenesisBlock, NextBlock, LastBlock 7 years ago
restServer.go reconstructBlockchainFromBlock, deletePeerFromPeersList when conn is closed, REST routes: GenesisBlock, NextBlock, LastBlock 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 peers propagation working fine, started to implement serverCA 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 --> 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