Muhammad ibn al-Hanafiya, the half brother of Imam al-Hussain (as), once stood to claim the imamate after the demise of al-Hussain (as). He disputed with Ali ibn al-Husayn, al-Sajjad (as), for the successorship of Imamate. In the end, the judgement was brought to the Black-stone of the Ka’ba.

“When al-Husayn (as) was martyred, Muhammad ibn al-Hanafiya asked Ali ibn al-Husayn (as) for a private meeting. In the meeting he said, ‘O son of my brother, you know that the Messenger of Allah (as) delivered the task of al-Wasiyya, (the executorship of the will) and al-Imamat, (Leadership with Divine Authority) to Amir al- Mu’minin Ali (as). Thereafter it was delivered to al-Hassan (as) and then to al-Husayn (as). Your father, May Allah be pleased with him, has been murdered, may Allah grant blessing up on his soul, and he did not make any will. I am your uncle and equal in status to your father and I am a son of Ali (as). Because of being older in age I am more deserving of the position of Imamat (Leadership with Divine Authority) considering that you are younger than me. Therefore, you should not dispute me about al-Wasiyya (the will) and Imamat, (Leadership with Divine Authority) and should not argue with me about it.’
Ali ibn al-Husayn (as) said, ‘O uncle, be pious before Allah and do not claim in what you have no right. I advise you not to be one of the ignorant people. In fact, my father (as), O my uncle, appointed me as the executor of his will before his leaving for Iraq. He made such covenant with me just an hour before his becoming a martyr. This is the Armament of the Messenger of Allah with me. You then should not dislocate them. I am afraid for you of a shorter life and difficult conditions. Allah, the Most Majestic, the Most Gracious, has placed al-Wasiyya, and Imamate, in the descendents of al-Husayn (as). If you want to know it we can go near the Black-stone and ask it for judgment about the issue.’
“Abu Ja’far (as) has said that the issue came up between them in Makka and they went near the Black-stone. Ali ibn al-Husayn (as) said to Muhammad al-Hanafiya, ‘You begin first and pray to Allah, the Most Majestic, the Most Gracious, and ask Him to make the Black-stone speak to you and then ask your question.’ Muhammad then pleaded in his prayer and asked Allah and then asked the Black-stone about the disputed issue, but there was no answer. Ali ibn al-Husayn (as) said, ‘O uncle, had you been the executor of the will and the Imam it would have answered your question.’ Muhammad then said, ‘Now you pray to Allah, O son of my brother, and ask your question. Ali ibn al-Husayn (as) prayed to Allah for what he wanted. He then addressed the Black-stone and said, ‘I ask you for the sake of the One Who placed the covenant of the prophets in you, as well as the covenant of the executors of the will and the covenant of all the people. You must tell us who the Wasiyy and Imam after al-Husayn ibn Ali (as) is.’
“The narrator has said that the Black-stone began to shake so much that it almost came out of its place. Allah, the Most Majestic, the Most Gracious, then made it to speak in clear Arabic language and said, ‘O Lord, al-Wasiyya and Imamat after al-Husayn (As) ibn Ali is for Ali ibn al-Husayn ibn Ali ibn abu Talib and ibn Fatimah (as) daughter of the Messenger of Allah.’
“The narrator has said that Muhammad ibn Ali returned and he acknowledged Ali ibn al-Husayn (as) to be his Wali (Leader with Divine Authority).”

This hadith has two chains.

Sanad 1: Muhammad ibn Yahya has narrated from Ahmad ibn Muhammad from ibn Mahbub from Ali ibn Ri’ab from abu ‘Ubayda and Zurara all from abu Ja’far (as) who has said the above hadith

Sanad 2: Ali ibn Ibrahim has narrated from his father from Hammad ibn ‘Isa from Hariz
from Zurara from abu Ja’far (as) the same Hadith

Source: Usool al-Kafi, Volume 1, Chapte 138, Hadith #5 (See Image 1 below)

Grading: Allaamah al-Majlisi (rh) says the first chain is Sahih (Authentic), and the second chain is Hasan (Good) like Sahih (Authentic) (صحيح وسنده التي حسن كالصحيح) [Mira’at al-Uqool, Volume 4, Page 84 (See Image 2 below)]