I have created a private test net in geth and trying to create a an account in my private net in python

from web3 import Web3, IPCProvider
web3 = Web3(IPCProvider("../Blockchain/PrivateNet/geth.ipc"))

web3.eth.accounts[0] is returning correct result ie. the first account in my private-net


web3.eth.account.create('Pass') doesnt create any account in the privte-net, it create a local account it returns :

eth_account.local.LocalAccount object at 0x7fe748076588

2 Answers 2


Private keys/EAO accounts are valid on all Ethereum chains -- testnets and mainnet included. This means that the LocalAccount object you're creating will be able to recieve tokens and ether on your test network (as well as the Ethereum foundation network).

Technically, you don't need anything connected to the internet to generate an account. You just need to know the ingredients to make a private key and generate an address -- all of that can happen without the Ethereum network or specifying which network you want to use the key on.


here's a code sample that creates a local account on your pc (not on the node, no need of any providers here)

import web3
w3 = web3.Web3()
myAccount = w3.eth.account.create('put some extra entropy here')
myAddress = myAccount.address
myPrivateKey = myAccount.privateKey
print('my address is     : {}'.format(myAccount.address))
print('my private key is : {}'.format(myAccount.privateKey.hex()))

you can allocate some funds to this account in your genesis file OR attach a javascript console to your geth node and do a transfer so that your new account has funds.

I've published a post on medium if you would need more details


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.