1 Introduction

Mild steel (MS) alloys are preferred materials in chemical and petrochemical industries as well as oil refineries because of their versatility in mechanical characteristics, easy availability and low cost [1]. Moreover, the wide usage of MS is perceived in various construction systems such as gas pipelines for oil and gas distribution, boilers, storage tanks for corrosive chemicals, heat exchangers and engineering machineries [2, 3]. Mineral acids, especially sulphuric and hydrochloric acids, are commonly used in oil-well acidizing and also as pickling and cleaning agents in many industries and treatment plants [4]. HCl is the primarily chosen acid due to its more cost-effective, efficient and trouble-free nature. However, deterioration of MS alloy in aggressive acid environment is an industrial menace. The high susceptibility to corrode in these aggressive acidic environments limits the utility of the extremely expedient MS alloy [5]. Hence, protection of MS and thereby conservation of economic resources in technology have gained wide attention. Immense research efforts that focus towards the reduction of damages caused by MS corrosion are therefore highly essential.

Among various prevention methods to combat electrochemical degradation process and destruction due to acid-induced corrosion, inhibitors play a significant role as they are cost-effective and can be injected into an ongoing industrial process without interrupting it. Heterocyclic compounds are organic chemical entities that incorporate aromatic rings and one or more heteroatoms such as nitrogen, oxygen, sulphur and phosphorous in their molecular structure, which can adsorb onto MS to form a protective surface film and thus inhibiting corrosion of MS in acidic environments [6]. Hydrazides and their derivatives containing nitrogen–nitrogen covalent bond have gained prominence because of their corrosion inhibitory feature on MS in acid media as described in earlier investigations [7]. Besides, hydrazides with additional aromatic rings, hetero atoms and electron-donating groups have been found to exhibit better inhibition performance. Studies on MS corrosion in 1 N sulphuric acid using hydrazides of salicylic, anthranilic, benzoic and cinnamic acids have reported an inhibition efficiency as high as 96.99% [8]. Most of the hydrazides that have been investigated have revealed a mixed type of inhibition behaviour by controlling both anodic and cathodic corrosion reactions, and the inhibition has occurred through adsorption phenomena that followed either Langmuir or Temkin isotherm model [7]. However, there are very few literature evidences that showcase the efficiency of indole-containing inhibitors to mitigate the acid-induced MS corrosion [9,10,11,12]. Supplementary Table 1 displays the efficiency of few indole derivatives that has been investigated till date to resist the loss of MS metal due to acid-mediated corrosion.

Interestingly, to the best of our knowledge, there are no reports available on hydrazides of indole-3-carboxylic acids explored as inhibitors against MS corrosion in HCl environment. Therefore, the present investigation highlights the comparative study of inhibitory characteristics of two indole-3-acid hydrazides with varying numbers of methylene units: 2-(1H-indol-3-yl)acetohydrazide (IAH) and 4-(1H-indol-3-yl)butanehydrazide (IBH) against MS corrosion that occurs in HCl media. The corrosion inhibition efficiencies of IAH and IBH are studied using gravimetric and electrochemical techniques. Besides, the various thermodynamic parameters for the inhibition process against metal deterioration are analysed and the mechanism of corrosion inhibition is also proposed. The morphology analysis of the MS surface has also been carried out to support the experimental results. As the molecular properties of inhibitor molecules are related to its adsorption behaviour on metallic surfaces [13,14,15], the electronic parameters based on the density functional theory (DFT) are employed for studying the adsorption properties of IAH and IBH on MS surface.

2 Experimental Details

2.1 Preparation of Mild Steel Specimen

MS coupons with following chemical composition (in weight percentage): Fe (99.0), C (0.15), Si (0.15), S (0.062), P and Cr (0.05 each) and Mn (0.49), were used in the present study. Cylindrical MS samples with 4.0 cm height and 0.95 cm2 exposed area were prepared. These test coupons were initially polished with various grade emery papers (200 to 1000). Further disc polishing was done using lavigated alumina (0.05 micron), later cleaned with distilled water and completely dried before introducing into 0.5 M HCl.

2.2 Synthesis and Characterization of Inhibitors

