• 카테고리

    질문 & 답변
  • 세부 분야

    블록체인

  • 해결 여부

    미해결

web3.eth.accounts 에서 주소리스트가 안나옵니다.

19.02.19 03:22 작성 조회수 234

0

Accounts {

currentProvider: [Getter/Setter],

_requestManager:

RequestManager {

provider:

HttpProvider {

host: 'http://127.0.0.1:9545/',

httpAgent: [Agent],

timeout: 0,

headers: undefined,

connected: true,

send: [Function],

_alreadyWrapped: true },

providers:

{ WebsocketProvider: [Function: Websoc

HttpProvider: [Function: HttpProvide

IpcProvider: [Function: IpcProvider]

subscriptions: {} },

givenProvider: null,

providers:

{ WebsocketProvider: [Function: Websocket

HttpProvider: [Function: HttpProvider],

IpcProvider: [Function: IpcProvider] },

_provider:

HttpProvider {

host: 'http://127.0.0.1:9545/',

httpAgent:

Agent {

domain: null,

_events: [Object],

_eventsCount: 1,

_maxListeners: undefined,

defaultPort: 80,

protocol: 'http:',

options: [Object],

requests: {},

sockets: {},

freeSockets: {},

keepAliveMsecs: 1000,

keepAlive: false,

maxSockets: Infinity,

maxFreeSockets: 256 },

timeout: 0,

headers: undefined,

connected: true,

send: [Function],

_alreadyWrapped: true },

setProvider: [Function],

_ethereumCall:

{ getId:

{ [Function: send]

method: [Method],

request: [Function: bound ],

call: 'net_version' },

getGasPrice:

{ [Function: send]

method: [Method],

request: [Function: bound ],

call: 'eth_gasPrice' },

getTransactionCount:

{ [Function: send]

method: [Method],

request: [Function: bound ],

call: 'eth_getTransactionCount' } },

wallet:

Wallet {

_accounts: [Circular],

length: 0,

 이런식으로 뜹니다. web3.eth.getAccounts() 이렇게 하면 똑같이 리스트는 뜨는데 인덱스의 건을 가져오지를 못하네요.

web3는 1.0.0-beta37 입니다. 트러플은 5.0입니다.

답변 2

·

답변을 작성해보세요.

6

hanumoka님의 프로필

hanumoka

2019.04.11

web3.eth.getAccounts().then(function(res){ return web3.eth.getBalance(res[0]).then(function(res2){ return web3.utils.fromWei(res2, 'ether')})})

0

버전 명시해주셔서 감사합니다. 환경설정하시면서 트러플 설치할 때 버전 4가 요구됩니다. 해당강좌 밑에 필독사항 보시면 자세히 나와있습니다.