optimize webpack bundling, minimize gateway JS
This commit is contained in:
@@ -0,0 +1,32 @@
|
|||||||
|
# Overview
|
||||||
|
|
||||||
|
httXrp is a proof of concept for a truly serverless web architecture. If serverless simply means "a server owned by someone else", httXrp pushes that definition to its limit.
|
||||||
|
|
||||||
|
# How it works
|
||||||
|
|
||||||
|
## 1: Getting data into and out of the blockchain
|
||||||
|
|
||||||
|
Transactions on the ripple blockchain are allowed to carry up to 1kB of arbitrary data via the memo field.
|
||||||
|
We can use this to store data of any size by building a tree of references between these transactions that can then be reassembled by reading them back from the blockchain.
|
||||||
|
In order to generate these transactions a library called [xrpio](https://gitea.nitowa.xyz/npm-packages/xrpio.git) is used.
|
||||||
|
|
||||||
|
Highly simplified, you can visualize the process like this:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## 2: Abstracting the webserver away from the web
|
||||||
|
|
||||||
|
Using tools like `webpack`, it is possible to condense even modern complex single-page-applications into a single html file. As `xrpio` is written in JavaScript, it is even possible to embed it into such an HTML file, the use of which will become more clear a few paragraphs below.
|
||||||
|
|
||||||
|
Since such a condensed HTML file is effectively nothing more than a long string it is possible to use `xrpio` to store them into the ripple blockchain and to retrieve them via a single identifying hash.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## 3: Dynamic web applications without a backend
|
||||||
|
|
||||||
|
Superficially, this technique is limited to serving static webpages, as there is no *real* backend serving these pages. However, since it is possible to embed `xrpio` into such a "static" page, it is possible to listen for transactions on the Ripple blockchain containing valid xrpio hashes and to dynamically update the webpage's content based on the stored data.
|
||||||
|
|
||||||
|
# Credits
|
||||||
|
|
||||||
|
- This project was originally inspired by indImm (https://ndm-inf.github.io/ndm/main), a ripple-based file storage using IPFS.
|
||||||
|
- xrpio (https://gitea.nitowa.xyz/npm-packages/xrpio.git) is heavily used in the technical architecture of this project. It is also written and maintained by me.
|
||||||
@@ -5,6 +5,7 @@
|
|||||||
<script src="https://bundle.run/buffer@6.0.3"></script>
|
<script src="https://bundle.run/buffer@6.0.3"></script>
|
||||||
<script src="https://cdn.jsdelivr.net/npm/ripple-lib@1.10.0/build/ripple-latest-min.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/ripple-lib@1.10.0/build/ripple-latest-min.min.js"></script>
|
||||||
<script src="https://cdn.jsdelivr.net/npm/xrpl@2.1.1"></script>
|
<script src="https://cdn.jsdelivr.net/npm/xrpl@2.1.1"></script>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/xrpio@0.1.7/lib/browser/xrpio.browser.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
Loading ...
|
Loading ...
|
||||||
|
|||||||
Generated
+8
-7
@@ -9,9 +9,10 @@
|
|||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"buffer": "^6.0.3",
|
||||||
"chai": "^4.3.4",
|
"chai": "^4.3.4",
|
||||||
"node-fetch": "^2.6.1",
|
"node-fetch": "^2.6.1",
|
||||||
"xrpio": "^0.1.6",
|
"xrpio": "^0.1.7",
|
||||||
"xrpl": "^2.6.0-beta.0"
|
"xrpl": "^2.6.0-beta.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@@ -3684,9 +3685,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/xrpio": {
|
"node_modules/xrpio": {
|
||||||
"version": "0.1.6",
|
"version": "0.1.7",
|
||||||
"resolved": "https://registry.npmjs.org/xrpio/-/xrpio-0.1.6.tgz",
|
"resolved": "https://registry.npmjs.org/xrpio/-/xrpio-0.1.7.tgz",
|
||||||
"integrity": "sha512-SHm3NfrRv9i82OWrUdyB+Djn0Zr6qwwMfs/wemNR1pf2ajorfiOPpWnvKQTgAZcfgS2DliIfMuF8nRiqfXlmmg==",
|
"integrity": "sha512-X/Hxlf31KC1OONq7NYQ518Esd8LHYpyc/RFN9F1J9Nr8WEjgz/XaJDR4IakV7MrNeC3uIRz6/qGFPFWHw2Rr+g==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"ripple-lib": "^1.10.0",
|
"ripple-lib": "^1.10.0",
|
||||||
"xrpl": "^2.1.1"
|
"xrpl": "^2.1.1"
|
||||||
@@ -6717,9 +6718,9 @@
|
|||||||
"requires": {}
|
"requires": {}
|
||||||
},
|
},
|
||||||
"xrpio": {
|
"xrpio": {
|
||||||
"version": "0.1.6",
|
"version": "0.1.7",
|
||||||
"resolved": "https://registry.npmjs.org/xrpio/-/xrpio-0.1.6.tgz",
|
"resolved": "https://registry.npmjs.org/xrpio/-/xrpio-0.1.7.tgz",
|
||||||
"integrity": "sha512-SHm3NfrRv9i82OWrUdyB+Djn0Zr6qwwMfs/wemNR1pf2ajorfiOPpWnvKQTgAZcfgS2DliIfMuF8nRiqfXlmmg==",
|
"integrity": "sha512-X/Hxlf31KC1OONq7NYQ518Esd8LHYpyc/RFN9F1J9Nr8WEjgz/XaJDR4IakV7MrNeC3uIRz6/qGFPFWHw2Rr+g==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"ripple-lib": "^1.10.0",
|
"ripple-lib": "^1.10.0",
|
||||||
"xrpl": "^2.1.1"
|
"xrpl": "^2.1.1"
|
||||||
|
|||||||
+2
-2
@@ -17,10 +17,10 @@
|
|||||||
"author": "",
|
"author": "",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"buffer": "^6.0.3",
|
||||||
"chai": "^4.3.4",
|
"chai": "^4.3.4",
|
||||||
"node-fetch": "^2.6.1",
|
"node-fetch": "^2.6.1",
|
||||||
"xrpio": "^0.1.6",
|
"xrpio": "^0.1.7",
|
||||||
"buffer": "^6.0.3",
|
|
||||||
"xrpl": "^2.6.0-beta.0"
|
"xrpl": "^2.6.0-beta.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
(window as any).global = window;
|
|
||||||
(window as any).Buffer = (window as any).buffer.Buffer;
|
|
||||||
const rippleApi = require('xrpio')
|
|
||||||
window['xrpIO'] = rippleApi.xrpIO
|
|
||||||
|
|
||||||
+3
-4
@@ -1,8 +1,7 @@
|
|||||||
(window as any).global = window;
|
|
||||||
(window as any).Buffer = (window as any).Buffer || require('buffer/').Buffer;
|
|
||||||
(window as any).buffer = (window as any).Buffer
|
(window as any).buffer = (window as any).Buffer
|
||||||
import { xrpIO } from 'xrpio';
|
//import { xrpIO } from 'xrpio';
|
||||||
(window as any).xrpIO = xrpIO;
|
|
||||||
|
declare const xrpIO
|
||||||
declare const DATA_HASH: string
|
declare const DATA_HASH: string
|
||||||
|
|
||||||
const api = new xrpIO("wss://s.altnet.rippletest.net:51233")
|
const api = new xrpIO("wss://s.altnet.rippletest.net:51233")
|
||||||
|
|||||||
Reference in New Issue
Block a user