I came to the Messenger of Allah ﷺ (and he mentioned the hadith), in which he said, They asked, "We have come to you to ask you about this matter."He replied, "Allah existed and there was nothing besides Him. His Throne was upon the water. He wrote everything in the Record, and He created the heavens and the earth."
دخلت على رسول الله ﷺ (فذكر الحديث) وقال فيه: قالوا: إنا جئناك نسألك عن هذا الأمر؟ قال: كان الله عز وجل ولم يكن شيء غيره، وكان عرشه على الماء، وكتب في الذكر كل شيء، وخلق السماوات والأرض.
Bukhari narrated it in the chapter on the beginning of creation (3191), from Umar bin Hafs bin Ghiyath, who said, my father narrated to us, Amash narrated to us, Jami bin Shaddad narrated to us, from Safwan bin Mihraz, who narrated to him from Imran bin Husayn, and he related the hadith. He related the full hadith in the chapter on faith in Allah, "Allah existed and nothing existed before Him, and His Throne was upon the water."