0

I would like to create a web front end with as less friction as possible for new users. The app would be a kind of explorer with all calls to blockchain as read only to getter functions. So is there a way I can use ethers.js (or web3) so that users are not forced to have metamask when the functions called by the front end don't need to sign a transaction? In ethers.js it seems I can replace the signer parameter with the provider parameter but it still requires users to have installed metamask. On the contrary with bitcoin explorers we don't need anything like metamask to read only the blockchain, is it different for ethereum and all apps have to make sure their users have an equivalent to metamask installed?

Best regards

  • 1
    I'm not sure what the libraries require but for reading there is no need for transactions so there shouldn't be a need for metamask - the calls are only local to the node you use to connect to the blockchain – Lauri Peltonen Jul 6 at 14:48
1

Yes, of course you can skip MetaMask. What you could do is install web3 inside your project and make connection with running blockchain node. If you dont want to run your own node then you can use Infura ( they are letting you use their blockchain node ). This way you can track events, transactions, eth and token balances, etc. After deciding which way to go you need to setup your web3 library to work with the blockchain you want.

Example using Infura:

const Web3 = require('web3');
const web3_instance = new Web3(new Web3.providers.HttpProvider('https://mainnet.infura.io/v3/<API_KEY>'));

Example using local blockchain which is running on port for example 9545 ( You can setup on which port you want the blockchain to be running ):

const Web3 = require('web3');
const web3_instance = new Web3(new Web3.providers.HttpProvider('http://localhost:9545'));

Also for only reading the blockchain you don't have to worry for signing transactions, but if you need this logic on later stage you can always implement sendSignedTransaction web3 method.

I have a project which is running and signing transactions without the help of 3rd party (MetaMask), but users have the option to choose if they want to stick to my custom solution or continue using their MetaMask extension. I did that, because some people feel comfortable using MetaMask.

| improve this answer | |
  • Thanks for your answer. So with your custom solution how users can sign, you created your own extension? Does your solution keep the private keys of your users private or you created a simpler solution to make it more user friendly? Best regards – Kevin Wad Jul 7 at 7:53
  • My solution does not include private key store, I ask people to attach the private key on each transaction sign or allow them to browser cache their keystore file. Then on each transaction sign they don't have to search for the private key and paste it everytime ( nobody will remember the key ), but when the keystore file is cached they only have to "unlock" it by entering their secret password. I think storing private keys inside the app is not good idea, because that's not really decentralized app - if hacker reaches the private keys then your users will end up loosing their assets. – Miroslav Nedelchev Jul 7 at 11:50

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