These are chat archives for Nethereum/Nethereum

14th
Jan 2019
Lucas Cullen
@bitcoinbrisbane
Jan 14 01:07
Ive tried with toAddress = null or "0x00.."
``` String bin = File.ReadAllText("Silver.bin");
String signedMessage =
Web3.OfflineTransactionSigner.SignTransaction(key, "0x0000000000000000000000000000000000000000", 0, nonce, defaultGasPrice, gasLimit, bin);
        return String.Format("0x{0}", signedMessage);```
Enigmatic
@EnigmaticUnreal_twitter
Jan 14 02:41

A simple signed tx could just be:

'get nonce
 txCount = Await web3.Eth.Transactions.GetTransactionCount.SendRequestAsync(senderAddress)

'generate raw signed transaction
encodedString = Web3.OfflineTransactionSigner.SignTransaction(privKey, receiverAddress, transferTotal, txCount.Value, gasPrice, gas)

'send to remote node and retrieve transaction receipt
Dim txID = Await web3.Eth.Transactions.SendRawTransaction.SendRequestAsync("0x" & encodedString)
Dim receipt = Await web3.Eth.Transactions.GetTransactionReceipt.SendRequestAsync(txID)

If it's to interact with a smart contract, there are overloads for the data parameter... Noticed you're reading from bin and sending to 0x0 - Don't mind if I ask - How are you looking to interact with address 0x0? (e.g. sending tokens to address 0x0 to burn, etc)

Lucas Cullen
@bitcoinbrisbane
Jan 14 03:15
Yeah, I have functions signing and working offline
But this is for a deploy
Enigmatic
@EnigmaticUnreal_twitter
Jan 14 03:36

Aaaaah yea - I see what you mean Lucas! Deploying a smart contract using a raw transaction. Becuase in that case there will not be a "to address" to interact yet, at least not yet.

Let me see if it is possible to cook up a sample. :) I haven't tried this myself though off the top of my head I think I know how it should work. Should be very much like a typical transaction, without a "to" somehow, and with the data field populated with bytecode and constructor arguments if any.

Enigmatic
@EnigmaticUnreal_twitter
Jan 14 03:50

@bitcoinbrisbane

I left the "to" address as an empty string:

Dim encodedString = iweb3.OfflineTransactionSigner.SignTransaction(privateKey.GetPrivateKey, "", value, txCount.Value, New HexBigInteger(8000000000), gas, bytecode)

Dim txID = Await iweb3.Eth.Transactions.SendRawTransaction.SendRequestAsync("0x" & encodedString)
Dim receipt = Await iweb3.Eth.Transactions.GetTransactionReceipt.SendRequestAsync(txID)

Seems to work: https://ropsten.etherscan.io/tx/0xcc25e3c946d3c565923dcb6747e779d04c3e9f2a4ad181f2582ae97bae09bb4e

Though to be fair I need to test to see if the deployed contract is all OK - Probably after I head out to get some errands done.

Lucas Cullen
@bitcoinbrisbane
Jan 14 04:02
I tried string.empty and "" first
@EnigmaticUnreal_twitter I got a tx hash but rolled back
malichishti
@malichishti
Jan 14 04:06
Trying to run below but getting, "No connection could be made because the target machine actively refused it"
var transactionId = await web3.Eth.Transactions.SendTransaction.SendRequestAsync(new TransactionInput("This is my data", address));
would appreciate if someone could help. thanks
Lucas Cullen
@bitcoinbrisbane
Jan 14 04:06
Thanks guys, just trying now
The above code is pretty much my first attempted. Tried with string.empty and ""
@malichishti what's your web3 object look like?
Using your own node, "http://localhost:8545" or infer?
malichishti
@malichishti
Jan 14 04:07
@bitcoinbrisbane 'var account = new Account(privateKey);
var web3 = new Web3(account);'
Lucas Cullen
@bitcoinbrisbane
Jan 14 04:08
*infura
So do you have Geth running locally with allow RPC calls?
If not, setup an infura.io account
malichishti
@malichishti
Jan 14 04:08
im connecting to Azure Eretheum Consortiam
i'm able to get my account balance
Lucas Cullen
@bitcoinbrisbane
Jan 14 04:09
Yeah, but that's read only
Let me finish the above and I can help
malichishti
@malichishti
Jan 14 04:10
thanks
Enigmatic
@EnigmaticUnreal_twitter
Jan 14 04:11

