A Peer-to-Peer Payment System for Federated Learning
- Data (Transaction, Block, ChainStructure, etc.)
- Network (Message, P2P, etc.)
- Consensus (Consensus, PoSap, etc.)
- Application (Application, FedCoin, etc.)
To build and run FedCoin, you must ensure the following software or package(s) are installed in your experimental computer(s):
Moreover, Linux distribution like Ubuntu 16.04.7 LTS is recommended as the operating system. Anaconda (Mirror: TUNA) is recommended as the environment manager. Run the
conda create -n fedcoin python=3.5 tensorflow-gpu command, and the
python -m pip install docker command in new created
fedcoin environment could easily get a basic running environment.
Run the following codes in the Python environment to generate weights:
from blockchain.application.fedcoin import FedCoin FedCoin.run_fl_server()
Parameters are defined in
blockchain/util/settings.py, which are showed as follows:
|K||Number of FL clients||int||[2, inf]||20|
|R||Number of replicas (miners)||int||[2, inf]||2|
|D||Difficulty in mining||float||[0.0, inf]||1.5|
|PRICE||Amount of FedCoins as rewards||float||[0.0, inf]||1000.0|
|RUNTIME||Time to mine in a round||float||[0.0, inf]||15.0|
|TRAIN_PRICE||Payments to the FL clients||float||[0.0, 1.0]||0.7|
|COM_PRICE||Payments to the FL server for processing the model aggregation||float||[0.0, 1.0]||0.1|
|SAP_PRICE||Payments yo the blockchain network miners for calculating SV||float||[0.0, 1.0]||0.2|
Note: The condition "TRAIN_PRICE + COM_PRICE + SAP_PRICE = 1" should be satisfied.
Build and run
The shell code
python main.py will build
fedcoin_lw images, and run several
fedcoin containers that matches the number of replicas defined in settings.
docker run fedcoin_lw will start publishing tasks.
The batch file
clean.sh will stop and delete containers, as well as delete images that are untagged.
- Yuan Liu, Zhengpeng Ai, Shuai Sun, Shuangfeng Zhang, Zelei Liu, Han Yu. FedCoin: A Peer-to-Peer Payment System for Federated Learning. In Book "Federated Learning: Privacy and Incentive" (DOI:10.1007/978-3-030-63076-8_9)
- Yuan Liu, Shuai Sun, Zhengpeng Ai, Shuangfeng Zhang, Zelei Liu, Han Yu. FedCoin: A Peer-to-Peer Payment System for Federated Learning. In arXiv (arXiv:2002.11711)