Which request is used for sending a const account wallet value to a server?

Hello, if I connect to website via MetaMask, I know that my wallet can be displayed by JavaScript.

Which request would I use for sending a account value to server? I think the server will probably be running NodeJs.

const ethereumButton = document.querySelector('.enableEthereumButton');
const showAccount = document.querySelector('.showAccount');

ethereumButton.addEventListener('click', () => {
  getAccount();
});

async function getAccount() {
  const accounts = await ethereum.request({ method: 'eth_requestAccounts' });
  const account = accounts[0];
  showAccount.innerHTML = account;
}

Thank you

2 Likes

@david21

You do not need a server - this is a step towards centralization. A smart contract completely replaces the server.

3 Likes

I know but if I would like to work with address due to analytics, is there any way?

1 Like

@david21

Get analytics addresses directly from your contract.
Any interaction with the contract is public.

2 Likes

This topic was automatically closed after 30 days. New replies are no longer allowed.