Imagine you are running a multi-national drug smuggling operation and you need to keep a ledger of payoffs to the authorities...
You can't trust anybody to keep this electronically on a centralised service so you decide to write this information to the Blockchain.
Only one person, the chief accountant, can make entries and "owns" the smart contract (and has the relevant skills to make direct transactions via his wallet of choice).
The rest of the cartel want to see the ledger entries (via their mobile devices or at their desktops) to ensure their guys are getting the correct amounts.
The cartel are very cocky and are happy with the public nature of the Blockchain transactions as they use a two letter code for all their dodgy counterparts.
A contract called SimpleLedger has one function recordEntry
that can be called by the owner
of the contract to commit new entries to the ledger.
The ledger is held as a simple mapping (bytes2 => int256)
data structure, for example, "AG" -> 2543
Ropsten @ 0x0C3dc5ec9106CF7c5702430e727De76786fb3C9e
Remember reads on a Blockchain are free
index.html is a one pager that connects to a hosted node provided by Infura and uses ethers.js a JavaScript helper library to interact with the Ethereum Blockchain.
In our application the contract specifics are configured and then calls to the SimpleLedger contract return entries that can be displayed.
JQuery is used solely to process the results and manipulate the page DOM and display information from the Blockchain.
Firebase is used only for hosting, hence the config files but no remote centralised database is used