These are chat archives for Nethereum/Nethereum

21st
Mar 2018
ravindersharma581
@ravinder_123_1_twitter
Mar 21 2018 08:38
@juanfranblanco
1) Do I need WEB3 instace to initilize to create a new account on blockchain?
2) So I need Api like "Infura" to create an account?
ravindersharma581
@ravinder_123_1_twitter
Mar 21 2018 08:46
3) Should I use Nethereum.HdWallet to create wallet on blockchain?
@juanfranblanco
Enigmatic
@EnigmaticUnreal_twitter
Mar 21 2018 10:03

Not Juan but I think I can answer you.

It's only a private-public keypair which you need to create, so no, you won't need to create a web3 instance nor connect to infura to create an address if that is the only thing you're doing.

All you needed to do is to call Nethereum.Signer.EthECKey.GenerateKey() and assign the resulting object to a variable. From there you could call obj.GetPrivateKey and obj.GetPublicAddress to get each the private and public key respectively.

Could be as simple as this.

            ecKey = Nethereum.Signer.EthECKey.GenerateKey()
            privateKey = ecKey.GetPrivateKey.ToString.Substring(2)
            publicKey = ecKey.GetPublicAddress

If you'd like to do more with your created account, there's a good guide here: https://nethereum.readthedocs.io/en/latest/accounts/#accounts-in-web3-nethereum

ravindersharma581
@ravinder_123_1_twitter
Mar 21 2018 10:21

@EnigmaticUnreal_twitter Thanks for this help . I am some more queries if you can help me short out those too. it will be very helpful to me :)
1)how seed words work while creating an account and how I can add them to an address using nethereum library while creating and account.

2) How I can make sure the account address(wallet address) I have created is created on mainnet or not?

Juan Blanco
@juanfranblanco
Mar 21 2018 12:10
@ravinder_123_1_twitter 2) you dont need to add accounts to mainnet
they will exists when somebody transfer your some ether or add you to a smart contract or any reference
you control your identity
and sign it with your private key
1) seed words is a mcchanism to generate private keys
(a set of private keys) which can be recovered using the same words
check the HD wallet for info
ravindersharma581
@ravinder_123_1_twitter
Mar 21 2018 13:17

@juanfranblanco So when I create an account using following
var ecKey = EthECKey.GenerateKey();
var privateKey = ecKey.GetPrivateKeyAsBytes().ToHex();
var account = new Account(privateKey);

I get private key and address . I can provide the account address some one to send me ether or coins and then I can check that on one of ethereum site like etherscan.io account balance etc. it will be available on on network.