Section 3. Whoever is injured by the failure of a licensed warehouseman to perform his duty or his violation of any provision of this chapter may bring an action for his own benefit, in the name of the commonwealth, on the bond of such warehouseman. The writ shall be endorsed by the person in whose behalf such action is brought, or by some other person satisfactory to the court; and the endorser shall be liable to the defendant for any costs which he may recover in such action, but the commonwealth shall not be liable for any costs.