Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
bayhaqi:21504Abū al-Ḥusayn b. al-Faḍl al-Qaṭṭān > ʿAbdullāh b. Jaʿfar b. Darastawayh > Yaʿqūb b. Sufyān > Abū Nuʿaym And Qabīṣah > Sufyān > ʿImrān b. Muslim b. Riyāḥ > ʿAbdullāh b. Maʿqil > ʿAlī

[Machine] Ali is a branch of the tribe of Al-Riqq. Whoever attains loyalty attains inheritance. This is the correct (answer), and so it is.  

البيهقي:٢١٥٠٤وَإِنَّمَا لَفْظُ الْحَدِيثِ كَمَا أَخْبَرَنَا أَبُو الْحُسَيْنِ بْنُ الْفَضْلِ الْقَطَّانُ أنبأ عَبْدُ اللهِ بْنُ جَعْفَرِ بْنِ دَرَسْتَوَيْهِ ثنا يَعْقُوبُ بْنُ سُفْيَانَ ثنا أَبُو نُعَيْمٍ وَقَبِيصَةُ قَالَا ثنا سُفْيَانُ عَنْ عِمْرَانَ بْنِ مُسْلِمِ بْنِ رِيَاحٍ عَنْ عَبْدِ اللهِ بْنِ مَعْقِلٍ قَالَ

عَلِيٌّ ؓ الْوَلَاءُ شُعْبَةٌ مِنَ الرِّقِّ مَنْ أَحْرَزَ الْوَلَاءَ أَحْرَزَ الْمِيرَاثَ هَذَا هُوَ الصَّحِيحُ وَكَذَلِكَ  

رَوَاهُ مِسْعَرٌ عَنْ عِمْرَانَ وَإِنَّمَا مَعْنَاهُ مَنْ كَانَ لَهُ الْوَلَاءُ كَانَ لَهُ الْمِيرَاثُ بِالْوَلَاءِ