3

Assume we have a variable in a smart contract. When it reaches a certain value (as a result of interacting with), it posts an advert on social media, like Facebook, and pays for it.

Question: Is it possible that a smart contract automatically places an advert on social media and pays for it?

4

No, a contract can't manipulate outside world. Either from or to the outside world.

To get data from the outside world you then need to use what we call oracles.

To make a contract act on the outside world you'll have to set an event listener on your node and run a program when receiving the expected event. This program could then call a web API to place an ad.

Next if you imagine Facebook being able to accept ETH to pay for an ad, then it means that they will probably directly monitor the ethereum chain and provide a smart contract to place ads. You'll then simply have to call this contract from yours and pay the ad using your contract balance. But this is actually not possible with FB as far as I know.

Edit: As you ask in your comment if a 3rd party could be a relay to place ads on FB, yes posting the ad could probably be done automatically from the 3rd party that hosts the node as FB publish an API . Payment is probably (I didn't check the API in detail) made using bank account or card and your 3rd party should transfer ETH to fiat on his account to keep it positive.

A proof that ad is well placed on FB could be retrieved by another 3rd party actor as an oracle using the activity API. If your ad is not put on FB within a delay you define when calling the ad contract, you could be refunded by the ad contract thus forcing the 3rd party to place your ad in the expected delay.

  • thanks for the answer. So the simplest solution at the moment would be that there's an advertising 3rd party who has a smart contract (contract A), and upon receiving a message and payment from anyone (e.g. contract B), contract A's creator manually puts an advert on behalf of contract B on the FB and sends proof of payment and the advert to contract B. Am I right? – Ay. Sep 11 '17 at 16:48
  • @AdrianAd yes you are, and I edited my answer to develop this mechanism with a 3rd party. – Nicolas Massart Sep 11 '17 at 17:14
  • @AdrianAd if you got the answer accept it by clicking the right mark or get it clarified if you are still not clear – Achala Dissanayake Sep 11 '17 at 17:48
  • @AchalaDissanayake we have time, don't be so impatient and let him time to think if the answer fits his needs... – Nicolas Massart Sep 11 '17 at 17:51
  • Cool , true enough. I have seen some users do not accept after getting the answer. Anyway will see – Achala Dissanayake Sep 11 '17 at 17:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.