This study investigates the effect of two methods of anesthesia—midazolam or propofol sedation—on adverse cardiovascular events during painless gastroscopy in frail elderly patients. This is a single-centre, prospective, randomised, controlled and single-blind study with 226 patients aged ≥ 65 years, FRAIL score ≥ 3 and ASA II-III. Patients will be randomly assigned 1:1 to groups with standardized protocols and monitoring. The primary outcome measure is the incidence of periprocedural cardiovascular adverse events from the start of endoscopy to discharge from postanesthetic care. Secondary outcomes include non-cardiovascular adverse events, delayed complications, postoperative pain, satisfaction, additional medication doses, time to recovery of consciousness, airway, and motor function. Frailty is associated with increased perioperative cardiovascular risk in elderly patients, and the optimal anesthetic strategy for them is unknown. The study is registered at ClinicalTrials.gov under NCT06192082.