About 0.08 mL of concentrated sulphuric acid (98%) was added to 0.005 mol of indole-3-acetic acid/indole-3-butyric acid dissolved in 8 mL ethanol and refluxed for 5 h to obtain the respective esters. Further, 0.24 mL of hydrazine hydrate was added to 0.004 mol of indole-3-esters and refluxed for 8 h to obtain 2-(1H-indol-3-yl) acetohydrazide (IAH) and 4-(1H-indol-3-yl) butanehydrazide (IBH). The pathway for the preparation of hydrazides is presented in Scheme 1.

Scheme 1.
scheme 1

Synthetic path for indole hydrazides

The chemical structures of IAH and IBH were confirmed by recording 1H NMR spectra using a 400 MHz Bruker spectrometer and are presented in supplementary figures (SF.1) and (SF.2), respectively.

2-(1H-indol-3-yl) acetohydrazide (IAH): 1H NMR (DMSO-d6, 400 MHz): δ 3.451 (s, 2H, CH2), 4.193 (s, 2H, NH2), 6.950–6.985 (t, 1H, 6.8 Hz), 7.039–7.075 (t, 1H, 6.8 Hz), 7.176 (1H), 7.321–7.340 (d, 1H, 7.6 Hz), 7.558–7.576 (d, 1H, 7.2 Hz), 9.128 (s, 1H), 10.855 (s, 1H, NH).

4-(1H-indol-3-yl) butanehydrazide (IBH): 1H NMR (DMSO-d6, 400 MHz): δ 1.840–1.877 (t, 2H, CH2, 7.6 Hz), 2.065–2.102 (t, 2H, CH2, 7.6 Hz), 2.633–2.671 (t, 2H, CH2, 7.6 Hz), 4.162 (s, 2H, NH2), 6.939–6.976 (t, 1H, 7.6 Hz), 7.032–7.069 (t, 1H, 7.6 Hz), 7.096 (1H), 7.311–7.331 (d, 1H, 8 Hz), 7.481–7.500 (d, 1H, 7.6 Hz), 8.942 (s, 1H), 10.752 (s, 1H, NH).

2.3 Gravimetric Method

The MS test coupons (2.0 cm × 2.0 cm × 0.1 cm) used for weight loss measurements were subjected to necessary pre-treatment process by polishing with different grades of emery papers and then washed with distilled water. The experiment was performed at 303 K in 100 mL 0.5 M HCl in the absence and presence of IBH and IAH at varying concentrations. The initial weight of the test coupon was noted. Further, it was completely immersed into the experimental solution for 3 h, washed thoroughly with distilled water and dried, and final weight was recorded.

The corrosion rate (CR), percentage inhibition efficiency (% IE) and surface coverage (θ) were computed using equations Eqs. (13), respectively [16,17,18].

$${\text{CR}} = \frac{W}{At}$$
(1)

where W, A and t denote the average weight loss of MS specimen, its total area and the 3-h immersion time in the test solution, respectively.

$${\text{IE}}(\% ) = \frac{{{\text{CR}}_{b} - {\text{CR}}_{i} }}{{{\text{CR}}_{b} }} \times 100$$
(2)

where CRb and CRi signify the rate of corrosion in the absence and presence of different concentrations of IAH/IBH, respectively.

$$\theta = \frac{{{\text{IE}}\left( \% \right)}}{100}.$$
(3)

2.4 Electrochemical Investigations

The electrochemical techniques were performed using CH600 D-series electrochemical workstation. The three-electrode Pyrex glass system was used consisting of MS, calomel and platinum rod as the working, reference and auxiliary electrodes correspondingly. After immersing the electrodes in the conductive medium, the potential scan was conducted for 30 min and the system was allowed to reach the open-circuit potential (OCP). Potentiodynamic polarization (PDP) data were collected at the OCP with − 250 to + 250 mV as potential range at a scan rate of 1 mV/s. The corrosion current density (icorr) and corrosion potential (Ecorr) were obtained by extrapolating the polarization curves, and the corresponding point of intersection to the Y-axis and X-axis gives Ecorr and icorr, respectively. The % IE was calculated using equation (Eq. 4) [19].

