Skip to content

Tipping

Milen Radkov edited this page Dec 30, 2019 · 10 revisions

Tipping

One of the features waellet allows is sending value to any URL on the web. This is done using smart contracts and oracles in on aeternity blockchain.

Architecture

           +-----------------+
           |                 |
+----------+   waellet       +-----------+
|          |                 |           |
|          +-----------------+           |
|                                        |
|    +------------------------------+    |
|    |                              |    |
|    |  tipping contract            |    |
|    |                              |    |
|    |  +----------+  +----------+  |    |
|    |  | tip()    |  | claim()  |  |    |
+------->          |  |          <-------+
     |  +----------+  +----+-----+  |
     |                     |        |
     +------------------------------+
                           |
                           |
                           v
                      +----+-----+
                      |          |
                      |  oracle  |
                      |          |
                      +----------+

Workflow

Waellet is calling the tip jar smart contract's methods in order to provide this decentralized (semi-trusted) value transferring in a simple manner as possible.

When user wants to send value to a given URL the tip() method is being called passing the given value, URL and optionally a note:

  payable stateful entrypoint tip (url: string, note: option(string)) : unit =
    put(state{ tips[(url, size(url))] = new_tip(url, note),
               tips_flat[url = 0] @ n = n + 1 })
    Chain.event(TipReceived(Call.caller, Call.value, url))

Tip

In order to send value in the form of a tip to a given URL, you need to go to the Utilities > Tip website and scroll to the Send a tip section.

image

Add the amount that you want to send and optionally put a tip-note in the text field.

image

image image

image

Claim

In order to claim tips for certain URL one needs to provide public key somewhere in the DOM of the page for this URL.

The waellet extension will verify whether a public key is present there and if it is matching the current logged account making the Claim button active.

The Claim button is initiating a contract call to the tipping contract's claim() method - which will verify and transfer the tips value.

Clone this wiki locally