forked from SmartTokenLabs/TokenScript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDataDriven.html
67 lines (66 loc) · 5.85 KB
/
DataDriven.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<!DOCTYPE html
SYSTEM "about:legacy-compat">
<html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><meta name="copyright" content="(C) Copyright 2020"><meta name="DC.rights.owner" content="(C) Copyright 2020"><meta name="DC.type" content="concept"><meta name="description" content="TokenScript takes a data-driven, event-driven design approach"><meta name="DC.format" content="HTML5"><meta name="DC.identifier" content="concept_oql_t3s_pmb"><link rel="stylesheet" type="text/css" href="css/commonltr.css"><link rel="stylesheet" type="text/css" href="css/custom.css"><title>Data/Event Driven</title>
<link href="https://fonts.googleapis.com/css?family=Roboto+Slab|Lato">
<script type="text/javascript" src="https://alphawallet.com/wp-content/themes/alphawallet/discourse/widget.js"></script>
</head><body id="concept_oql_t3s_pmb"><header role="banner"><nav class="navbar navbar-expand-lg navbar-dark bg-dark mb-4">
<div class="container">
<a class="navbar-brand" href="/">🆃okenScript</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item"><a class="nav-link" href="/TokenScript.html">Documents</a></li>
<li class="nav-item"><a class="nav-link" href="/guides/Intro.html">Guides</a></li>
<li class="nav-item"><a class="nav-link" href="/specs/Intro.html">Specs</a></li>
<li class="nav-item external"><a class="nav-link" href="">TokenScript community forum</a></li>
<li class="nav-item external"><a class="nav-link" href="/TokenScript.html">AlphaWallet (uses TokenScript)</a></li>
<li class="nav-item external"><a class="nav-link" href="/guides/Intro.html">Github TokenScript</a></li>
<li class="nav-item external"><a class="nav-link" href="/specs/Intro.html">Github TokenScript Examples</a></li>
</ul>
</div>
</div>
</nav></header><div class="container" id="content"><div class="row"><nav role="toc" class="col-lg-3"><ul></ul></nav><main role="main" class="col-lg-9"><article role="article" aria-labelledby="ariaid-title1">
<h1 class="title topictitle1" id="ariaid-title1">Data/Event Driven</h1>
<div class="body conbody"><p class="shortdesc">TokenScript takes a data-driven, event-driven design approach</p>
<p class="p">If a Dapp needs data from the blockchain, it can call a smart contract to ask for these
data. The call is then routed to a blockchain node, and the Dapp would wait a few
seconds for the call to return.</p>
<p class="p">This works well in the scenario that a user accesses a website that runs the Dapp.
But:</p>
<div class="p">
<ol class="ol" id="concept_oql_t3s_pmb__ol_qsz_234_2nb">
<li class="li">The Dapp has to repeatedly enquire the blockchain to get the updates of the
data;</li>
<li class="li">If the Dapp is not running in a user's device, the user won't get the
update.</li>
</ol>
</div>
<p class="p">For example, if an AAVE token is nearing its liquidation position, a Dapp running as a
website can check the current collateralisation position and provide a warning. But, if
the Dapp is not running, for example, the user is jugging, the user would not have
learned of the dangerous situation. His main user agent - the wallet - remains dumb.</p>
<p class="p">Even the existence of such a "host Dapp", run by the token's issuer, might be called into
question. With the example of a Car Ownership Token, an accident might have written off
a car. Yet, a loan application (a "connected-system") may still try to sell the user a
line of credit by collateralising the car. The connected applications can't be running
the host Dapp themselves.</p>
<p class="p">Instead of needing a host Dapp to repeatedly enquiring the blockchain for data updates,
in TokenScript's design <a class="xref" href="Attributes.html" title="Define attributes so that token data becomes available to Cards and Websites.">Attributes</a> define a token's relevent data.
This allows a <a class="xref" href="Engine.html" title="A TokenScript engine runs TokenScript">TokenScript Engine</a> to subsitute the service of such a "host Dapp"
in the user's wallet or a system.</p>
<p class="p">In TokenScript, a <a class="xref" href="Engine.html" title="A TokenScript engine runs TokenScript">TokenScript Engine</a> is at work on the web or in user's wallet.
It maintains a set of token attributes and utilises the declarations in TokenScript
file:</p>
<ol class="ol" id="concept_oql_t3s_pmb__ol_pyb_mls_pmb">
<li class="li">How to fetch relevant data for tokens. For example, how to extract data from a smart
contract function calls, to listen to an oracle or to examine an attestation.</li>
<li class="li">Which event might trigger which token attributes or status to update.</li>
<li class="li">What kind of events or changes are worth triggering higher level UX logic, for
example, producing a warning, or trigger a pre-signed deal to execute.</li>
</ol>
<p class="p">This is achieved by having Token Attributes, events and data modules declared in a
TokenScript file in a XML dialect, and having them signed by a Token Issuer.</p>
</div>
</article></main></div></div></body></html>