Data is the most important factor in building a smart city. City data is composed of many data islands, such as transportation, industry, and residents. In order to build a smart city, breaking data islands, achieving trusted and collaborative sharing of data, while protecting data privacy are essential. As a distributed ledger, the blockchain can solve the problem of data trust. Federated learning achieves data privacy protection by sharing model parameters instead of original data. However, it still has some problems such as malicious nodes and differential attacks. This paper proposes a data sharing mechanism that combines blockchain and federated learning over smart city. Firstly, the blockchain is combined to ensure the credibility of the performance information of the work nodes, then the work node selection algorithm is designed, and a consensus incentive mechanism IPoQ is proposed for efficient federated learning tasks. Finally, differential privacy technology is introduced to resist differential attack. Experimental results show that the methods proposed in this paper achieves an effective federated learning data sharing mechanism.