These are chat archives for Nethereum/Nethereum

13th
Jul 2018
Zeshan Virk
@zeshanvirk
Jul 13 2018 05:03
@juanfranblanco everytime i call this method there is still a difference of 70, 45, 20, 100, but the geth is syncing blocks, There was warning on geth that please enable time synchronization, i enabled but the current block and Highest are not matching each other since three days, is there any problem at my side?
Cdpopham
@Cdpopham
Jul 13 2018 05:04
@zeshanvirk Sometime i have nodes that are fully insync but always show 20-100 block behind current, until it had completely finished updating the statetrie
Is this a public ethereum node?
When you attempt to do a simple call like eth.getBalance with Nethereum - do you get an error?
@zeshanvirk an its super confusing because the states highest isnt accurate and will continue to increment
Cdpopham
@Cdpopham
Jul 13 2018 05:09
@zeshanvirk If this is a public geth node.. post your eth.syncing results i can tell you if your close
Zeshan Virk
@zeshanvirk
Jul 13 2018 05:11
@Cdpopham when i call eth.getBalance with Nethereum its not returning any error, its returning me 0.
Its my local node that i ran on my server using geth, only i'm using it

here is the current status:

{
"CurrentBlock": 5954851,
"HighestBlock": 5954923,
"StartingBlock": 5919329,
"Syncing": true
}

Cdpopham
@Cdpopham
Jul 13 2018 05:12
@zeshanvirk Ya but is it conencting to mainnet/public
eth.syncing
By the block count.. im guess yes. It took me 4 days to sync entirely.. 2 days after i got to your state, where the currentblock was -100 behind highest
eth.syncing - should show staterecords
That often takes additional time
Zeshan Virk
@zeshanvirk
Jul 13 2018 05:16
geth console shows us staterecords?
Cdpopham
@Cdpopham
Jul 13 2018 05:16
type eth.syncing
into the console
web3.eth.syncing
Zeshan Virk
@zeshanvirk
Jul 13 2018 05:18
i ran geth using cmd in windows: like geth.exe --rpc --rpcapi web3,eth,personal
Cdpopham
@Cdpopham
Jul 13 2018 05:18
Yep
Zeshan Virk
@zeshanvirk
Jul 13 2018 05:18
where to run web3.eth.syncing?
CS Detective
@Hanwang107
Jul 13 2018 05:18
Do we have sample code for how to run functions from SimpleStorage .sol(Solidity sample smart contract)?
Cdpopham
@Cdpopham
Jul 13 2018 05:18
@zeshanvirk Now open another cmd window
geth attach
run that
CS Detective
@Hanwang107
Jul 13 2018 05:19
The contract contains get and set functions.
Zeshan Virk
@zeshanvirk
Jul 13 2018 05:19
web3.eth.syncing is not recongnized
Cdpopham
@Cdpopham
Jul 13 2018 05:19
It should give you a console.. Alternatively when you start geth you can run: geth.exe --rpc --rpcapi web3,eth,personal console
You ran geth attach? and attached to your node?
Zeshan Virk
@zeshanvirk
Jul 13 2018 05:21

You ran geth attach? and attached to your node?

didn't understand that

