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 4be30ffd70 fixed id.pubK in client, add to blockchain 6 years ago
..
README.md peers propagation working fine, started to implement serverCA 6 years ago
blockchain.data fixed id.pubK in client, add to blockchain 6 years ago
blockchain.go store blockchain into data file, read blockchain.data on peer poweron. frontend: cssMaterialColors added as a bower external package 6 years ago
config.json reconstructBlockchainFromBlock, deletePeerFromPeersList when conn is closed, REST routes: GenesisBlock, NextBlock, LastBlock 6 years ago
connections.go peers propagation working fine, started to implement serverCA 6 years ago
errors.go implemented peers communication to send the peersList 6 years ago
log.go peers connection working 6 years ago
main.go store blockchain into data file, read blockchain.data on peer poweron. frontend: cssMaterialColors added as a bower external package 6 years ago
messages.go peers propagation working fine, started to implement serverCA 6 years ago
peer store blockchain into data file, read blockchain.data on peer poweron. frontend: cssMaterialColors added as a bower external package 6 years ago
peers.go peers propagation working fine, started to implement serverCA 6 years ago
readConfig.go reconstructBlockchainFromBlock, deletePeerFromPeersList when conn is closed, REST routes: GenesisBlock, NextBlock, LastBlock 6 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. 6 years ago
restRoutes.go reconstructBlockchainFromBlock, deletePeerFromPeersList when conn is closed, REST routes: GenesisBlock, NextBlock, LastBlock 6 years ago
restServer.go reconstructBlockchainFromBlock, deletePeerFromPeersList when conn is closed, REST routes: GenesisBlock, NextBlock, LastBlock 6 years ago
tests.sh fixed id.pubK in client, add to blockchain 6 years ago
utils.go peers propagation working fine, started to implement serverCA 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