-1

web3.eth.accounts

[ '0x5aad8308d0c45d2b9fc1c465316ba071d2eb6f9c',
  '0x9d73990623df116eb56d300773aa458a11b11e4b',
  '0x1ea4dc6c3ab6d9ddca32083e3d5313ee319abd29',
  '0xd38587def59c78f8892e262005c73cca1bbab73b',
  '0xeb096207d34653763d662e0ba79ad3be3c39f706',
  '0x40f9dd5306881b4c73defacb295aeb185021b3b7',
  '0xddaf50fd9fb0d92368f8d6a6a3ff375ee61d96c1',
  '0xa401172dc8fe874f47cc4463cffc2dcc856ddf32',
  '0x47bd9beb52c3eadc41f981c626ec2cbd6e5422b7',
  '0xa51850dcd65e4ab4696923162ca8c8d352b12a8a' ]

I got all my accounts

In Truffle i have deployed my contract as app

DappToken.deployed().then(function(instance){app = instance;}) 

When i typed

    app.accounts
    undefined

Can anyone explain what is going inside deploying and why we can't see when typing app.accounts and why can we see when using web3.eth.accounts

i didn't find any documention can any one elobrate it and explain

i am trying everything in the console

6
  • Did you call deployer.deploy before that? – ivicaa Oct 8 '18 at 6:28
  • I have done succefuly deployed using deploye.deploy() – Venkatesh Muthyala Oct 8 '18 at 6:32
  • Why are you expecting to see app.accounts? Do you have a field in your contract with this name? You can only call functions on contracts. – ivicaa Oct 8 '18 at 6:38
  • NO but i am thinking why can we see accounts web3.eth.accounts when we have no accounts specified – Venkatesh Muthyala Oct 8 '18 at 6:44
  • If you see a result returned by web3.eth.accounts, you’re connected to a node which manages these accounts. – ivicaa Oct 8 '18 at 6:49
1

why we can't see when typing app.accounts

You see nothing by calling this, because basically you can only call functions of the contract via contract's instance (and few other things like the address of the contract, etc.)

why can we see when using web3.eth.accounts

Because your node is managing these accounts.

Please check the Ethereum tutorial, truffle documentation and web3 api specification.

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.