Neo SPCC has released a follow up to the first part of its NeoFS Beginners Guide, this time introducing HTTP gateways. The article picks up where the first part of the guide left off, which showed users how to upload data to NeoFS using the CLI. A second article also shows how to use N3 oracles to retrieve data from NeoFS in smart contracts.
In the new article, the team shows how objects uploaded to NeoFS can be easily delivered to users through HTTP gates. Additionally, an example is given for hosting a decentralized blog on NeoFS.
Gateways are intended to make it easy for developers to integrate existing applications with NeoFS whilst also making it easier for users to consume content stored on the network. They are also the key components in NeoFS.CDN, a decentralized distributed content delivery and storage system. More information on the CDN and how users can operate their own HTTP gateways will be shared in future articles.
NeoFS in smart contracts
Another article released by Neo SPCC provides a more detailed look at the built-in oracle implementation in Neo N3. In addition to its use in retrieving information from the traditional Internet, N3 oracles also allow data stored on NeoFS to be accessed and manipulated.
In most platforms, smart contracts are limited to the data available on-chain, but storing large quantities of data on-chain is expensive. This makes decentralized storage networks like NeoFS very convenient, which can provide reliable availability guarantees at a significantly lower cost.
Neo SPCC uses a multiplayer dApp game with an item shop as an example. Item information could be stored in JSON format, with objects for each item with various parameters such as ID, description, price, name, etc. Storing lots of items on-chain would quickly become very expensive.
With NeoFS, a developer could shift all this data off-chain. Backend game and transaction logic would be implemented in smart contracts, but the item data could be stored on NeoFS and fetched through an oracle request whenever required. Meanwhile, on the frontend game client, the item information can be delivered quickly through a HTTP or S3 gateway.
The article walks the reader through the implementation of such functionality into a contract, including oracle requests and callbacks. The full source code can be found here, and the sample JSON data is available here.