Facing the dilemma of growing energy demand and mitigating carbon emissions, this paper proposes an energy sharing mechanism based on virtual federated prosumers (VFPs) with budget allocation for joint electricity and carbon market to incentivize distributed energy resources to participate in the hierarchical market and reduce carbon emissions. At the transmission level, the regional transmission operator coordinates transactions between two markets, the inter-VFP energy sharing market and the w...