These are chat archives for Nethereum/Nethereum

12th
Mar 2018
hhs18
@hhs18
Mar 12 2018 02:43
@juanfranblanco, here is the code that I use to verify the sign message.
Address = 0x0dcfcc9c06f5cf4e3f0e22eaae49b2d93bd5adf5
Raw text = this is message sign with Trezor, 11-Mar-2018 08:58
Signature = 0x6f7ac0bd83c951eb5730810ed0177e3d1e94fb792ba38c6765c95f53d2e2c8867891b05772b6b1c573c0aca1765d74f7fc9955c1ac449654eb75c57de7d48c121b
Public Function RecoverMewSignature(ByVal strRawText As String, ByVal strAddress As String, ByVal hexSignature As String) As Boolean
    Try
        Dim signer = New EthereumMessageSigner()
        Dim addressRec = signer.EcRecover(Encoding.UTF8.GetBytes(strRawText), hexSignature)

        If strAddress.ToLower = addressRec.ToLower() Then
            Return True
        Else
            Return False
        End If

    Catch ex As Exception
        Log("Error in [RecoverMewSignature] " & ex.Message, "ERROR")
        Return False
    End Try
End Function

Public Function RecoverWithoutPrefix(ByVal strRawText As String, ByVal strAddress As String, ByVal hexSignature As String) As Boolean
    Try
        Dim hasher = New Sha3Keccack()
        Dim hash = hasher.CalculateHash(strRawText)
        Dim signer = New MessageSigner()
        Dim account = signer.EcRecover(hash.HexToByteArray(), hexSignature)

        If strAddress.ToLower = account.EnsureHexPrefix().ToLower() Then
            Return True
        Else
            Return False
        End If
    Catch ex As Exception
        Log("Error in [RecoverWithoutPrefix] " & ex.Message, "ERROR")
        Return False
    End Try
End Function

Public Function RecoverWithGethPrefix(ByVal strRawText As String, ByVal strAddress As String, ByVal hexSignature As String) As Boolean
    Try
        Dim hasher = New Sha3Keccack()
        Dim hash = hasher.CalculateHash(strRawText)
        Dim signer = New EthereumMessageSigner()
        Dim account = signer.EcRecover(hash.HexToByteArray(), hexSignature)

        If strAddress.ToLower = account.EnsureHexPrefix().ToLower() Then
            Return True
        Else
            Return False
        End If
    Catch ex As Exception
        Log("Error in [RecoverWithGethPrefix] " & ex.Message, "ERROR")
        Return False
    End Try
