Dopamine’s “Hello World”

A short glimpse into coding using Dopamine.ai API

By Uri Yerushalmi

A “Hello World” program is often the very first program I look for when I am new to a language, API, or technology. That’s why we have chosen to use this type of example to initiate the “Dopamine.ai” bootcamp on github.

Dopamine’s Bootcamp

The “Bootcamp” is a repository on github that will gradually include many well documented code samples that will be available to Dopamine developers. Presently, Dopamine’s API is in Python, so we wrote the first sample as a set of Jupyter notes. Interested developers will find other useful resources within the Bootcamp pages, like an explanation of our modeling diagram language.

“Hello World”

This sample demonstrates the simplest usage of Dopamine’s API: purchasing the data of an image in exchange for DOPA tokens.

The sample is currently running on an Etherum testnet (ropsten), and is provided to solicit your feedback on Dopamine’s API. The sample is based on the dopapy API, which has not been released yet.

This sample provides an example for both sides: seller (provider) vs buyer (consumer). Many of the code lines are similar on each side. For example, both the buyer and seller will create a session that serves from a given IP/port and is based on a given wallet. Both sides will then check their wallet balance. Example below!

Seller side

The seller side needs to:

  • Indicate where the image to be sold is located.
  • Describe the image, so that the buyer knows what he’s paying for
  • Create a quote, indicating how many tokens he requests in return for the image.
  • Place the quote on the Dopamine network so others can interact with it.

Buyer side

The buyer side needs to:

  • Indicate with whom the buyer wishes to trade. (This part is simplified for a “Hello World” case. In future versions we will present how counter quotes can be found via the blockchain and the Dopamine board).
  • Describe what type of service the buyer expects to receive.
  • Create a quote, indicating how much the buyer is willing to pay for the service (specific number of tokens).
  • Make the deal and acquire the image.

That’s it… these few lines of code are all that’s required to purchase an image on the Dopamine network. No additional configurations are required, making the entire process simple and efficient.

What’s not presented here …yet

Hopefully, the simplicity of the example above has left you interested in hearing more complex examples and details. In future samples, we will present more layered and intriguing versions of the AI deals that we can base on the Dopamine network, along with Dopamine’s certificate mechanism and much more. Please stay tuned. Looking forward to your input!

www.dopamine.ai
Like what you read? Give Uri Yerushalmi a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.