Reader small image

You're reading from  Mastering Blockchain - Fourth Edition

Product typeBook
Published inMar 2023
PublisherPackt
ISBN-139781803241067
Edition4th Edition
Concepts
Right arrow
Author (1)
Imran Bashir
Imran Bashir
author image
Imran Bashir

Imran Bashir has an M.Sc. in Information Security from Royal Holloway, University of London, and has a background in software development, solution architecture, infrastructure management, and IT service management. He is also a member of the Institute of Electrical and Electronics Engineers (IEEE) and the British Computer Society (BCS). Imran has extensive experience in both the public and financial sectors, having worked on large-scale IT projects in the public sector before moving to the financial services industry. Since then, he has worked in various technical roles for different financial companies in Europe's financial capital, London.
Read more about Imran Bashir

Right arrow

Interacting with contracts via frontends

It is desirable to interact with the contracts in a user-friendly manner via a webpage. It is possible to interact with the contracts using the web3.js library from HTML-/JS-/CSS-based webpages.

The HTML and JavaScript frontend

The HTML content can be served using any HTTP web server, whereas web3.js can connect via local RPC to the running Ethereum client (geth) and provide an interface to the contracts on the blockchain. This architecture can be visualized in the following diagram:

Figure 15.2: web3.js, frontend, and blockchain interaction architecture

If web3.js is not JavaScript frontend already installed, use these steps; otherwise, move on to the next section, Interacting with contracts via a web frontend.

Installing Web3.js JavaScript library

Web3, which we discussed earlier in this chapter, was looked at in the context of the Web3 API exposed by geth. In this section, we will introduce the Web3 JavaScript library (web3.js), which is...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Mastering Blockchain - Fourth Edition
Published in: Mar 2023Publisher: PacktISBN-13: 9781803241067

Author (1)

author image
Imran Bashir

Imran Bashir has an M.Sc. in Information Security from Royal Holloway, University of London, and has a background in software development, solution architecture, infrastructure management, and IT service management. He is also a member of the Institute of Electrical and Electronics Engineers (IEEE) and the British Computer Society (BCS). Imran has extensive experience in both the public and financial sectors, having worked on large-scale IT projects in the public sector before moving to the financial services industry. Since then, he has worked in various technical roles for different financial companies in Europe's financial capital, London.
Read more about Imran Bashir