5

I am trying to create an application using ethereum ,where node.js has used to call methods of smart contract and angular as frontend . I want to use the metamask wallet so my apication can automatically detect it and wallet holder can use the functionality of the platform by using multiple methods of smart contract.

But, I suppose it needs the injected web3 provided by metamask . How i can sent that injected web3 to the node layer, so it can use web3 functionality.

Any support is admirable .

3 Answers 3

3

In general any of your JavaScript code that runs in the browser should automatically be able to read web3, or more precisely window.web3, once the page is loaded.

See the Metamask README for the normal way to check for web3 and tell it what node to talk to. You may also be interested in Better pattern to detect web3 default account when using metamask for discussions on alternative ways to handle this.

(It's possible that there may be some particular issue with Angular - if you're running into one, please post again saying what's happening.)

0

How i can sent that injected web3 to the node layer, so it can use web3 functionality.

Not at all. With metamask, Web3 is an object injected into the site the user is on. You cannot "send" it to a nodejs application.

1
0

You need to require the web3 package in your node.js application. See https://www.npmjs.com/package/web3 for details.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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