A self-consistent nonlinear theory of resistive-wall instability is developed for a relativistic electron beam propagating through a grounded cylindrical resistive tube. Because of the self- excitation of the space charge waves by the resistive-wall instability, a highly nonlinear current modulation of the electron beam is accomplished as the beam propagates downstream. A partial integrodifferential equation is obtained in terms of the initial energy modulation ((epsilon) ), the self-field effects (h), and the resistive-wall effects ((kappa) ). Analytically investigating the partial integrodifferential equation, a scaling law of the propagation distance zm at which the maximum current modulation occurs is obtained. It is found in general that the self-field effects dominate over the resistive-wall effects at the beginning of the propagation. As the beam propagates further downstream, the resistive-wall effects dominate. Due to a relatively large growth rate of the instability, the required tube length of the klystron is short for most applications.