$${\text{IE}}(\% ) = \frac{{i_{{{\text{corr}}}} - i_{{\text{corr(inh)}}} }}{{i_{{{\text{corr}}}} }} \times 100.$$
(4)

Electrochemical impedance spectroscopic (EIS) studies were executed at the OCP in 0.01 Hz to 100 kHz as the frequency response by applying small amplitude of ac signal of 10 mV. The Nyquist plots obtained were used to analyse the impedance parameters such as charge transfer resistance (Rct), solution resistance (Rs) and double-layer capacitance Cdl after fitting into suitable equivalent circuits. Equation (Eq. 5) was used to calculate the % IE from the Rct values [20]

$$\% {\text{IE}} = \frac{{R_{{\text{ct(inh)}}} - R_{{{\text{ct}}}} }}{{R_{{\text{ct(inh)}}} }} \times 100$$
(5)

where Rct(inh) and Rct represent the charge transfer resistances with and without inhibitors, correspondingly. The Cdl was calculated using equation (Eq. 6) [21].

$$C_{{{\text{dl}}}} = \frac{1}{{2\pi f_{{{\text{max}}}} R_{{{\text{ct}}}} }}$$
(6)

where fmax is the frequency at which the impedance is maximum.

2.5 Surface Morphology Analyses

The MS samples were immersed in 0.5 M HCl alone and test solutions of 0.5 M HCl containing 1 mM inhibitors for 3 h. Later, these specimens were removed from the solution, washed using distilled water and dried. Then, the MS surfaces were microscopically analysed using SEM (SEM-EVO 18-5-57 model) and AFM (AFM-1B342 Innova model).

2.6 Theoretical Studies

Schrodinger Material Science Suite was used to perform DFT calculation using Gaussian Maestro material science software with B3LYP as the correlation factor and 631 + G as basis set to evaluate the necessary quantum chemical parameters [22]. The highest occupied and lowest unoccupied frontier molecular orbital's (EHOMO and ELUMO) energies were calculated, and these results were then used to compute other quantum chemical features [23, 24].

3 Results and Discussion

3.1 Gravimetric Analysis

Weight loss measurements were performed with the aim of assessing the influence of IAH and IBH concentrations on the rate of MS corrosion (CR), percentage inhibition efficiency (% IE) and surface coverage (θ) in 0.5 M HCl which were computed using equations Eqs. (1), (2) and (3), respectively.

The weight loss parameters calculated for both inhibitors in their various concentrations are presented in the table in Fig. 1. The addition of IAH and IBH in the corrosion medium reduces the CR of MS. Moreover, the % IE is found to rise with increasing inhibitor concentrations. The graphical representation of the escalating trend in % IE with increasing IAH and IBH concentrations is depicted in Fig. 1. These inferences are suggestive of adsorption of inhibitor forming a layer, which facilitates the isolation of MS surface from exposure to the corrosive medium. Between the indole hydrazides studied, IBH has been found to exhibit very high % IE of 96 at 1 × 10–3 M concentration with threefold reduction in the rate of MS corrosion compared to IAH. Besides, higher surface coverage (θ) value of IBH (0.96) compared to IAH (0.87) clearly demonstrates that IBH is superior to IAH in its effectiveness in preventing MS surface deterioration in HCl medium.

Fig. 1
figure 1

Plot of variation in inhibition efficiency versus inhibitor concentrations. Results of gravimetric analysis for MS corrosion without and with IAH and IBH at 30 °C

3.2 Electrochemical Investigations

3.2.1 Potentiodynamic Polarization (PDP) Studies

To further probe into the anticorrosion property of IAH and IBH on MS in 0.5 M HCl medium, polarization studies were carried out in five different concentrations ranging from 0.0001 to 0.001 M. The current–potential relationships for MS electrode in the studied test solutions are portrayed in Fig. 2. The presence of IAH and IBH in the corrosive environment affect the anodic as well as the cathodic parts of the Tafel plots leading to substantial reduction in both CR and icorr. This behaviour could be owing to the adsorption of these inhibitor molecules on the surface of MS, thus obstructing the reactive sites [25]. The relevant electrochemical parameters such as Ecorr, icorr, anodic (βa) and cathodic (βc) Tafel slopes and percentage efficiency for IAH and IBH are presented in Tables 1 and 2, respectively.

