Fog computing systems are designed to provide localized computation, storage, and communication services in close proximity to the endpoint mobile and IoT devices. Fog service providers typically monetize their service usage via centralized payment mechanisms in unverifiable and non-transparent manner. Therefore, there exists a need for a trust-enabling payment mechanism whereby fog service providers should be incentivized or penalized based upon the continuous feedback from endpoint devices. We propose a decentralized reverse-bidding scheme developed using the key features of blockchain and smart contracts. We develop a solution that allows the users or devices to initiate the bidding process by making a request for services to be provided by nearby public fog nodes, and these fog nodes to make bid offers in return. The proposed scheme ensures that all fog nodes on the network can equally and fairly make offers to win the bid. The bidding process incorporates the automated payments at the end of the service. Our solution is implemented using Ethereum smart contracts. It also integrates a reputation system for fog nodes and imposes a penalty for misbehaving nodes. Our solution is fully decentralized and provides a high level of trust, transparency, and security. In the paper, we present the system architecture, implementation details, and show the correct functionality of the overall proposed solution. In addition, we provide performance, cost, and security analyses of the smart contract code to demonstrate its effectiveness and robustness against major security concerns. The results show that the cost of running the smart contract remained less than three cents with the current Ethereum price (i.e., 183.22 USD/Eth). We have also made our smart contract code publicly available on Github. 1