Cdpopham
@Cdpopham
Jul 13 2018 05:21
Ok so You start geth.. geth.exe --rpc --rpcapi web3,eth,personal
Zeshan Virk
@zeshanvirk
Jul 13 2018 05:21
all i did is i downloaded geth and ran geth.exe --rpc --rpcapi web3,eth,personal commad
Cdpopham
@Cdpopham
Jul 13 2018 05:21
Then open another commandpromot
type geth attach
Zeshan Virk
@zeshanvirk
Jul 13 2018 05:23
unable to attach to remote geth : no known transport for url scheme "c"
geth attach http://127.0.0.1:8545 make it works
Cdpopham
@Cdpopham
Jul 13 2018 05:25
geth attach ipc:\.\pipe\geth-data1.ipc
Ya you have to define ipc in some scenarios
geth attach ipc:\.\pipe\geth.ipc
Run that last one
Make sure we are on the right pipe
Zeshan Virk
@zeshanvirk
Jul 13 2018 05:26
our goal is to run geth console?
Cdpopham
@Cdpopham
Jul 13 2018 05:26
Did u run the last command i gave you? You now have a console?
Zeshan Virk
@zeshanvirk
Jul 13 2018 05:27
yes geth attach http://127.0.0.1:8545 gave me console
Cdpopham
@Cdpopham
Jul 13 2018 05:27
Use the one i gave you.. So we are sure we are on the right pipe
Im sure its the same.. but
Got your console?
now.. type: eth.syncing
Paste your results
Zeshan Virk
@zeshanvirk
Jul 13 2018 05:28
Capture.PNG
Cdpopham
@Cdpopham
Jul 13 2018 05:28
Yes .. ok
See those knownstates field
Zeshan Virk
@zeshanvirk
Jul 13 2018 05:29
yes there is a lot difference in pulled states and known states
Cdpopham
@Cdpopham
Jul 13 2018 05:29
{
currentBlock: 5904549,
highestBlock: 5954000,
knownStates: 170538778,
pulledStates: 170538778,
startingBlock: 5904520
}
Thats what a current node is at
You have quite some time left
Zeshan Virk
@zeshanvirk
Jul 13 2018 05:30
when these two matches then the current and highest block will match?
Cdpopham
@Cdpopham
Jul 13 2018 05:31
The node will be insync.. once it gets to close to what mine is.. 17000000 something
Zeshan Virk
@zeshanvirk
Jul 13 2018 05:32
knowstates is also increasing, did you mean the node will be in sync util the know states reaches at 17XXXXXX something?
Cdpopham
@Cdpopham
Jul 13 2018 05:33
Yep - thats what i was saying, the states part was confusing at first.. it continues to incrment
Zeshan Virk
@zeshanvirk
Jul 13 2018 05:33
where i can see the current know state for eth so that i can see the difference between mine and the current ?
Cdpopham
@Cdpopham
Jul 13 2018 05:34
So there are two parts being tracked here.. Block/trans receipts and the statetrie
What i gave you
Mine is current
Well really close
Zeshan Virk
@zeshanvirk
Jul 13 2018 05:34
ahan, good
Cdpopham
@Cdpopham
Jul 13 2018 05:34
I do not know of a website that will give you the states entries..
eth.syncing will return 'false' when the node is current
Zeshan Virk
@zeshanvirk
Jul 13 2018 05:35
ahan. okay i'll keep on checking this
Cdpopham
@Cdpopham
Jul 13 2018 05:36
It took my 3 days to get all the state entries.. with --fast --cache=512
Zeshan Virk
@zeshanvirk
Jul 13 2018 05:36
Geth shows a warn sometimes that please enable time synchronization in system settings, Do this slow downs the process if not enabled?
--fast --cache=512 are geth commands?
Cdpopham
@Cdpopham
Jul 13 2018 05:37
Ya
geth --syncmode "fast" --rpc --rpcapi="web3,personal,net,db,eth,admin" --rpcaddr 0.0.0.0 --rpccorsdomain "*"
Zeshan Virk
@zeshanvirk
Jul 13 2018 05:37
and what does --cache=512 means?
Cdpopham
@Cdpopham
Jul 13 2018 05:38
Is what i use - be careful with the last two.. (rpcaddr and rpccors) .. those open up the node to eternal connections and browser/crosstie requests
Zeshan Virk
@zeshanvirk
Jul 13 2018 05:38
i'll use
the default one
Cdpopham
@Cdpopham
Jul 13 2018 05:39
If you only want to make calls to the node running on your machine.. i would use this geth.exe --syncmode "fast" --cache=512 --rpc --rpcapi="web3,personal,net,eth,db"
Zeshan Virk
@zeshanvirk
Jul 13 2018 05:40
default value is 1024 for cache, what will be the effects of changing it to 512?
Cdpopham
@Cdpopham
Jul 13 2018 05:40
Ah 1024 is goode
Leave it be but --syncmode "fast" will be a good command to use.. the next time you need to sync a node
Zeshan Virk
@zeshanvirk
Jul 13 2018 05:42
can i use it to the current one too?
Cdpopham
@Cdpopham
Jul 13 2018 05:42
They are incomaptible unfortunately.. You would have to start over and use "fast"
However.. You still have alot of state left to get.. I would consider it
Zeshan Virk
@zeshanvirk
Jul 13 2018 05:43
so i can use it? its safe?
Cdpopham
@Cdpopham
Jul 13 2018 05:43
Safe? Yes
Zeshan Virk
@zeshanvirk
Jul 13 2018 05:44
okay
thanks
Do you have any idea about time synchronization warning?
Cdpopham
@Cdpopham
Jul 13 2018 05:45
Its to do with your windows time..
Zeshan Virk
@zeshanvirk
Jul 13 2018 05:47
redirected me to https://www.tenforums.com/
Sorry
Zeshan Virk
@zeshanvirk
Jul 13 2018 05:48
yeah i used the same procedure, but still geth shows me that
time-nw.nist.gov
my network time is synced to this one
as one tutorial gave advice about that one too
Cdpopham
@Cdpopham
Jul 13 2018 05:48
Sometimes u need to disable and re-enable
Zeshan Virk
@zeshanvirk
Jul 13 2018 05:49
okay
thanks
Cdpopham
@Cdpopham
Jul 13 2018 05:49
What are you trying to develop? Once your node is synced
Zeshan Virk
@zeshanvirk
Jul 13 2018 05:50
A wallet for Eth and ERC20 tokens
Cdpopham
@Cdpopham
Jul 13 2018 05:50
Do you have your test network setup?
Zeshan Virk
@zeshanvirk
Jul 13 2018 05:51
Yes i tested eth erc20 on testnet first, now switching it to mainnet
Cdpopham
@Cdpopham
Jul 13 2018 05:53
Goodluck.. Keeping a public geth node running is a huge pain. Have you looked at the providers like infura?
Zeshan Virk
@zeshanvirk
Jul 13 2018 05:53
no, i heard about that but never tried to use it.
Cdpopham
@Cdpopham
Jul 13 2018 05:54
Ya - nethereum makes it really easy.. Just var web3 = new Web3("Infuraendpoint") instead of the geth node
All the same code works.. except you cant keep your accounts in the node.. However, thats a good thing to be honest..
Zeshan Virk
@zeshanvirk
Jul 13 2018 05:57
ahan, thats good. But now i've ran my own so i'll continue with it, As i have two servers 24 cores 64gb 1.5tb ssd, and i'm running eth,btc, btg, bytecoin, litecoin, dogecoin, neo, monero, ripple, NEM, omnicore (for usdt), IOTA's wallet on these two. '
Cdpopham
@Cdpopham
Jul 13 2018 05:57
Nice..
Zeshan Virk
@zeshanvirk
Jul 13 2018 05:57
Yes agree.
Cdpopham
@Cdpopham
Jul 13 2018 05:57
You arent keeping your accounts in the node though are you
You are do a wallet right
Zeshan Virk
@zeshanvirk
Jul 13 2018 05:57
yes
What do the exchanges do?
do the keep the accounts in node?
Cdpopham
@Cdpopham
Jul 13 2018 05:58
They sign the tranactions offline.. Its a bad idea to keep them in the node
What you written any of your wallet yet?
Zeshan Virk
@zeshanvirk
Jul 13 2018 05:59
They use Node only to broadcast?
Cdpopham
@Cdpopham
Jul 13 2018 05:59
correct
Zeshan Virk
@zeshanvirk
Jul 13 2018 05:59
didn't got your 2nd!
ahan. thats great
Cdpopham
@Cdpopham
Jul 13 2018 06:00
Have you written any of your wallet yet?
Zeshan Virk
@zeshanvirk
Jul 13 2018 06:00
yes, i wrote all these that i mentioned above
I'm a .net & MEAN stack developer so some wallets are in c# and some are in nodejs
Cdpopham
@Cdpopham
Jul 13 2018 06:01
How are you doing the transactions? Are youn unlocking accounts anyhere or
If you are unlocking accounts.. that means the account is held in the geth node
Zeshan Virk
@zeshanvirk
Jul 13 2018 06:01
unlocking accounts for 60 seconds
yes
accounts are in geth node
Cdpopham
@Cdpopham
Jul 13 2018 06:02
Thats dangerous
Zeshan Virk
@zeshanvirk
Jul 13 2018 06:02
getaccount list returns me the list
i wasn't aware of that
How is this dangerous?
Cdpopham
@Cdpopham
Jul 13 2018 06:02
If you ever accidently open up your geth node to external connections
Example: I have seen first hand some spammer has been flooding people who have their 8545 port open - and signing transactions on behalf of eth.accounts[0]/coinbase to their own account..
This was a private network luckily... but still
private/test ethereum network
Zeshan Virk
@zeshanvirk
Jul 13 2018 06:05
Then how to generate Accounts that are not in node?
Cdpopham
@Cdpopham
Jul 13 2018 06:06
Just a sec ill show you
Zeshan Virk
@zeshanvirk
Jul 13 2018 06:08
ok
Cdpopham
@Cdpopham
Jul 13 2018 06:10
        public Account GeneratePPK()
        {
            var ecKey = Nethereum.Signer.EthECKey.GenerateKey();
            var privateKey = ecKey.GetPrivateKeyAsBytes().ToHex();
            var account = new Account(privateKey);
        }
