These are chat archives for Nethereum/Nethereum

25th
May 2018
xeeshan74
@xeeshan74
May 25 2018 01:00
i mean the approve call does nothing.. I dont see the allowance on the contract
Juan Blanco
@juanfranblanco
May 25 2018 05:19
Transactions don't return any value
@xeeshan74
what you get is the transaction hash
And you use that to get the receipt once the transaction is included in the ledger
5murf
@5murf
May 25 2018 08:04
Hi @juanfranblanco in regards to my pending transaction problem from yesterday, I have now changed my node to a geth node and i am no longer getting the error. But im now just getting no results, filterchanges is always empty :( Any ideas? Thanks
Celestral
@Celestral
May 25 2018 11:34
How to use Nethereum.Web3.Accounts.Account? I try creating a new one like this, but how can I actually use it? It's not stored in Personal.ListAccounts
When I use var account = await web3.Personal.NewAccount.SendRequestAsync(passPhrase); it DOES show up in ListAccounts
But I want to use Nethereum.Web3.Accounts.Account since it has all the info about an account stored (privatekey etc)
var ecKey = Nethereum.Signer.EthECKey.GenerateKey();
var privateKey = ecKey.GetPrivateKeyAsBytes();
var account = new Nethereum.Web3.Accounts.Account(privateKey);
        return account;
But I have no way of actually adding the account to the blockchain / keystore
5murf
@5murf
May 25 2018 12:33

@juanfranblanco please ignore what i said above, the problem was my node wasnt fully synced (duhhhh)

But now im back with the old problem (Nethereum/Nethereum#344)

This is with a Geth node provided by QuikNode

Matthew
@ThatSlyGuy
May 25 2018 13:50
Is it possible to call a contract function back in time at a specific block number? For example, would it be possible to check what the ether balance or token balance is of an address at any given block number, or is that not possible?
Enigmatic
@EnigmaticUnreal_twitter
May 25 2018 15:11

@Celestral - You meant you'd like to store the account as a keystore? Once you have generated a privatekey you can use EncryptAndGenerateDefaultKeyStoreAsJson, which has an override to take a password for the JSON file, private key, and address.

Quick example, you might need to work a few bits out. VB though...

        Dim KeyStoreService As New KeyStore.KeyStoreService
        Dim JSONstring As String = KeyStoreService.EncryptAndGenerateDefaultKeyStoreAsJson(password,
                                                                                           account.PrivateKey.Substring(account.PrivateKey.Length - 64).HexToByteArray,
                                                                                           account.Address)
        Dim filename As String = KeyStoreService.GenerateUTCFileName(account.Address)

PS: An account isn't exactly "added" to the blockchain until you send a transaction to/from it, only then it gets "added". You could however generate an account and store it in a keystore file for your own use, just that the blockchain doesn't sees it as created until a transaction happens.

Enigmatic
@EnigmaticUnreal_twitter
May 25 2018 15:19

@ThatSlyGuy - You should be able to if you're querying from a full node. Off the top of my head there are JSON-RPC calls which can be done (eth_getbalance I think) which takes a parameter of blocknumber.

For Nethereum, you should be able to define a blockParameter when you do GetBalance.SendRequestAsync. Likewise for token balance checks, something like CallAsync<BigInteger>(new BlockParameter(blockNumber), address) should work.

PS: Sorry, typing off the top of my head. Let me see if I can get you some code examples.

Enigmatic
@EnigmaticUnreal_twitter
May 25 2018 15:52

@Celestral - Eeeh..... Let me know if I might be misunderstanding you (my apologies).

On second read, it looks more like you're trying to add a new account to your geth instance (something like var account = await web3.Personal.NewAccount.SendRequestAsync("password");). From there you should be able to load the keystore from %APPDATA%/Ethereum/keystore.

Not sure if there's a quicker way to do this... I might need to take a lookaround myself.
Matthew
@ThatSlyGuy
May 25 2018 21:16
@EnigmaticUnreal_twitter You're right, I just noticed these requests take a BlockParameter as one of the inputs. Haven't looked back at this part of my code for a while so I had forgotten. Thanks!