4

From what I understand, a wallet is a smart contract and in order to create a wallet, you need to deploy the contract to the blockchain as stated here, which is different from creating accounts.

When I create a new wallet with the web3.js library or add an account to an existing wallet, am I creating a wallet or just a private/public key pair? Is it just a private/public key pair since I'm not deploying anything even though it's says "wallet"?

web3.eth.accounts.wallet.add('0x4c0883a69102937d6231471b5dbb6204fe5129617082792ae468d01a3f362318');
> {
    index: 0,
    address: '0x2c7536E3605D9C16a7a3D7b1898e529396a65c23',
    privateKey: '0x4c0883a69102937d6231471b5dbb6204fe5129617082792ae468d01a3f362318',
    signTransaction: function(tx){...},
    sign: function(data){...},
    encrypt: function(password){...}
}

Adding to the confusion is that web3.js also has an option to create just an account, and not a wallet.

web3.eth.accounts.create([entropy]);
Kevvv
  • 797
  • 1
  • 7
  • 18

1 Answers1

1

A wallet is not a smart contract. It is a custodial wallet . When you create a wallet through web.js it gives you the private/public key pair of the wallet which you can use in your metamask also . There is also Smart contract wallet which is a smart contract and is used when it is deployed. For Wallet you don't need any smart contract.

Jaskaran Singh
  • 456
  • 1
  • 11