1

I wonder if there are any tutorials / guides out there that explain how to create your own web3 provider (like metamask), what to consider when creating one, how to handle security/privacy issues, what are the best practices and such..

I know for example that web3 provider, should implement the web3.js library, and to export some of its functions for external use. and if for example I want to create a chrome extension, my provider should inject the web3 object into the host window.

I know that my question is too general, but I am looking for some guidance basically, just to give me a lead to start.

Just to be clear, I am looking for a way to build a chrome extension that will be the web3 provider, in other words I want to build my own Metamsk / parity extension

3

You are asking about very niche and complex problem, so one cannot expect ready made tutorials to be available.

I would suggest

0

If you are asking "how to build a web app to interact with an ethereum chain", then there is no proper tutorial (or at least not complete ones).

What you can do is to follow nodeJS tutorials. The only difference for a completely client sided web application is that you include web3js inside the html page.

The alreayd built file to include web3js in your html page is here (web3.min.js)

This will allow you to do this:

<script type="text/javascript" src="/web3-min.js"></script>

It will export to your application the "web3" variable. You can, for example, do the following:

    if (typeof web3 !== 'undefined') {
            web3 = new Web3(web3.currentProvider);
        } else {
            // set the provider you want from Web3.providers
            web3 = new Web3(new Web3.providers.HttpProvider("PROVIDER"));
        }

document.getElementById("sampleTest").innerHTML = web3.eth.getBalance("0x52bc44d5378309EE2abF1539BF71dE1b7d7bE3b5") ;
  • 1
    Thanks for the answer, I know how to build a daap to interact with web3, I am looking to build a chrome extension that provide dapps the ability to interact with the blockchain. in other words, I want to build a chrome extension that similar to Metamask – Or Bachar Jun 5 '18 at 16:33
  • Still the same, @OrBachar , import the web3.min.js file (if you can, not sure in extension), and use it, no? – Florian Castelain Jun 5 '18 at 16:52
  • yeah I think, that's the whole idea, I am still investigating. – Or Bachar Jun 5 '18 at 20:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.