Background: Hepatocellular carcinoma (HCC) is one of the most malignant tumors with a poor prognosis. There is still a lack of effective biomarkers to predict its prognosis. Exosomes participate in intercellular communication and play an important role in the development and progression of cancers.Methods: In this study, two machine learning methods (univariate feature selection and random forest (RF) algorithm) were used to select 13 exosome-related genes (ERGs) and construct an ERG signature. Based on the ERG signature score and ERG signature-related pathway score, a novel RF signature was generated. The expression of BSG and SFN, members of 13 ERGs, was examined using real-time quantitative polymerase chain reaction and immunohistochemistry. Finally, the effects of the inhibition of BSG and SFN on cell proliferation were examined using the cell counting kit-8 (CCK-8) assays.Results: The ERG signature had a good predictive performance, and the ERG score was determined as an independent predictor of HCC overall survival. Our RF signature showed an excellent prognostic ability with the area under the curve (AUC) of 0.845 at 1 year, 0.811 at 2 years, and 0.801 at 3 years in TCGA, which was better than the ERG signature. Notably, the RF signature had a good performance in the prediction of HCC prognosis in patients with the high exosome score and high NK score. Enhanced BSG and SFN levels were found in HCC tissues compared with adjacent normal tissues. The inhibition of BSG and SFN suppressed cell proliferation in Huh7 cells.Conclusion: The RF signature can accurately predict prognosis of HCC patients and has potential clinical value.