Decided to stay back a bit to type out some code: https://gist.github.com/Enigmatic331/002d06c895da6332d520499981cd36b5, in VB if you don't mind.

https://ropsten.etherscan.io/tx/0x379f19341c689ee06cc9452013b738eb804922c3c7c5e5931eab010c9e506ccf

@bitcoinbrisbane - Real sorry, would need to step out for a bit. See if the above gives some hints? If not and I'm back, let's continue cracking on it.

Lucas Cullen
@bitcoinbrisbane
Jan 14 04:12
@EnigmaticUnreal_twitter im an idiot!
I was broadcasting to main net
There goes half a day!! hahaha
Enigmatic
@EnigmaticUnreal_twitter
Jan 14 04:13
OH! On the bright side... No money spent yet... I hope? :D
malichishti
@malichishti
Jan 14 04:15
i think i figured out my issue, i was missing a url in the web3 constructor; just starting with this :-)
Lucas Cullen
@bitcoinbrisbane
Jan 14 04:15
@EnigmaticUnreal_twitter Ill invoice the client for my time anyway! lol
Lucas Cullen
@bitcoinbrisbane
Jan 14 04:22
@EnigmaticUnreal_twitter im actually not an idiot! Its a myetherewallet bug. If you broadcast an offline tx, then click the url, it goes to main net etherscan, not Ropsten.
malichishti
@malichishti
Jan 14 04:35
Would anyone know why following would return "Unknown account"
var account = new Account(privateKey);
var web3 = new Web3(account, url:"http://ethcdi-dns-reg1.australiaeast.cloudapp.azure.com:8545");
var transactionId = await web3.Eth.Transactions.SendTransaction.SendRequestAsync(new TransactionInput("0x74686973206973206d792064617461", address));
Enigmatic
@EnigmaticUnreal_twitter
Jan 14 11:21

I think you might need to put an interceptor in between:

https://github.com/Nethereum/Nethereum/blob/master/src/Nethereum.Accounts.IntegrationTests/TransactionInterceptorTests.cs

Tested on my end with the same issue, but with the interceptor I was able to sign the transaction with my private key using Eth.Transactions.SendTransactions this way.

Now for the rationale... I need to go through the code to see how this works...

@malichishti
Possibly Eth.Transactions still refer to ManagedAccounts of sorts... Just a guess, but I may also be dumb dumb.
Juan Blanco
@juanfranblanco
Jan 14 11:44
@malichishti I answered your question in your issue in Github
@EnigmaticUnreal_twitter we crossfired :) Nethereum/Nethereum#495
Enigmatic
@EnigmaticUnreal_twitter
Jan 14 11:47
Heeeey Juan waves - thanks! Looking at your responses and learning from them now. :D
Juan Blanco
@juanfranblanco
Jan 14 11:48
ha ha :) how are you.. i was looking at issues and not gitter this morning I should have done the latter
Not much to teach you :)
Enigmatic
@EnigmaticUnreal_twitter
Jan 14 11:53

On the other hand I should have popped by Github issues :D

I am doing alright, thanks for asking! Mostly trying to finish up my day to day job (especially after a long absence) then I can get back on track with helping out wherever I could. :) :)

carlo perconti
@cryptoFT_gitlab
Jan 14 12:06
I am sure maybe someone already asked but I am not finding the information, is there anything to worry using Nethereum and the coming hard fork ? Do we need to update to a new version current running application or anything special we have to take care of ?
Enigmatic
@EnigmaticUnreal_twitter
Jan 14 12:10

You'll be fine. :) @cryptoFT_gitlab

The fork does no changes to the RPC calls implemented by clients nor to the cryptographic layers.

That said... Can't wait to see how CREATE2 works....
carlo perconti
@cryptoFT_gitlab
Jan 14 12:11
@EnigmaticUnreal_twitter Thank you, that is pretty good to hear ^^