End Function
Andres G. Aragoneses
@knocte
Mar 12 2018 04:48
visual basic, eww
Juan Blanco
@juanfranblanco
Mar 12 2018 07:13
don' t forget that etherscan is vb.net
i just realised the code generator has to support c#, f# and vb.net, (I am not doing boo :) and thanks god j# does not exist anymore)
dkf
@therealdannzor
Mar 12 2018 08:43
Hi, I'm having problem with installing Nethereum through dotnet add package Nethereum.Web3 where the output is Could not find any project in/Users/userAccount/`. Anyone know?
Juan Blanco
@juanfranblanco
Mar 12 2018 09:01
ah
you need to create a project first if just using the .net cli
so run first
`dotnet new
to create your project
@hhs18 yes having the same issues with the Trezor signature
can you raise an issue?
dkf
@therealdannzor
Mar 12 2018 09:06
@juanfranblanco Thanks for the tips, but what kind of flags do I need to provide? dotnet new nameOfProject only or what?
console application? nugget file?
Juan Blanco
@juanfranblanco
Mar 12 2018 09:11
well if you are just getting started a console will be the best thing
hhs18
@hhs18
Mar 12 2018 09:11
@juanfranblanco thank you already raise the issue.
Juan Blanco
@juanfranblanco
Mar 12 2018 09:11
seen it thanks!
dkf
@therealdannzor
Mar 12 2018 09:18
@juanfranblanco Thanks for a quick response. FYI I've launched a smart contract on a private blockchain (geth client on a computer) and now hope to be able to communicate from an android device with it. Hopefully Nethereum can help me with this. :)
Juan Blanco
@juanfranblanco
Mar 12 2018 09:21
ah then install visual studio (windows or mac) and create an android app using xamarin
you can then add the nuget references to it
dkf
@therealdannzor
Mar 12 2018 09:25
Could you clarify what you mean with 'nuget references'? Does that mean the code you write with the nethereum-package that can communicate with geth RPC?
Juan Blanco
@juanfranblanco
Mar 12 2018 09:44
i mean the nuget package references
step 1. create xamarin project for android (or xamarin.forms)
step 2. add nuget package reference (normally right click on the project) and add the Nethereum.Web3
ravindersharma581
@ravinder_123_1_twitter
Mar 12 2018 10:02
@juanfranblanco Thank you for valuable info.
Miguel Galvez
@galvezm_twitter
Mar 12 2018 12:53
New to this, sorry for the dumb question. I am trying to design a system which will need to retrieve contracts via accounts / sender address but can't find a way to do so yet. Is this a best practice or the design shall not depend on the account number? I don't want to store the contract address since that centralizes the flow. Thanks
Juan Blanco
@juanfranblanco
Mar 12 2018 14:32
have a registry?
smart contract registry
Miguel Galvez
@galvezm_twitter
Mar 12 2018 15:17
that would work, I was wondering if the chain or some part of the stack would keep track of the senders and the contracts.
Juan Blanco
@juanfranblanco
Mar 12 2018 15:30
yes you have the transaction receipts
which have the contract address and the sender
Jeremy
@jdmcalpine_twitter
Mar 12 2018 16:19
Hello @juanfranblanco, I have built a queue system for my token transactions, but I'm receiving an error. I receive a transaction ID, but the transaction does not show up on trackers such as etherscan. I'm also sometimes receiving this error: replacement transaction underpriced
Sometimes the transactions go through and sometimes they show a TXID, but they never show up on the block chain. Can you please explain this for me?
Also to add, I have it increase the gas price at least 3 times in an attempt to resubmit the transaction, but this still fails sometimes. I have it scaling from 4 GWEI to 6 GWEI until it either works, or fails ultimately.
Thank you!
Juan Blanco
@juanfranblanco
Mar 12 2018 16:58
The replacement transaction underpriced is because you are using the same nonce for two transactions
You may need to track your transactions from your queue numbers (nonces)
The gas price if it is on Mainnet might be due to the current pricing
it might help you
Jeremy
@jdmcalpine_twitter
Mar 12 2018 17:40
Thank you for your reply @juanfranblanco . That code looks great, thank you for that. Could you explain what the multiplier variable is used for?
Juan Blanco
@juanfranblanco
Mar 12 2018 22:10
that is the constructor of the smart contract
just a parameter
@jdmcalpine_twitter
Jeremy
@jdmcalpine_twitter
Mar 12 2018 22:47

So the lines to notate when it comes to transaction services instead of contract deployment are the following?:

var nonceProvider = new InMemoryNonceService(senderAddress, client);
account.NonceService = nonceProvider;

@juanfranblanco I can't seem to get ClientFactory.GetClient() to work. Don't think I'm missing an import statement.
Jeremy
@jdmcalpine_twitter
Mar 12 2018 23:44
I'm using a different method than the one in the provided link, so I'm having trouble implementing it the way you did. Where would I put the nonce provider in this case? Here is my code for reference. Sorry it is in VB.NET.
Dim web3client = New Web3(New Accounts.Account(ContractPrivateKey), "https://mainnet.infura.io/")
Dim contract = web3client.Eth.GetContract(ContractABI, ContractAddress)

Dim transferFunction = contract.GetFunction("transfer")

Dim gas = Await transferFunction.EstimateGasAsync(ContractWalletAddress, Nothing, Nothing, ToAddress, TokenAmount)

transactionHash = Await transferFunction.SendTransactionAsync(ContractWalletAddress, gas, New Nethereum.Hex.HexTypes.HexBigInteger(4000000000), Nothing, ToAddress, TokenAmount)

Return transactionHash