It is lawful for any person desiring to commence any civil action or special proceeding, or to defend the same, his agent or surety, to execute a mortgage on real estate of the value of the bond or undertaking required to be given, at the beginning of said action, or at any stage thereof, to the party to whom the bond or undertaking would be required to be made, conditioned to the same effect as such bond or undertaking, with power of sale, which power of sale may be executed upon a breach of any of the conditions of the said mortgage after advertisement for 30 days.
N.C. Gen. Stat. § 58-74-25