Fig. 2
figure 2

Tafel polarization plots for the MS corrosion behaviour in 0.5 M HCl with increasing concentrations of a IAH and b IBH

Table 1 PDP measurements for the MS corrosion in 0.5 M HCl without and with IAH
Table 2 PDP measurements for the MS corrosion in 0.5 M HCl without and with IBH

It is evident that the addition of inhibitors leads to the decrease of icorr, values which accordingly increased the % IE. This suggested the development of adsorbed inhibitor layer on MS surface, preventing its direct exposure to the corrosive acid media. Moreover, an increase in IAH and IBH concentrations has led to rise in % IE at all the three studied temperatures, and these results are comparable to that obtained from weigh loss studies. Although a slight anodic shift in the Ecorr values is observed, those being well within the defined range (< + 85 mV) indicate that both IAH and IBH predominantly act as a mixed-type inhibitor with more control over the anodic dissolution process [26]. Moreover, both the anodic and cathodic slopes remain unaffected in the presence of inhibitors, which specify that the molecules used in this study demonstrate their inhibition behaviour through an adsorptive mechanism [27].

The study of the effect of temperature on the CR and % IE enables the calculation of kinetic and thermodynamic parameters for corrosion and its inhibition process. These parameters are useful in interpreting the adsorption behaviour of the inhibitor molecules. Generally, CR increases with rise in temperature owing to the increased conductance of the medium. Further, the hydrogen over potential decreases with an increase in temperature, resulting in the increase in cathodic reaction rate in the absence of inhibitor [27]. The increase in inhibition efficiency with rise in temperature indicates the possible chemisorption of the inhibitor on the metal surface due to the greater electron densities at their adsorption centres. In the present study, CR decreases and in turn the % IE increases with rising concentration of both IAH and IBH at each studied temperature. However, the % IE decreases with an increase in temperature, and this interesting observation may be owing to the desorption tendency of the adsorbed inhibitors from the MS surface with rising temperature [28]. The temperature-dependent desorption feature thus indicates the physisorption tendency of the studied inhibitors on the MS surface.

3.2.2 Electrochemical Impedance Spectroscopy (EIS) Measurements

EIS is a vital tool employed to investigate the anticorrosion performance of metals and relies on the impedance measurement of the electrical double layer that exists at the metal–medium interface. The impedance data acquired are portrayed in the form of Nyquist plot, wherein the real and imaginary segments of the impedance are plotted along the x- and y-axis, respectively. The Nyquist plots of MS in 0.5 M HCl comprising differing IAH and IBH concentrations, categorized by a large depressed semicircle, are shown in Fig. 3a, b. The diameter of the depressed capacitive loops increase with rising IAH and IBH concentrations, which suggests that the course of corrosion is mostly controlled by the charge transfer phenomenon [29]. The depressed behaviour of the Nyquist plots is due to the surface roughness from the adsorption of inhibitors, deposition of corrosion products and the porous nature of the inhibitor film created on the metal surface. The point where high-frequency region of the curve meets the real axis of the Nyquist plot represents the resistance of the solution (RS). The charge transfer resistance (Rct) is responsible for the low-frequency intercept at the real axis. A simple three-element equivalent circuit model (RQR) (with χ2 value 9.34 × 10–4) is fitted into the impedance results obtained for IBH, which is depicted in Fig. 3c. Similar circuit has been used in the case of IAH also.

Fig. 3
figure 3

Nyquist plots for MS corrosion in 0.5 M HCl comprising varying a IAH and b IBH concentrations at 40 °C, and c equivalent circuit model to fit the EIS results for MS in 0.5 M HCl containing 1 × 10–2 M IBH at 313 K

The impedance of constant phase element (Q) has been employed to describe the suppression of the capacitive loop as in equation (Eq. 7) [30].

$$C_{{{\text{dl}}}} = Q \, \left( {\omega_{{{\text{max}}}} } \right)^{n - 1}$$
(7)

