2015-05-24 13:07:19 +00:00
< html >
< head >
< title > Embark - SimpleStorage Demo< / title >
2018-01-03 17:42:48 +00:00
< script src = "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js" > < / script >
2018-01-12 21:33:16 +00:00
< script src = "js/dapp.js" > < / script >
2015-05-24 13:07:19 +00:00
< / head >
2016-05-23 15:10:24 +00:00
< body class = "container" >
2017-01-26 11:29:17 +00:00
< h3 > Embark - Usage Example< / h3 >
2015-05-24 13:07:19 +00:00
2017-01-26 11:29:17 +00:00
< ul class = "nav nav-tabs" role = "tablist" id = "myTabs" >
< li role = "presentation" class = "active" > < a href = "#blockchain" aria-controls = "blockchain" role = "tab" data-toggle = "tab" > Blockchain< / a > < / li >
2017-02-17 23:11:20 +00:00
< li role = "presentation" > < a href = "#storage" aria-controls = "storage" role = "tab" data-toggle = "tab" > Decentralized Storage (IPFS)< span class = "pull-right" id = "status-storage" > < / a > < / li >
< li role = "presentation" > < a href = "#communication" aria-controls = "communication" role = "tab" data-toggle = "tab" > P2P communication (Whisper/Orbit)< span class = "pull-right" id = "status-communication" > < / span > < / a > < / li >
2017-01-26 11:29:17 +00:00
< / ul >
< div class = "tab-content" >
< div role = "tabpanel" class = "tab-pane active" id = "blockchain" >
< h3 > 1. Set the value in the blockchain< / h3 >
< div class = "form-group form-inline" >
< input type = "text" class = "text form-control" value = "10" >
< button class = "set btn btn-primary" > Set Value< / button >
< p > Once you set the value, the transaction will need to be mined and then the value will be updated on the blockchain.< / p >
< / div >
2015-05-24 13:07:19 +00:00
2017-01-26 11:29:17 +00:00
< h3 > 2. Get the current value< / h3 >
< div class = "form-group" >
< div >
current value is < span class = "value" > < / span >
< / div >
< button class = "get btn btn-primary" > Get Value< / button >
< p > Click the button to get the current value. The initial value is 100.< / p >
< / div >
< h3 > 3. Contract Calls < / h3 >
< p > Javascript calls being made: < / p >
< div class = "logs" >
< / div >
2016-05-23 15:10:24 +00:00
< / div >
2017-01-26 11:29:17 +00:00
< div role = "tabpanel" class = "tab-pane" id = "storage" >
2017-02-17 23:11:20 +00:00
< div class = "error alert alert-danger" role = "alert" > The node you are using does not support IPFS. Please ensure < a href = "https://github.com/ipfs/js-ipfs-api#cors" target = "_blank" > CORS< / a > is setup for the IPFS node.< / div >
< div id = "storage-controls" >
2017-01-26 11:29:17 +00:00
< h3 > Save text to IPFS< / h3 >
< div class = "form-group form-inline" >
< input type = "text" class = "ipfsText text form-control" value = "hello world!" >
< button class = "setIpfsText btn btn-primary" > Save< / button >
< p > generated Hash: < span class = "textHash" > < / span > < / p >
< / div >
< h3 > Load text from IPFS given an hash< / h3 >
< div class = "form-group form-inline" >
< input type = "text" class = "textHash text form-control" size = "60" >
< button class = "loadIpfsHash set btn btn-primary" > Load< / button >
< p > result: < span class = "ipfsText" > < / span > < / p >
< / div >
< h3 > upload file to ipfs< / h3 >
< div class = "form-group form-inline" >
< input type = "file" class = "form-control" >
< button class = "uploadFile set btn btn-primary" > upload< / button >
< p > generated hash: < span class = "fileIpfsHash" > < / span > < / p >
< / div >
< h3 > Get file or image from ipfs< / h3 >
< div class = "form-group form-inline" >
< input type = "text" class = "fileIpfsHash form-control" size = "60" >
< button class = "loadIpfsFile set btn btn-primary" > Load< / button >
< p > file available at: < span class = "ipfsFileUrl" > < / span > < / p >
< p > < img class = "ipfsImage" src = "" > < / p >
< / div >
2015-05-24 13:07:19 +00:00
2017-01-26 11:29:17 +00:00
< p > Javascript calls being made: < / p >
< div class = "logs" >
< br > EmbarkJS.Storage.setProvider('ipfs',{server: 'localhost', port: '5001'})
< / div >
2017-02-17 23:11:20 +00:00
< / div >
2017-01-26 11:29:17 +00:00
< / div >
< div role = "tabpanel" class = "tab-pane" id = "communication" >
2017-02-17 23:11:20 +00:00
< div class = "error alert alert-danger" role = "alert" > The node you are using does not support Whisper< / div >
2017-06-28 01:05:13 +00:00
< div class = "errorVersion alert alert-danger" role = "alert" > The node uses an unsupported version of Whisper< / div >
2017-02-16 20:52:03 +00:00
< div id = "communication-controls" >
2017-01-26 11:29:17 +00:00
< h3 > Listen To channel< / h3 >
< div class = "form-group form-inline listen" >
< input type = "text" class = "channel text form-control" placeholder = "channel" >
< button class = "listenToChannel set btn btn-primary" > Start Listening< / button >
< div id = "subscribeList" > < / div >
< p > messages received:< p >
< div id = "messagesList" > < / div >
< / div >
< h3 > Send Message< / h3 >
< div class = "form-group form-inline send" >
< input type = "text" class = "channel text form-control" placeholder = "channel" >
< input type = "text" class = "message text form-control" placeholder = "message" >
< button class = "sendMessage set btn btn-primary" > Send Message< / button >
< / div >
< p > Javascript calls being made: < / p >
< div class = "logs" >
< br > EmbarkJS.Messages.setProvider('whisper')
< / div >
2017-02-16 20:52:03 +00:00
< / div >
2017-01-26 11:29:17 +00:00
< / div >
2015-05-24 13:07:19 +00:00
< / div >
< / body >
< / html >