Section 28. A person to whom a debt is due for labor performed in constructing a building, sewer or drain, or water works or other public works owned by a city or town, under a contract with any person having authority from or rightfully acting for such city or town in furnishing such labor, shall have a right of action against such city or town to recover such debt if, within thirty days after he ceases to perform such labor, he files in the clerk's office of the city or town against which he claims such right of action a written statement under oath of the amount of the debt so due to him, and the names of the persons for whom and by whose employment the labor was performed and pays to the said clerk the fee provided by clause (61) of section thirty-four of chapter two hundred and sixty-two, and if, within sixty days after he ceases to perform such labor, he commences such action. Such right of action shall not be lost by reason of a mistake in stating the amount due; but the claimant shall not recover as damages a larger amount than is named in such statement as due to him, with interest. No person who has contracted to furnish labor other than his own in such construction shall have such right of action.