where Q denotes the constant phase element, ωmax relates to the frequency wherein the imaginary part of the impedance is maximum and n denotes the phase constant element. The n values deviating from unity indicate the behaviour of depressed semicircle due to surface inhomogeneity [31, 32]. If the value of n is 1, then Q performs like an idyllic capacitor. The minor deviation in capacitance to its real value is presented in terms of double-layer capacitance (Cdl).

The values of Cdl increases with an increase in temperature in the absence of inhibitors, which might be due to either desorption of the chloride ions at the metal surface causing a change in the double-layer structure or the increase in local dielectric constant and/or a decrease in the thickness of the electrical double layer [33]. The magnitude of the Cdl values decline with rise in inhibitor concentrations owing to the swapping of water molecules primarily adsorbed on the MS–media interface by IAH and IBH molecules. This may lead to the reduction of the local dielectric constant or rise in the electrical capacitor layer thickness formed at the metal–media interface [34]. Moreover, the increase in IAH and IBH concentration lead to elevated Rct owing to improved surface coverage of the inhibitors forming a thin shielding layer on the MS surface, thereby decreasing the CR. The parameters extracted from the Nyquist plot for IAH and IBH are presented in Tables 3 and 4, respectively.

Table 3 EIS parameters for MS corrosion in 0.5 M HCl comprising IAH of varying concentrations
Table 4 EIS parameters for MS corrosion in 0.5 M HCl comprising IBH of varying concentrations

The rise in Rct values with increasing concentrations of inhibitor suggests that MS corrosion is mainly controlled by the charge transfer process, and this result is in line with that obtained from PDP measurements. More inhibitor molecules get adsorbed on the MS surface with rising inhibitor concentration, thereby decreasing the CR [35]. The % IE obtained by EIS method is in line with those obtained in PDP and weight loss techniques and confirms the superior corrosion inhibition capacity of IBH over IAH.

3.3 Adsorption Isotherm

The adsorption isotherm considerations play a crucial role in deciding the mode of interaction between the inhibitor molecules and MS surface and also assist in governing the mechanism of corrosion inhibition by suitably fitting the experimental data to various adsorption isotherms. The surface coverage (θ) values specify the extent of IAH and IBH coverage on the MS surface for different concentrations. The most frequently used isotherm models to check their correlation to the experimental results are Temkin, Freundlich and Langmuir. The results of the present study indicate the best fitting to Langmuir’s adsorption isotherm as shown in Fig. 4a, b, and it is described by using Eq. 8 [36]:

$$\frac{{C_{inh} }}{\theta } = \frac{1}{K} + C_{inh}$$
(8)

where C symbolizes the concentration of the inhibitor and Kads signifies the equilibrium constant for the adsorption process. In the present case, the plots of Cinh/θ versus Cinh (Fig. 4) yield straight lines with the linear correlation coefficient (R2) values close to unity, which suggests that the adsorption of IAH and IBH in 0.5 M HCl medium on MS surface obeys the Langmuir adsorption isotherm. The slope ranges of these lines are 1.182–1.244 (IAH) and 1.129–1.48 (IBH) in the temperature range of 303 to 323 K, respectively, suggesting that the adsorbed molecules form monolayer on the MS surface and there is no interaction among the adsorbed inhibitor molecules.

Fig. 4
figure 4

Langmuir’s adsorption isotherm for the MS corrosion in 0.5 M HCl comprising a IAH and b IBH

The standard free energy of adsorption (ΔGads°) has been computed by using Eq. 9 [37].

$$K_{{{\text{ads}}}} = \frac{1}{55.5}\exp \left( {\frac{{ - \Delta G_{{{\text{ads}}}}^\circ }}{RT}} \right)$$
(9)

where Kads, R, T and 55.5 symbolize the adsorption constant, universal gas constant (8.314 J/mol/K), temperature (K) and molar concentration (mol/L), respectively. The standard enthalpy (ΔHads°) and standard entropy (ΔSads°) of adsorption have been calculated using the slope and intercept values obtained from the plot of ΔGads° versus T as shown in Fig. 5a, b [38].

Fig. 5
figure 5

Plot of ΔGads° versus T for the MS corrosion in 0.5 M HCl comprising a IAH and b IBH

