Go-Ethereum – Are All Accounts Available on Every Node in the Network?

dapp-developmentgo-ethereumnodeswallets

In the context of building DApps, Can a DApp have access to any account across the network (any given node)? Or just the accounts created for the Node it "points" to?

I guess this is another way of asking if accounts are global? For example, when I create a new account using Geth, is that Account replicated across the entire network?

I appreciate all the answers, I'm kind of confused as a beginner that I still in the world of Ethereum.

Cheers!

Best Answer

Private keys are paired with public keys. You need to keep your private key private because if other people get it, they can simply steal your money. You may share your public key with anyone and in fact, you do this so they can send you money. The private key is a file stored locally on your own computer (or, if you're using an exchange, the exchange stores it). You need your private key to interact with your account. If you copy the private key to another computer (that is also running a node), you can use that account from that computer as well.

Many people also refer to the 'public key' as an 'account.' It's always frequently called an 'address.' An 'address' is a 20-byte value starting with 0x. You've probably seen it called your Ethereum address. When you interact with a dApp, you send ether and/or commands to the dApp's address.

The balance of your Ethereum address and all the transactions ever cast against that address are duplicated across every Ethereum node. In fact, coming to agreement on the validity of transactions is exactly what the Blockchain does. When you hear the words "coming to consensus" the thing the nodes are coming to consensus about is the history of transactions on all the accounts (and thereby the account balances).

Smart contracts are addresses (just like any other address) with the special property that the address holds code). You interact with dApps by sending transactions to its address. In that sense, dApps have access to any account that sends transactions to it (but dApps can't control your accounts in any way).

Summary: accounts are global in that every node duplicates every transaction on all accounts (address). They are not global in the sense that only you hold the private key, and only you can sign transactions from that account.

Related Topic