Laminar-to-turbulent transition in a zero-pressure-gradient boundary layer at Mach 4.5 is studied using direct numerical simulations. For a given level of total disturbance energy, the inflow spectrum was designed to correspond to the nonlinearly most dangerous condition that leads to the earliest possible transition Reynolds number. The synthesis of the inlet disturbance is formulated as a constrained optimization, where the control vector is comprised of the amplitudes and relative phases of the inlet modes; the constraints are the prescribed total energy and that the flow evolution satisfies the full nonlinear compressible Navier–Stokes equations; the cost function is defined in terms of the mean skin-friction coefficient and, once maximized, ensures the earliest possible transition... location. An ensemble-variational (EnVar) technique is developed to solve the optimization problem. Starting from an initial guess, here a broadband disturbance, EnVar updates the estimate of the control vector at the end of each iteration using the gradient of the cost function, which is evaluated from the outcomes of an ensemble of possible solutions. Two inflow conditions are computed, each corresponding to a different level of energy, and their spectra are contrasted: the lower-energy case includes two normal acoustic waves and one oblique vorticity perturbation, whereas the higher-energy condition consists of oblique acoustic and vorticity waves. The focus is placed on the former case because it cannot be categorized as any of the classical breakdown scenarios (fundamental, subharmonic or oblique), while the higher-energy condition undergoes a second-mode oblique transition. At the lower energy level, the instability wave that initiates the rapid breakdown to turbulence is not present at the inlet plane. Instead, it appears at a downstream location after a series of nonlinear interactions that spur the fastest onset of turbulence. The results from the nonlinearly most potent inflow condition are also compared to other inlet disturbances that are selected solely based on linear theory, and which all yield relatively delayed transition onset.