Generally, the − ΔGads° value of ≤ 20 kJ mol−1 implies Coulombic electrostatic interactions that exist between the inhibitor molecules and the charged MS surface. On the contrary, ΔGads° value > 40 kJ mol−1 suggests bond formation between the inhibitor and MS surface, either through charge transfer or sharing [39]. The thermodynamic parameters related to inhibitor adsorption computed for IAH and IBH are displayed in Table 5. The obtained -ΔGads° values for IAH and IBH (33–35 kJ/mol) at all the three studied temperatures lie between 20 and 40 kJ/mol, which points towards a mixed type of adsorption on to the MS surface. However, the negative values of ΔHads° confirms the physisorption of both the studied inhibitor molecules, which is further established by the decrease in % IE observed with rise in temperature [40].

Table 5 Thermodynamic parameters for MS corrosion in 0.5 M HCl containing IAH and IBH

3.4 Surface Morphology Analysis

The SEM images of MS surfaces viewed to analyse the extent of damage done by corrosion with and without the inhibitors are presented in Fig. 6a–c. The MS specimen surface after immersion in 0.5 M HCl displays a very rough texture with numerous deep pits owing to severe electrochemical degradation. These observations can be explained on the basis of chloride (Cl) ion activity. The rough surface provides a nucleus for pit formation by removal of surface films, so that Cl can react directly with the metal and lead to accelerated metal dissolution [41]. However, relatively smooth metal surfaces with decreased number of pits and their depths are perceived on exposure to the medium containing the inhibitors. The surface morphology analysis thus indicates the creation of a protective inhibitor film, which acts as an isolating barrier between MS surface and aggressive acidic media. This adherent film facilitates excellent corrosion inhibition of the alloy, particularly in the presence of IBH.

Fig. 6
figure 6

SEM images of MS specimen immersed in a 0.5 M HCl, b IAH + 0.5 M HCl and c IBH + 0.5 M HCl. AFM images of MS specimen immersed in d 0.5 M HCl, e IAH + 0.5 M HCl and f IBH + 0.5 M HCl

Subsequently, AFM has been employed for microscale surface morphology analysis to probe the inhibitor effect on the corrosion at MS/media interface. The 3D AFM images for MS immersed in 0.5 M HCl and in 0.5 M HCl containing 0.01 M IAH and IBH, respectively, are displayed in Fig. 6d–f. The less deteriorated MS surface in the presence of IAH and IBH in comparison with the uninhibited one confirms the surface adsorption of the inhibitors. The average surface roughness (Ra) and root-mean-square (RMS) roughness (Rq) values obtained for the acid solution without and with inhibitors are given in Fig. 6. In the presence of IAH, the Ra and Rq values decrease when compared to the uninhibited solution, respectively. However, as expected, the Ra and Rq values for IBH are still lesser than IAH, which further establish its superior surface adsorption on MS and hence better anticorrosive behaviour.

3.5 Theoretical Studies

Quantum chemical calculations have been performed to further comprehend the donor–acceptor interactions amid MS and the studied hydrazides, as well as to analyse the relationship between inhibition potentials with their molecular structures. Figure 7 displays optimized molecular geometries, HOMO and LUMO structures of IAH and IBH molecules. The calculated values for EHOMO and ELUMO and the difference in their energy levels (ΔE), ionization energy (I), electron affinity (A), absolute electronegativity (χ), global hardness (η), softness (σ) and fraction of electron transferred (ΔN) and Mulliken charges on the studied inhibitor molecules are given in Table 6.

Fig. 7
figure 7

Optimized structures of a IAH and b IBH and HOMO and LUMO structures of c IAH and d IBH

Table 6 DFT parameters and Mulliken population analysis for IAH and IBH

The higher EHOMO values of the inhibitor represent greater electron contribution capabilities to the d-orbitals of Fe in MS, whereas the lower ELUMO values denote stronger electron acceptance tendencies from the metal [42, 43]. IBH exhibits the higher EHOMO value than IAH, which implies its greater tendency to give away electrons to electron deficient sites of Fe and its lower ELUMO value offers a better chance to accept charges through back-bonding during donor–acceptor associations with Fe. This favours better charge transfer facilitated adsorption of IBH compared to IAH onto MS surface. Further, the energy gap of the molecular orbitals (ΔE) displays a lower value in case of IBH, which suggests its tendency to be highly reactive [44].

