A method for federated learning using peer-to-peer networks, comprising: Electing, by a plurality of participant nodes in a peer-to-peer network, one of the participant nodes as a collaborator node using a consensus algorithm; Generating, by the collaborator node, a collaborator node public key and a collaborator node private key; Broadcasting, by the collaborator node and to the plurality of participant nodes, the collaborator node public key; Generating, by each participant node, a participant node public key and a participant node private key, wherein each participant node generates a new participant node public key and a new participant node private key for each communication with the collaborator node; Encrypting, by each participant node, a message comprising a parameter for a local machine learning model for the participant node and the participant node public key with the collaborator node public key; Broadcasting, by each participant node, the encrypted message on the peer-to-peer network; Decrypting, by the collaborator node, each of the encrypted messages with the collaborator node private key; Updating, by the collaborator node, an aggregated machine learning model with the decrypted parameters for the local machine learning models; Encrypting, by the collaborator node, a plurality of update messages each comprising an update from the aggregated machine learning model with each participant node's public key; Broadcasting, by the collaborator node, the plurality of messages on the peer-to-peer network; Decrypting, by each of the participant nodes, one of the plurality of messages with the participant node private key for the participant node; and Updating, by each of the participant nodes, the local machine learning model for the participant node with the update. Electing, by a plurality of participant nodes in a peer-to-peer network, one of the participant nodes as a collaborator node using a consensus algorithm; Generating, by the collaborator node, a collaborator node public key and a collaborator node private key; Broadcasting, by the collaborator node and to the plurality of participant nodes, the collaborator node public key; Generating, by each participant node, a participant node public key and a participant node private key, wherein each participant node generates a new participant node public key and a new participant node private key for each communication with the collaborator node; Encrypting, by each participant node, a message comprising a parameter for a local machine learning model for the participant node and the participant node public key with the collaborator node public key; Broadcasting, by each participant node, the encrypted message on the peer-to-peer network; Decrypting, by the collaborator node, each of the encrypted messages with the collaborator node private key; Updating, by the collaborator node, an aggregated machine learning model with the decrypted parameters for the local machine learning models; Encrypting, by the collaborator node, a plurality of update messages each comprising an update from the aggregated machine learning model with each participant node's public key; Broadcasting, by the collaborator node, the plurality of messages on the peer-to-peer network; Decrypting, by each of the participant nodes, one of the plurality of messages with the participant node private key for the participant node; and Updating, by each of the participant nodes, the local machine learning model for the participant node with the update.