Starting with IPFS (HTML and Javascript code to load a file in your IPFS Server)

Starting with IPFS (HTML and Javascript code to load a file in your IPFS Server)

29 April, 2019 0 By Raul Pelaez

The Interplanetary FileSystem (IPFS) is sometimes complicated to understand.

With this example we will try to start an IPFS Server. Follow these instructions: How to install Embark by Status in MacOS (Ethereum Dapp development)

Run: ipfs daemon to start the Service

Captura de pantalla 2019-04-29 a las 19.18.30.png

You can open another terminal window and run: ipfs swarm peers to see the nodes connections

Captura de pantalla 2019-04-29 a las 19.24.37.png

Once the server is up and running, you can try to add a website in the server with a simple HTML page.

The Javascript code:

Captura de pantalla 2019-04-29 a las 19.51.19.png

Remember, this code uses these Javascript libraries:

You can try and test:

Basically is push a file, WAIT a moment, and after some little time requested, the file will appear in the IPFS network. Example:

Captura de pantalla 2019-04-29 a las 19.18.19.png

Captura de pantalla 2019-04-29 a las 19.25.19.png

By Ankonan

 

More from Ankonan.io