Generally, the interaction between the metal surface and inhibitor has been discussed using HSAB (hard–soft–acid–base) principle [45]. Fe is considered to be a soft acid and will coordinate strongly with molecules having higher softness and displays high inhibition efficiency. Large values of softness (σ) of IBH are yet another molecular descriptor of reactivity and selectivity that is related to its better adsorption and in turn better inhibition efficiency. Besides, the lower the fraction of electron donation (ΔE) value, the higher the reactivity and hence the corrosion inhibition [46]. The tendency of the inhibitor molecule to donate the electrons to the metal surface is described based on the fraction of electron transferred (ΔN). As per literature [47], ΔN value must be less than 3.6 for an efficient inhibitor. The ΔN values obtained for both IAH and IBH are lower than 3.6, which specifies that their inhibition efficiencies stem from the electron-donating ability to the vacant d orbital of Fe. The greater fraction of electrons transferred by IBH (ΔN = 0.369) suggests the increasing electron-donating ability of IBH, which is well supported by the experimental results [48]. Lesser ionization energy is suggestive of higher chemical reactivity [49], and a trend of IBH < IAH for its value implies higher metal protection efficiency of IBH. Thus, the quantum chemical analysis data are in alignment with the experimental measurements obtained in the present study.

Mulliken charges on the atoms play a vital role in predicting the adsorption spots of the inhibitor molecule and also the electron-accepting and donating tendency between the metal surface and the inhibitor. The Mulliken charge population of IAH and IBH molecules is shown in Fig. 8. It is reported [50, 51] that the heteroatoms with more negative Mulliken charge are considered as active sites for the adsorption process. As depicted in Table 6, the oxygen and nitrogen atoms of IAH and IBH with more negative charge are found to be effective adsorption sites, preventing the corrosion of MS in acidic medium.

Fig. 8
figure 8

Mulliken charge population on a IAH and b IBH molecules

3.6 Corrosion Inhibition Mechanism

The adsorption of inhibitor molecules onto the MS–medium interface depicts the prime phase in the process of inhibitor action. Adsorption is mainly influenced by the physiochemical features of the inhibitor through electronic framework of the molecule, π-orbital character, electron density on the functional groups and donor atoms [52]. Generally, the driving force for the adsorption of inhibitor molecules onto the metal surface is through the interactions of non-bonded electrons and π-electrons in the inhibitor molecule with the metal or electrostatic interactions between the charged inhibitor molecules and the charged metal. The main anchoring groups in indole hydrazides that can maintain interactions with the free d-orbitals of Fe in MS are: oxygen which serves as a source of two non-bonded electron pairs, indole ring with delocalized π-electrons and nitrogen atom carrying one lone pair of electrons. Besides, two additional nitrogen atoms of the functional group also favour the hydrazide adsorption onto the MS surface. The protective film of IAH and IBH molecules on MS surface in 0.5 M HCl presented in the current study is through mixed adsorption, but predominantly physisorption [53].

The charge on the metal depends upon the value of the pHZch, which is defined as the pH at the point of zero charge potential. If the surface charge of MS at OCP is positive in the inhibited and uninhibited HCl solutions with respect to potential at zero charge, then it acquires positive charge on the metal surface and organic molecules get protonated in the acid medium [54]. The positively charged metal surface in HCl environment enables negatively charged chloride ions to adsorb on to the MS surface due to their smaller extent of hydration and hence converts the surface charge from positive to negative. Thus, these Cl ions synergistically increase the protection efficiency of most of the organic molecules. They facilitate improved adsorption of protonated IAH and IBH molecules on to the metal surface by forming intermediate channels amid negatively charged solid surface and positively charged inhibitor molecules. Consequently, transmission of corrosive ions such as Cl and hydronium ions can be hindered by the inhibitor film barrier, which can effectively protect the MS from corrosion by means of physical adsorption [55]. The schematic representation for electrostatic interaction and electron-pair interaction of IBH on to the MS surface is shown in Fig. 9.

