The essence of the pact in the story is that the smith agrees to surrender his soul in exchange for a remarkable ability: the power to weld any materials together. This unique ability is what sets the stage for the twist in the tale.
Using his newfound power, the blacksmith devises a clever plan to outwit the supernatural entity. He does this by using his power to weld the entity to an immovable object, such as a tree or a rock. By doing so, the blacksmith traps the being, effectively breaking the pact and saving his soul from damnation.
I got go watch that movie for like the thousandth time again thank you.