This is how you create an account without using the node
The caveat - You have to store the private key someplace securely
Zeshan Virk
@zeshanvirk
Jul 13 2018 06:11
and where the password field gone?
Cdpopham
@Cdpopham
Jul 13 2018 06:12
There is no password field.. Password are only used to unlock the keystore file that the geth node encrpyts the private key with
This is using a private key directly..
This method returns an account.. A public/private key pair.. The public key is your ethereum address.. The private key is what is used to sign transactions
Zeshan Virk
@zeshanvirk
Jul 13 2018 06:14
okay but in case when accounts are in node, To sign transactions we need password, and to get private key we need password, then how someone can signTransactions on your behalf if 8545 is opened?
Cdpopham
@Cdpopham
Jul 13 2018 06:14
During those 60 seconds where u unlock it
Zeshan Virk
@zeshanvirk
Jul 13 2018 06:14
:(
reducing that time will make it a lil bit secure? :D
Cdpopham
@Cdpopham
Jul 13 2018 06:16
Ya.. you could do you transaction in 1-2 seconds if you are unlocking it each time
Zeshan Virk
@zeshanvirk
Jul 13 2018 06:16
okay
i'll take a look at offline functionality
Cdpopham
@Cdpopham
Jul 13 2018 06:16
But.. if you external connections are e ver open.. thats enough time for a spammer to get at it
Zeshan Virk
@zeshanvirk
Jul 13 2018 06:16
then i'll change my scenario to that
yes if we can do transaction in 1-2 then he surely can do, but i didn't opened any wallet port for external use. but still i'll try to switch it to offline
Cdpopham
@Cdpopham
Jul 13 2018 06:18
@juanfranblanco What are your thoughts on creating applications where you use the keystore files in the node?
Zeshan Virk
@zeshanvirk
Jul 13 2018 06:18
How experienced are you in blockchain and overall in programming?
Cdpopham
@Cdpopham
Jul 13 2018 06:19
programming - 11 years.. getting paid for it.. 7
Blockchain 3/4
Zeshan Virk
@zeshanvirk
Jul 13 2018 06:20
ahan so 4 years are of bachelor degree?
i'm a kid then :D i've 7 months of overall experience :D
Cdpopham
@Cdpopham
Jul 13 2018 06:22
Nope.. thats just when i say i started.. I goofed around before then.. but i count then when i developed my first .. whati call useful piece of software
Zeshan Virk
@zeshanvirk
Jul 13 2018 06:22
ahan.
Cdpopham
@Cdpopham
Jul 13 2018 06:23
Nothing wrong with that.. You cant get anywhre without starting
Zeshan Virk
@zeshanvirk
Jul 13 2018 06:23
ofc.
Cdpopham
@Cdpopham
Jul 13 2018 06:23
@zeshanvirk This time next year.. you can say you have two years expierence
ha
Zeshan Virk
@zeshanvirk
Jul 13 2018 06:23
:D ofc
People say blockchain & blockchain programmers has a bright future, i do it, i'm learning it but idk i don't think that.
Cdpopham
@Cdpopham
Jul 13 2018 06:25
You dont think blockchain has a bright future?
Zeshan Virk
@zeshanvirk
Jul 13 2018 06:26
May be blockchain, but not in case of cryptos
Cdpopham
@Cdpopham
Jul 13 2018 06:26
I agree.. Alot of the cryptos today arent going to be around in 10.. nay 5 years
However, like all new things.. A innovation in the space ill be a big deal
It will probably look alot different.. but given 10 years of time buildling on it and working through the kinks.. Something big will grow out of the paradigm
Zeshan Virk
@zeshanvirk
Jul 13 2018 06:29
Then the future is bright for those who are building blockchains/networks, may be not for those who are using it just for cryptos. and i'm currently one of them
Cdpopham
@Cdpopham
Jul 13 2018 06:31
Ya - well your involved.. Ethereum for example.. Its goal isnt to be a crpyto.. It only had a "coin" to incentivize partiicpation in the network.. Its goal is to be a large distributed computing platform
Zeshan Virk
@zeshanvirk
Jul 13 2018 06:31
Sometimes i read job on upwork about Creating E commerce sites blockchain-based, or vote system blockchain-based. i'm not aware of that what are they talking about? Do they want us to use eth network of btc network for that or they want us to create a network like that?
Cdpopham
@Cdpopham
Jul 13 2018 06:32
Typically it means they want to use ethereum. hyperledger or another smartcontract platform
To build an application.
Zeshan Virk
@zeshanvirk
Jul 13 2018 06:32
smartcontract is what erc20?
Cdpopham
@Cdpopham
Jul 13 2018 06:33
erc20 is one type of smart contract
A smart contract is just a group of code running on the network
in simplest terms
Zeshan Virk
@zeshanvirk
Jul 13 2018 06:33
ohh, i saw a tutorial about deploy a smart contract within 5-minutes, but its more like an erc20
Cdpopham
@Cdpopham
Jul 13 2018 06:35
Yeah, erc20 is just a specific smart contract
Zeshan Virk
@zeshanvirk
Jul 13 2018 06:36
have you ever developed that kind of application on eth?
Cdpopham
@Cdpopham
Jul 13 2018 06:36
Yeah. Thats what i do
Zeshan Virk
@zeshanvirk
Jul 13 2018 06:36
ohh. Can you guide me on this, i want to create one for my learning!
Cdpopham
@Cdpopham
Jul 13 2018 06:36
Umm sure
what
So do you have a test network setup on your pc?
Zeshan Virk
@zeshanvirk
Jul 13 2018 06:37
yes,
Cdpopham
@Cdpopham
Jul 13 2018 06:37
Which one?
Zeshan Virk
@zeshanvirk
Jul 13 2018 06:37
geth
Cdpopham
@Cdpopham
Jul 13 2018 06:38
We should probabl take this conversation else where .. this should focus on nethereum
Zeshan Virk
@zeshanvirk
Jul 13 2018 06:38
okay in pm
Esteban Gallardo
@EstebanGameDevelopment
Jul 13 2018 07:17
Good Morning. I need your help. I was working displaying the list of transactions I was doing between addresses when I realized that I'm doing something different when I'm doing the ether transfer. In order for the app I'm developing to work I need to be able to check the history of performed transaction in order to know if someone has sent ether to an address. I'm using a simple solidity contract to perform the transaction(see picture, bad part), thinking that it was the right way to do it, but it seems that when I'm using that way instead of having the information about the destination address in the transfer information I have the contract id, which is useless to my goal of knowing who sent money to an address. The thing is that it's possible to do a transfer without a contract being involved because I'm using the https://www.rinkeby.io/#faucet to get some ether and that transfer works as it should (see picture, good part). Long story short, how do I do to make a transfer like the one that https://www.rinkeby.io/#faucet has done? Thanks for your support.
ContractDestinationUndesired.png
Cdpopham
@Cdpopham
Jul 13 2018 07:40
Are you working with a token?
or just regular ether transactions
George T.
@CryptonAdmin
Jul 13 2018 07:53
Hello, guys. I'm getting trouble with execution of my smart contract based on ERC20. Unexpected results of function execute. It's not executing "Transfer", it just make a transaction to somewhere with high gas, about 200 GWEI
In code it gave me txId Different from that appearted in blockchain https://etherscan.io/tx/0x791bcac78c8005165c5b17649d1813f70233fcb6db9ae04b43f5ccd081862915
And it did not executed "Transfer", just normal send from acc to acc(and i don't know second acc)
What i'm doing wrong?
I'm using my own geth daemon with --fast param
Esteban Gallardo
@EstebanGameDevelopment
Jul 13 2018 08:10
@Cdpopham I'm pretty new to Ethereum, the way I'm performing the transfer is like this:

System.Collections.IEnumerator RunTransaction(string _title, string _toAddress, BigInteger _weiAmount, string _privateKeyFrom, string _publicKeyFrom)
{
// DEPLOY THE CONTRACT
var transactionRequest = new TransactionSignedUnityRequest(NetworkAPI, _privateKeyFrom, _publicKeyFrom);
yield return transactionRequest.SignAndSendDeploymentContractTransaction(new ArrayUint256DynamicDeployment("BYTECODE..."), true);

        if (transactionRequest.Exception != null)
        {
            Debug.LogError("---------------ERROR DEPLOYING THE CONTRACT");
            Debug.LogError(transactionRequest.Exception.Message);
            yield break;
        }

        var transactionHash = transactionRequest.Result;

        // GET LASTEST TRANSACTION NUMBER TO DEFINE A NONCE THE IS GREATER THAN THE PREVIOUS ONE PERFORMED BY THE ACCOUNT
        BigInteger nonceLastTransaction = new BigInteger(1000);
        var counterTransactions = new EthGetTransactionByHashUnityRequest(NetworkAPI);
        yield return counterTransactions.SendRequest(transactionHash);
        if (counterTransactions.Exception == null)
        {
            if (counterTransactions.Result != null)
            {
                nonceLastTransaction = counterTransactions.Result.Nonce.Value;
                nonceLastTransaction += new BigInteger(1);
            }
        }
        else
        {
            Debug.LogError("---------------ERROR RETRIEVING THE LAST TRANSACTION COUNT NUMBER FOR THE NONCE");
            yield break;
        }

        // CREATE CONTRACT
        if (m_paymentContractService == null)
        {
            m_paymentContractService = new PaymentContractService(m_contractIDPayment);
        }

        // CREATE THE TRANSACTION INPUT
        var transactionInput = m_paymentContractService.CreatePayTransactionInput(_publicKeyFrom, _toAddress, _title, new HexBigInteger(_gasEstimation), new HexBigInteger(_weiAmount));
        transactionInput.Nonce = new HexBigInteger(nonceLastTransaction);

        // SEND AND WAIT
        var transactionSignedRequest = new TransactionSignedUnityRequest(NetworkAPI, _privateKeyFrom, _toAddress);
        yield return transactionSignedRequest.SignAndSendTransaction(transactionInput);
       if (transactionSignedRequest.Exception == null)
        {
            //get transaction receipt
            Debug.Log("++++++++++++++Payment submitted m_contractIDPayment: " + m_contractIDPayment);
            Debug.Log("++++++++++++++Payment submitted tx: " + transactionSignedRequest.Result);
        }
        else
        {
            Debug.LogError("-------------Payment Error: " + transactionSignedRequest.Exception.Message);
        }

} }

Cdpopham
@Cdpopham
Jul 13 2018 08:14
What are you trying to do exactly?
Esteban Gallardo
@EstebanGameDevelopment
Jul 13 2018 08:15
Transfer money between 2 addresses
Cdpopham
@Cdpopham
Jul 13 2018 08:15
Did u get that code from an example?
That code is for deploying some kind of contract and then using the contract for some type of service
Esteban Gallardo
@EstebanGameDevelopment
Jul 13 2018 08:16
I have not found any clear example of just money transfer, I made what I could
Cdpopham
@Cdpopham
Jul 13 2018 08:16
If you just want to make a simple ether transger.. its alot easier
Esteban Gallardo
@EstebanGameDevelopment
Jul 13 2018 08:17
if you know how to make just a transfer it would be great to share it
Cdpopham
@Cdpopham
Jul 13 2018 08:17
Sec
George T.
@CryptonAdmin
Jul 13 2018 08:17
Nethereum library
Cdpopham
@Cdpopham
Jul 13 2018 08:17
Yeah sec ill give u a code example
George T.
@CryptonAdmin
Jul 13 2018 08:18
But Nethereum library work incorrect for me
Cdpopham
@Cdpopham
Jul 13 2018 08:25
   string   rpcEndpoint = "endpoint";
        Nethereum.Web3.Accounts.Account _account = new Nethereum.Web3.Accounts.Account("privatkey");
        web3 = new Web3(_account, rpcEndpoint);
        _account.TransactionManager = web3.TransactionManager;
        _account.TransactionManager.SendTransactionAsync(from: _account.Address, to: "0x8342948", amount: new HexBigInteger(100000));
@EstebanGameDevelopment
Esteban Gallardo
@EstebanGameDevelopment
Jul 13 2018 08:25
@Cdpopham Thanks I lot for your help!
Juan Blanco
@juanfranblanco
Jul 13 2018 08:28
@EstebanGameDevelopment if you are using Unity3d that is slightly different
Cdpopham
@Cdpopham
Jul 13 2018 08:28
Oh..
Right my bad didnt ask
Juan Blanco
@juanfranblanco
Jul 13 2018 08:29
but if just using it on .net 4 mode and not targetting areas like webgl should be fine
mainly netheruem works out of the box then
Cdpopham
@Cdpopham
Jul 13 2018 08:29
@juanfranblanco Quick Q.
This line: _account.TransactionManager = web3.TransactionManager;
Of the above example
Juan Blanco
@juanfranblanco
Jul 13 2018 08:30
but nevertheless great point, I am planning to do a simpler transfer class
Cdpopham
@Cdpopham
Jul 13 2018 08:30
Is it neccesary or will _account.transaction manger pickup from the web3 instance somehow
Juan Blanco
@juanfranblanco
Jul 13 2018 08:30
to simplify the usage of just sending Ether on both cases (normal an unity with yields)
An Account creates the default AccountTransactionManager
the only thing missing from the equation is the client
Cdpopham
@Cdpopham
Jul 13 2018 08:32
Yes - but how does it get the correct endpoint
yes
Juan Blanco
@juanfranblanco
Jul 13 2018 08:32
which Web3 assigns it
when creating a new instance
to the TransactionManager
you normally do something like
Esteban Gallardo
@EstebanGameDevelopment
Jul 13 2018 08:33
Yes, @juanfranblanco I'm working in .Net 4, developing an Android app
Cdpopham
@Cdpopham
Jul 13 2018 08:33
So when you init web3, the transaction manager in _account gets the client?
Juan Blanco
@juanfranblanco
Jul 13 2018 08:33
var web3(new Account, client)
yeah
Cdpopham
@Cdpopham
Jul 13 2018 08:33
Ahh
Did not know that
In my head i had to overwrite the account transmanager to have the client/endpoint
Juan Blanco
@juanfranblanco
Jul 13 2018 08:34
obviously you could just work with the transaction manager
assigning the client
but web3 gives the right starting point
to access anything you want (learn)
this is the middle ground area :)
Juan Blanco
@juanfranblanco
Jul 13 2018 08:39
for the next version to allow for di etc
@EstebanGameDevelopment then you can just use the Nethereum dlls directly
There is another to do to create a combined .net4 deployment package for Unity3d (mainly all the dlls compiled to .net4 but also including / combining UnityRequest (yield operators) to use with UnityWebRequest
Cdpopham
@Cdpopham
Jul 13 2018 08:42
Ooh DI.. fancy new .net cure stuff
Juan Blanco
@juanfranblanco
Jul 13 2018 08:43
ooh more in the line of this
mainly apart from the usual di, but allow for other types of interceptors if wanted
although i am more inclined but not yet there to include specific pre / post handler execution to avoid complex interceptors
(also is more cross platform, aot capable)
Esteban Gallardo
@EstebanGameDevelopment
Jul 13 2018 08:46
@juanfranblanco Thanks! From what I understand from your instructions what I've to do is this: TransactionManager transactionManager = new TransactionManager("What is client?");
yield return transactionManager.SendTransactionAsync(new TransactionInput("title of transfer", _toAddress, _fromAddress, new BigInteger(_weiAmountToTransfer));
Juan Blanco
@juanfranblanco
Jul 13 2018 08:47
everything in nethereum was created with that in mind (but did not want to create something too complex to start with), kind of cater all needs
George T.
@CryptonAdmin
Jul 13 2018 08:47
Guys, i'm getting crazy
I've just executed ONE transaction and it pasted into blockchain over 15
Juan Blanco
@juanfranblanco
Jul 13 2018 08:48
@EstebanGameDevelopment no
George T.
@CryptonAdmin
Jul 13 2018 08:48
with 197 GWEI gas price
Juan Blanco
@juanfranblanco
Jul 13 2018 08:48
to use a transactionManager you will need to use async / await
forget the yield part
the "title of transfer" is "your address"
@CryptonAdmin
how did you do that?
how can I help you?
it seems fine now?
George T.
@CryptonAdmin
Jul 13 2018 08:52
I'm doing Transfer command execution
via
Juan Blanco
@juanfranblanco
Jul 13 2018 08:53
there is only one transaction now
George T.
@CryptonAdmin
Jul 13 2018 08:53
There is no transaction
Let me explain once again
Juan Blanco
@juanfranblanco
Jul 13 2018 08:53
sorry one with 197 Gwei
George T.
@CryptonAdmin
Jul 13 2018 08:54
I'm using this command as example ->
Juan Blanco
@juanfranblanco
Jul 13 2018 08:54
and yes i saw lots before
sure..
This is "Transfer" command code execute
And when it executed, it totally ignore all parameters, ignore force set of gasprice
And execute as simple "eth send transaction", not command execute
Juan Blanco
@juanfranblanco
Jul 13 2018 08:58
public async Task<string> TransferAsync(Tokens token, string address, decimal amount)
{
var tokenData = TokenRepository.Get(token);
        if (tokenData == null)
            throw new ArgumentException("Specified token not found");

        // Connect to GETH node
        var web3 = new Web3(Web3Uri);

        // Unlocking "creator" account for 15 seconds
        // If fault, throw
        if (!await web3.Personal.UnlockAccount.SendRequestAsync(tokenData.CreatedByAddress,
            tokenData.CreatorPassphrase, 15))
            throw new UnauthorizedAccessException(
                $"Unable to unlock account for token {tokenData.Symbol}({tokenData.Description})");

        var transactionMessage = new TransferFunction()
        {
            FromAddress = tokenData.CreatedByAddress,
            To = address,
            TokenAmount = Web3.Convert.ToWei(10,8),
            //Set our own price
            GasPrice = Web3.Convert.ToWei(21, UnitConversion.EthUnit.Gwei)

        };

        var transferHandler = web3.Eth.GetContractTransactionHandler<TransferFunction>();

        // this is done automatically so is not needed.
        var estimate = await transferHandler.EstimateGasAsync(transactionMessage, tokenData.Address);
        transactionMessage.Gas = estimate.Value;

        //await web3.Eth.

        var gasPrice = await web3.Eth.GasPrice.SendRequestAsync();

        var transactionHash = await transferHandler.SendRequestAsync(transactionMessage, tokenData.Address);
        //Console.WriteLine(transactionHash);

        return transactionHash;
    }
Yes you are using Web3 without an account
so it mainly uses a normal send transaction
George T.
@CryptonAdmin
Jul 13 2018 08:59
I've imported privatekey into geth
so my geth has this account at keychain folder
Juan Blanco
@juanfranblanco
Jul 13 2018 09:00
sure so geth is managing everything using send transaction
George T.
@CryptonAdmin
Jul 13 2018 09:00
and accessing to it with password
But!
Juan Blanco
@juanfranblanco
Jul 13 2018 09:00
yes you have unlocked it
George T.
@CryptonAdmin
Jul 13 2018 09:00
So, what i need to do?
Juan Blanco
@juanfranblanco
Jul 13 2018 09:00
you should create a managed account it is safer
Cdpopham
@Cdpopham
Jul 13 2018 09:01
@juanfranblanco Wait - how does a managed account differ from a keystore file loaded into geth?
Juan Blanco
@juanfranblanco
Jul 13 2018 09:01
var web3 = new Web3(new ManagedAcccount("addresss", "password")
the only difference is
George T.
@CryptonAdmin
Jul 13 2018 09:01
In this code line?
Juan Blanco
@juanfranblanco
Jul 13 2018 09:01
that the ManagedAccount uses
George T.
@CryptonAdmin
Jul 13 2018 09:01
Let me check
Juan Blanco
@juanfranblanco
Jul 13 2018 09:01
internally
personal_sendTransaction
which is safer
Cdpopham
@Cdpopham
Jul 13 2018 09:02
Personal.sentransaction still results in you unlocking your account in geth tho..
Juan Blanco
@juanfranblanco
Jul 13 2018 09:02
as it only unlocks the account for that transaction
not keeping it open for a 30 seconds
and yes true
Cdpopham
@Cdpopham
Jul 13 2018 09:03
Its unlocks it for a brief period of time and perforsm that transactions.. or it has some sort of permission set
Juan Blanco
@juanfranblanco
Jul 13 2018 09:03
it is much safer to sign the transactions yourself instead of sending the password
personal_sendTransaction unlocks it only
for that transaction
so it is only valid for that transaction (no time)
Cdpopham
@Cdpopham
Jul 13 2018 09:04
Really
George T.
@CryptonAdmin
Jul 13 2018 09:04
Do i need to UnlockAccount in that case?
Juan Blanco
@juanfranblanco
Jul 13 2018 09:04
no you dont
personal_sendTransaction includes the transaction and your password to unlock
which obviously there is another "attack" there to sniff the password
BUT you are not exposed an attach checkign for you port 8545
Cdpopham
@Cdpopham
Jul 13 2018 09:05
What are your thoughts on application design: Storing your keystore/private key off node and then offline signing or using managed account
Juan Blanco
@juanfranblanco
Jul 13 2018 09:06
and get the account litst and send a transasction
Cdpopham
@Cdpopham
Jul 13 2018 09:06
I didnt know about that until now.. So im curious to compared the two in terms of security
Juan Blanco
@juanfranblanco
Jul 13 2018 09:06
depends of your needs but the first is the better
Cdpopham
@Cdpopham
Jul 13 2018 09:06
Ya
Juan Blanco
@juanfranblanco
Jul 13 2018 09:06
you can point to any public node that way
Cdpopham
@Cdpopham
Jul 13 2018 09:07
Yeah.. Thats what i typically do. Was just curious as i never used the managed account before
Juan Blanco
@juanfranblanco
Jul 13 2018 09:07
but the point of the trasnaction manager and accounts is to allow you to "swap" easily mechanisms of signing
and sending transactions
Cdpopham
@Cdpopham
Jul 13 2018 09:08
Ya.. its definitely handy.. Its suprisingly alot easier than offline signing in eth-js
George T.
@CryptonAdmin
Jul 13 2018 09:11
it worked!
Oh god....
But, got another trouble ... =|
Token deducted from main account, but not added to destination address
Juan Blanco
@juanfranblanco
Jul 13 2018 09:13
are you developing in mainnet?
you can use a testnet will be much cheaper
George T.
@CryptonAdmin
Jul 13 2018 09:14
Code was done 12 months ago
So, now just a reburth
rebirth*
Juan Blanco
@juanfranblanco
Jul 13 2018 09:15
sure your tokens would have transfer to the address
what is the transaction?
@Cdpopham i like ethjs ;) it does not hide you anything, lots of components. Although it might need as per your feedback a simpler layer on top and let you drill down when needed (ill pass your feedback )
Juan Blanco
@juanfranblanco
Jul 13 2018 09:21
@CryptonAdmin
image.png
everything seems fine
if that is the transaction
Cdpopham
@Cdpopham
Jul 13 2018 09:23
@juanfranblanco It wasnt an insult! didnt know you were acquaintances with the devs ha
Juan Blanco
@juanfranblanco
Jul 13 2018 09:24
lol no, it is good feedback
Cdpopham
@Cdpopham
Jul 13 2018 09:25
@juanfranblanco OOh its a consensys project as well.. Jeez you guys rule the ethereum roost
Juan Blanco
@juanfranblanco
Jul 13 2018 09:26
it is Nick Dodson project, he is great :)
regardless of Consensys
Cdpopham
@Cdpopham
Jul 13 2018 09:27
@juanfranblanco What i find hilarious is that...doing a POC for microsoft and the library necessary to use their dev framework for the middle tier is developed by consensys
George T.
@CryptonAdmin
Jul 13 2018 09:28
@juanfranblanco I can't see that 10 Tokens on balance
Juan Blanco
@juanfranblanco
Jul 13 2018 09:28
is that the same transaction?
@Cdpopham Microsoft is the new Microsoft
they are there
George T.
@CryptonAdmin
Jul 13 2018 09:33
Seems it was a bit laggy
I didn't seen them here before
thank you, guys! you saved my nerves with ManagedAccount
Juan Blanco
@juanfranblanco
Jul 13 2018 09:47
@CryptonAdmin sure Ill check your issue anyway with using the default transaction manager + unlocking
WizTonE
@WizTonE
Jul 13 2018 15:08
Hi! @juanfranblanco , Thank you for the response.
I try to use the link https://github.com/Nethereum/Nethereum/blob/master/src/Nethereum.Accounts.IntegrationTests/SignOfflineTransactionTest.cs#L23-L39
Because I need to make transactions via ERC20 contract at Ropsten test network.
May I ask does there has any other suggest for the sign offline method?
Thanks.
Juan Blanco
@juanfranblanco
Jul 13 2018 17:20
if you are going to send the transaction straight away just use Web3(Account(privateKey)) as per the doc
this is a sample
or ...