Fig. 9
figure 9

Adsorption through a electrostatic approach between protonated inhibitors and MS surface and b electron-pair interaction

The inhibition efficiency of IAH and IBH is further compared with other reported inhibitors [7, 9,10,11,12] of similar type in Supplementary Table 7. 4-Hydroxy-N′-[(E)-(1H-indole-2-ylmethylidene)] benzohydrazide shows inhibition efficacy of 89% at 0.8 mM concentration by following Langmuir’s adsorption isotherm [9]. Indole-3-acetic acid and indole 5-carboxylic acid show 93% at 1 × 10–2 M in 0.5 M HCl and 92% at 4 × 10–3 M H2SO4, respectively, by obeying Langmuir adsorption isotherm [10, 11]. Quraishi et al. [12] investigated the effect of 3-amino-alkylated indoles on the corrosion behaviour of MS in 1 M HCl. The inhibition performances of the AAIs with cyclic amino substituents (AAI-2 and AAI-3) are higher than that of AAI-1 with an opened chain amino group. The inhibition potential has also been found to increase with increasing ring size of the cyclic amine, and this can be attributed to increasing molecular size/volume of the molecule, which corresponds to an increase in surface coverage. The overview of hydrazide derivatives [7] emphasizes the effect of most of the hydrazide derivatives as potential inhibitors for MS in acid medium. Hydrazide derivatives with additional heteroatoms (N, O, S), aromatic rings and electron-donating groups have shown better inhibition performance. From the table, it can be inferred that the IAH and IBH act as a potential inhibitor for corrosion inhibition of mild steel as it is showing nearly the similar inhibition efficiencies in comparison with the other reported inhibitors of this class. It is also seen that the maximum inhibition efficiency of IBH is obtained at a relatively lower concentration of (1 × 10−3 M) when compared to those reported in the table.

The corrosion resistance of MS in IBH (with n = 3)-containing HCl medium is much higher when compared to that in the medium-carrying IAH (n = 1). Thus, longer the methylene spacer between the aromatic indole ring and the functional group, the higher the inhibition efficacy of these hydrazides. IBH with extended methylene spacer has higher molar volume and hence greater surface coverage on MS specimen. Thus, it acts as a superior inhibitor compared to IAH. This experimental result is in accordance with earlier investigations, which states that inhibition property increases with rise in molecular volume or chain length [56]. Further, the nonpolar hydrophobic aliphatic hydrazide chain of the adsorbed inhibitor repels the polar medium and thereby forms a protective layer at the MS/HCl interface shielding the metal from corrosion. The molecular weight and size of the organic inhibitor also have an impact on the corrosion inhibition efficiency. A larger molecule with higher hydrophobic surface area thus impacts the inhibition efficiency by reducing the metal corrosion rate.

4 Conclusions

Indole-3-carboxylic acid hydrazides have not been explored as inhibitors against MS corrosion in HCl environment. This investigation highlights the comparative inhibitory characteristics of two hydrazides with one and three methylene units: 2-(1H-indol-3-yl)acetohydrazide (IAH) and 4-(1H-indol-3-yl)butanehydrazide (IBH) against MS corrosion that occurs in HCl media. The following conclusions can be drawn from the present work:

  • The inhibitor molecules IAH and IBH displayed inhibition efficiencies of 80% and 94% in 0.5 M HCl solution, presenting a mixed-type inhibition behaviour similar to earlier reports on indole-bearing inhibitor molecules and exhibited potential protection qualities against MS corrosion in 0.5 M HCl.

  • The adsorption of both the hydrazides was in agreement with Langmuir’s isotherm model. The physisorption of IAH and IBH on to MS was through the electrostatic interaction between the inhibitor molecules and the metal surface.

  • SEM and AFM analysis demonstrated the remarkable adsorption ability of the inhibitors on the MS surface, thereby blocking the reactive sites.

  • Theoretical calculations correlated well with the experimental data and further substantiated the higher inhibition efficacy of IBH. Thus, the presence of a longer methylene linker improved the surface area of adsorption and improved the corrosion inhibition of MS.