These are chat archives for Nethereum/Nethereum

17th
May 2018
Ganesh Prasad Kumble
@0zAND1z
May 17 2018 01:02
How to receive the decoded output of a transaction based on the TxnHash received by calling the solidity fun in SendTransactionAsync()
Lets say we have a solidity func that returns either true or false based on operations dependent on the input argument
We call the func via SendTransactionAsyc() & get a Txn Hash
How to use Txn Hash in Nethereum to fetch the boolean return value of the transaction
Testing a contract under Remix, we observe a "decoded oupu"t section in a JSON format, SO can we do something of that sort in Nethereum? If so how to pase the decoded output?
Ganesh Prasad Kumble
@0zAND1z
May 17 2018 01:07
TIA!
Roberto Cervantes
@rcervantes
May 17 2018 03:50

Hello everyone I recently join looking if someone can help me... I'm building this function:

   public static async Task<string> CreateNewEthereumAddressAsync(string password)
    {
        var ecKey = Nethereum.Signer.EthECKey.GenerateKey();
        var privateKey = ecKey.GetPrivateKeyAsBytes().ToHex();
        var account = new Nethereum.Web3.Accounts.Account(privateKey);
        var client = $"https://rinkeby.infura.io/{rinkebyToken}";
        Console.WriteLine($"Client: {client}");
        var web3 = new Web3Geth(account,client);
        return await web3.Personal.NewAccount.SendRequestAsync(password);
    }

But I'm getting very frustrated since I always receive Error 405 method not allowed, I need to create an account via Nethereum in the Rinkeby network, does anyone knows what could I'm missing

Enigmatic
@EnigmaticUnreal_twitter
May 17 2018 04:10

@rcervantes - When you are connecting through Rinkeby you don't need to unlock your account, and I can see you're generating a private key already.

The account unlock is meant for local (or remote) hosted nodes which has accounts that you need to access with the password (i.e. decrypt to get private keys).

Have a look at this: https://nethereum.readthedocs.io/en/latest/accounts/

Roberto Cervantes
@rcervantes
May 17 2018 04:15

@EnigmaticUnreal_twitter thanks for the quick response, I don't know if I'm understanding wrong... what I want it to do is the following:

I want to generate an account.
I want to transfer an specific amount of eth from a master account.
I want to unlock the account.
and execute a contract function to save data with that account generated.

I think there are some conditions I am missing in testnet, can you help me please if this scenario can be valid?

Enigmatic
@EnigmaticUnreal_twitter
May 17 2018 05:21

Alright - So what you could do is something like this.

  1. Generate an account - Which you've done with GenerateKey().

  2. To transfer ETH from a Master Account, you will need the private key or the JSON file of the Master Account (per "Loading an existing Account" under the Nethereum link you've sent you), then call for that account to send some ETH to the newly generated account (SendTransactionAsync/SendTransactionAndWaitForReceiptAsync/or similar).

  3. I might have misunderstood the last part, but sounds like you're calling a smart contract using the newly generated account. So you just need to callasync or send transaction with the relevant params to the smart contract address, using the generated account. (e.g. https://nethereum.readthedocs.io/en/latest/contracts/calling-transactions-events/)

If you're doing everything on Rinkeby you won't need to unlock an account, if you're loading an existing account on Rinkeby it's either the JSON file or the private keys. If you are connected to a hosted node then you will need to unlock an account.

@kggp1995 - Tried CallAsync?

var func = contract.GetFunction("callStuff");
var result = await func.CallAsync<int>(7);

Smart contract:

pragma solidity ^0.4.22;

contract test {
    address public owner;
    int public x;

    function test() {
        owner = msg.sender;
    }

    function callStuff(int _x) returns (int) {
        x = _x;
        return x*5;
    }
}
For multiple returns you'll want to check DTOs: https://nethereum.readthedocs.io/en/latest/contracts/functiondtos/
Juan Blanco
@juanfranblanco
May 17 2018 05:51
@kggp1995 just to note, you don't get any return values from a Transaction
you could use events to get the return value from the logs
Juan Blanco
@juanfranblanco
May 17 2018 06:30
@StefH BTW Great labs, have you thought about contributing to Workbooks?
Bulb on hai 💡
@Saqlainz_twitter
May 17 2018 07:17
Hi Juan, Thanks for providing greatness of blockchain. Can i use Nethereum in .net Core?
Stef Heyenrath
@StefH
May 17 2018 07:18
@Saqlainz_twitter Yes, you can!!!
@juanfranblanco What are Workbooks ?
Bulb on hai 💡
@Saqlainz_twitter
May 17 2018 07:19
I found a link to video about .netcore but link is broken.
Stef Heyenrath
@StefH
May 17 2018 07:23
@Saqlainz_twitter Check out my chat above which includes a link to the Labs I created. The Labs 2 and 3 do have a simple consoleapp which uses .net Core
Juan Blanco
@juanfranblanco
May 17 2018 07:23
if you fancy contributing at the workbooks documentation
@Saqlainz_twitter you can use this sample
Stef Heyenrath
@StefH
May 17 2018 07:24
@juanfranblanco Is that a website or sharing platform you mean ?
mainly all the documentation is executable
and provided as workbooks
Stef Heyenrath
@StefH
May 17 2018 07:26
Looks interesting... I'll take a look. And maybe I will also use this workbook functionality by my other projects like System.Linq.Dynamic.Core
Juan Blanco
@juanfranblanco
May 17 2018 07:29
that is linked to read the docs too
so the documentation is updated
but also executable
although the wasm workbooks seems to be in progress
why don't you contribute the System.Linq.Dynamic.Core too the main branch?
.net core ?
it will get more usage
but my ask was if you want to add / share stuff feel free to add it to workbooks
Juan Blanco
@juanfranblanco
May 17 2018 07:47
It will be great :)
Enigmatic
@EnigmaticUnreal_twitter
May 17 2018 08:16
Ah thanks for the save @juanfranblanco :)
Juan Blanco
@juanfranblanco
May 17 2018 08:24
Thanks for all your help !
Same ask, if you fancy contributing to workbooks it will be great ;)
Enigmatic
@EnigmaticUnreal_twitter
May 17 2018 09:02
Sure! Not sure how helpful I am, but will definitely take a look! :)
Let me prioritise feedback for the VB code generator before that. :)
Celestral
@Celestral
May 17 2018 09:32
I want to receive notifications of every transaction on the blockchain where the "input" starts with a certain value (for example hex value of "NEXUSGAME"). I'm not using a solidity contract for any of my transaction creations. Is it possible at all?
I've been looking at Filters and Topics, but that seems to only work with sol smart contracts
Example code of what my creation of transactions looks like:
public async Task<string> SendMessageTransaction(string senderAddress, string privateKey, string receiverAddress, BigInteger gasPrice,string messagePrefix ,string messageAsHex)
{
        var web3 = new Web3Geth(blockchainHost);
        var txCount = await web3.Eth.Transactions.GetTransactionCount.SendRequestAsync(senderAddress);

        var encoded = Web3.OfflineTransactionSigner.SignTransaction(privateKey, receiverAddress, 1,
                      txCount.Value, gasPrice, 100000, messagePrefix + messageAsHex);

        try
        {
            var transactionHash = await web3.Eth.Transactions.SendRawTransaction.SendRequestAsync(encoded);
            return transactionHash;
        }
        catch (Exception e)
        {

            Console.WriteLine(e.Message.ToString());
            throw new Exception(e.ToString());
        }

    }
where the messagePrefix is for example "NEXUSGAME"
Salazar, F. 🎖
@_Salazar_F_twitter
May 17 2018 11:12
@StefH I was trying to use it on the Kovan network, I only realized it later. Sorry for the inconvenience.
Thaks for help!
Juan Blanco
@juanfranblanco
May 17 2018 11:50
@Celestral you can decode the data item and look for that
mainly look for the the starting hex value of that entry
and read the rest
"decode"
just read the data item :)
Nano
@nanomobile
May 17 2018 11:54
Hi everybody
Juan Blanco
@juanfranblanco
May 17 2018 11:54
Hi
Nano
@nanomobile
May 17 2018 11:54
is it possible to use .Nethereum lib in Unity C# with Graphene blockchain
?
Juan Hi, nice to meet you !
You made really very nice job ! Well done ! Really cool project !
Juan Blanco
@juanfranblanco
May 17 2018 11:55
hi nice to meet you
thanks
Nano
@nanomobile
May 17 2018 11:56
I love you Open Source Nethereum lib :+1:
Juan Blanco
@juanfranblanco
May 17 2018 11:56
the truth is idk i have lost track of Graphene
as I have not look at it for a while
Nano
@nanomobile
May 17 2018 11:56
what is the best way to use Graphene and Unity C# ?
maybe you can help me find the best way or the best lib for this communication ? :-)
Juan Blanco
@juanfranblanco
May 17 2018 11:57
well what do you want to do with it?
Xeroc created the python library
that simplify the interop
Nano
@nanomobile
May 17 2018 11:58
I need to make gateway between Graphene blockchain and Ethereum
Juan Blanco
@juanfranblanco
May 17 2018 11:58
Graphene is rather simple as it does not have smart contracts
Nano
@nanomobile
May 17 2018 11:58
to make exchanges
Juan Blanco
@juanfranblanco
May 17 2018 11:59
ok so you just need the simple exchange capability
Nano
@nanomobile
May 17 2018 12:00
can I use your Nethereum lib to communicate with Graphene via Json RPC calls in Unity C# ?
Juan Blanco
@juanfranblanco
May 17 2018 12:00
the guys of metaexchange created a library in c#
no it is very different
Nano
@nanomobile
May 17 2018 12:00
metaexchange
I will look at it now
Thank you very much !
Juan Blanco
@juanfranblanco
May 17 2018 12:00
(continuing with metaexchange.. that is rather old)
Nano
@nanomobile
May 17 2018 12:01
Thank you !
:+1:
Juan Blanco
@juanfranblanco
May 17 2018 12:01
ask xeroc, he will know
(Fabian)
if Graphene provided interoperability with some of the methods it will out of the box
same as RSK
Nano
@nanomobile
May 17 2018 12:03
how to make metaexchange C# lib workable inside Unity ? can you help me please ?
Juan Blanco
@juanfranblanco
May 17 2018 12:03
the open source one is very old
i don't think it is up to date
Nano
@nanomobile
May 17 2018 12:05
Latest commit 7293f7b 11 hours ago
Juan Blanco
@juanfranblanco
May 17 2018 12:05
oh wow is back to life awesome :)
Nano
@nanomobile
May 17 2018 12:05
for example how to make your Nethereum C# lib workable in Unity ? how to make dlls from your C# lib ? Help me please because I don't know this :(
Juan Blanco
@juanfranblanco
May 17 2018 12:05
ha ha old times
Nano
@nanomobile
May 17 2018 12:06
:-)
did you make dlls in Visual Studio ?
for Unity C# ?
that is the one i mean
hasnt been updated for 3 years
ah yeah
compile in visual studio
is this good for Graphene ? don't you know ?
Juan Blanco
@juanfranblanco
May 17 2018 12:09
no those are just apis to centralised exchanges
not to the DEX
if you want to communicate with BTS
Juan Blanco
@juanfranblanco
May 17 2018 12:17
but for Unit3d that might be slightly more complicated as this uses websockets
Nano
@nanomobile
May 17 2018 12:19
which solution should I use to make gateway between Graphene blockchain and Ethereum blockchain in Unity C# ?
what do you think is the best way ?
maybe do you know the best lib or the best solution for such issue ? )
Juan Blanco
@juanfranblanco
May 17 2018 12:22
I think Pauls (metaexchange) is the starting point, i don't know if he is still active he will be great help
from there depends of what you want to do
and how many OSs you want to reach
but interesting project :)
Nano
@nanomobile
May 17 2018 12:27
thx :)
Juan Blanco
@juanfranblanco
May 17 2018 12:28
ah i see that you want to target webgl
browsing your repo
I'm working here
Juan Blanco
@juanfranblanco
May 17 2018 12:33
ha ha cool
right I think the only issue with Unity3d (if you want to target webgl will be the sockets support)
also I don't know what is the current state but i assume with wasm getting better
for .net
and compatibility with unity3d etc on the works
it will be very simple soon
Nano
@nanomobile
May 17 2018 12:37
:+1:
Juan Blanco
@juanfranblanco
May 17 2018 12:40
yeah!!! Ive seen that this morning
Veikko Eeva
@veikkoeeva
May 17 2018 12:40
Juan Blanco
@juanfranblanco
May 17 2018 12:41
oohhhhhhhhhh i have not seen that
monaco in wasm
Ganesh Prasad Kumble
@0zAND1z
May 17 2018 12:42
@dlandi :rocket:
dlandi
@dlandi
May 17 2018 12:43
nice
Kirankumar
@kiranbasvaraj
May 17 2018 12:43
Hi all,
i am trying to pass wallet address which is of type string to the method "CreateFilterAsync(null,walletaddress)" but it is saying that can not convert from string to Nethereum.RPC.Eth.Dtos.Blockparameter.
My Code: var Log = contract.GetEvent("xyz");
var filterSender = await Log.CreateFilterAsync(null, UserWalletAdress );
Help would be Appreciated Thanks.
Nano
@nanomobile
May 17 2018 12:44
is this a good way to use Nethereum.RPC for Graphene blockchain in Unity C# ?
Nethereum.Signer for Graphene in Unity C# is possible to use too or not ? Can anybody help please ?
Celestral
@Celestral
May 17 2018 12:46
@juanfranblanco Yeah I know how to decode a data item, but I'm looking to actually RETRIEVE all transactions with that value. Somehow :')
Juan Blanco
@juanfranblanco
May 17 2018 12:46
no you will need the other wallet
graphene
check the link
Celestral
@Celestral
May 17 2018 12:48
Or well not all transactions I guess, but I'd like anotification whenever a block/transaction appears on the chain with that value
So someone pushes a new transaction where input == NEXUSGAME###################
And then everyone else using our API/app gets a notification that says "NEW NEXUSGAME MESSAGE: ##################"
Juan Blanco
@juanfranblanco
May 17 2018 12:53
@nanomobile the signing is slightly different as it includes the expiration
it can be used similarly with some modifications
but not much
@Celestral well the only way will be to check each transaction arriving in the chain
Ganesh Prasad Kumble
@0zAND1z
May 17 2018 12:55
Why must the first paramter in CreateFilterAsync(null,walletaddress) be null?
and is it OK for walletAddress to be a public static string assigned under App Constants (using Xamarin)
Nano
@nanomobile
May 17 2018 12:57
@juanfranblanco thank you !
@juanfranblanco which modifications in signing must be done ? do you mean modifications in Nethereum.Signer ? right ?
Juan Blanco
@juanfranblanco
May 17 2018 12:58
yeah if you check graphenej
they also depend on bouncy castle and they put
some expiration there
Celestral
@Celestral
May 17 2018 12:59
@juanfranblanco How would I be able to check each transaction arriving in the chain? Is there a function that checks for new transactions?
Juan Blanco
@juanfranblanco
May 17 2018 12:59
@kggp1995 your wallet address can be configurable yeah
the CreateFilterAsync i don't know which part of the code you are referring
Ganesh Prasad Kumble
@0zAND1z
May 17 2018 12:59
But getting error in the CreateFilterAsync used to filter event logs by the address of the sender.
Juan Blanco
@juanfranblanco
May 17 2018 12:59
@Celestral it is in the road map to create the subscription support
In a similar way we can filter for the sender address as it is also marked as indexed, but if we wanted to filter for that specific topic we will use the the second parameter when creating the filter.
var filterSender = await multiplyEvent.CreateFilterAsync(null, senderAddress);
The senderAddress defined is that page is a string, as usual
Juan Blanco
@juanfranblanco
May 17 2018 13:01
@Celestral but for now you can just check the chin
@kggp1995 yeah if you want to filter for the second topic
the first one is null
Ganesh Prasad Kumble
@0zAND1z
May 17 2018 13:02
But we’re doing the same but getting an error: Argument 2: cannot convert from 'string' to ‘Nethereum.RPC.Eth.DTOs.BlockParameter
Our aim is to filter the log of the event based on the sender’s address. Is there a better way to do this?
Please let us know
Juan Blanco
@juanfranblanco
May 17 2018 13:06
try this var filter49 = await multipliedEvent.CreateFilterAsync<object, int>(null, 49);
i believe it is not picking the right overload
we will correct the docs for that :)
Ganesh Prasad Kumble
@0zAND1z
May 17 2018 13:07
Sure, But we need to filter by address of the sender
Juan Blanco
@juanfranblanco
May 17 2018 13:07
well instead of an int use a string
Ganesh Prasad Kumble
@0zAND1z
May 17 2018 13:07
So is it safe to assume we can replace 49 with senderAddress
Juan Blanco
@juanfranblanco
May 17 2018 13:08
and pass the sender
yeah
await multipliedEvent.CreateFilterAsync<object, string>(null, address);
something like that
it is an overload issue
Celestral
@Celestral
May 17 2018 13:08
@Celestral but for now you can just check the chin
How? Sorry if I'm asking very basic questions, still pretty new to this
Ganesh Prasad Kumble
@0zAND1z
May 17 2018 13:08
Cool. Happy to PR the updated docs myself once we find success :+1:
Juan Blanco
@juanfranblanco
May 17 2018 13:09
ah that will be awesome thank
@Celestral check the blockchain storage
repo
Celestral
@Celestral
May 17 2018 13:12
Thanks I'll check that out.. Or maybe I'll do the creation of transactions through a sol contract and then I should be able to subscribe to an event or something right?
For whenever someone makes one with that contract x___x I think?
Juan Blanco
@juanfranblanco
May 17 2018 13:17
yeah
easier to filter events
Psilon
@Pzixel
May 17 2018 16:22
Hi there

what can I do with

Message: Nethereum.RPC.Eth.Exceptions.ContractDeploymentException : Code not deployed succesfully

Juan Blanco
@juanfranblanco
May 17 2018 16:23
add more gas :)
nethereum does a check to validate if the code is there
after deployment
it also includes the TransactionReceipt in the exception
so you can inspect it
normally you don't have enough gas
the latest geth is much better at estimating the gas when deploying
Psilon
@Pzixel
May 17 2018 16:25
What if I say that I pass 4600000 gas?:)
Juan Blanco
@juanfranblanco
May 17 2018 16:25
yeah
the contract transaction deployment handler
does the estimation for you
already
so you don't have to
Psilon
@Pzixel
May 17 2018 16:25
public static async Task<SeasonFactory> DeployAsync(Web3 web3)
{
    var receipt = await web3.Eth.DeployContract.SendRequestAndWaitForReceiptAsync(
                      Core.Abi.SeasonFactory,
                      Bin.SeasonFactory,
                      web3.TransactionManager.Account.Address,
                      new HexBigInteger(4600000));
    return new SeasonFactory(web3, receipt.ContractAddress);
}
I don't believe in estimations
I always pass the maximum value
Juan Blanco
@juanfranblanco
May 17 2018 16:26
well
these can be overriden in the contractdeployment message if you want
Psilon
@Pzixel
May 17 2018 16:27
I do believe there is something broken with contract
Juan Blanco
@juanfranblanco
May 17 2018 16:27
yeah
Psilon
@Pzixel
May 17 2018 16:27
I saw it before
Juan Blanco
@juanfranblanco
May 17 2018 16:27
if your constructor
does some logic
then that must be it
Psilon
@Pzixel
May 17 2018 16:27
Hm
Juan Blanco
@juanfranblanco
May 17 2018 16:27
too
Psilon
@Pzixel
May 17 2018 16:27
great idea
wait a minute
Juan Blanco
@juanfranblanco
May 17 2018 16:27
you can debug using remix
or truffle
Psilon
@Pzixel
May 17 2018 16:31
Lmao
this code doesn't work


    function getRequestById(string id) public view returns(address) {
        return getRequestByHash(keccak256(id));
    }

    function getRequestByHash(bytes32 hash) public view returns(address) {
        return requestIdToAddress[hash];
    }
This one - does:


    function getRequestById(string id) public view returns(address) {
        return requestIdToAddress[keccak256(id)];
    }
Juan Blanco
@juanfranblanco
May 17 2018 16:33
interesting
you should notify the solidity gitter
and see what they say
Psilon
@Pzixel
May 17 2018 16:38
Thank you
it's clrealy not a nethereum issue ;)
Juan Blanco
@juanfranblanco
May 17 2018 16:38
not this time!
Psilon
@Pzixel
May 17 2018 16:38
)
ramonB1996
@ramonB1996
May 17 2018 19:15
@juanfranblanco
We are trying to connect with out blockchain in azure. Is this only possible via url:port or are there other methods that could make this possible?
Were do
Were doing it via web3 like in your youtube tutorials
ramonB1996
@ramonB1996
May 17 2018 19:21
Via Geth it works fine, but in Web3 we get a CORS-error:
CORS-header: ‘access-control-allow-origin’ does not match http://null
Juan Blanco
@juanfranblanco
May 17 2018 20:03
you need to include --rpccorsdomain "*"
which will blacklist everyone
of course you can restrict it to a specific url
CH3mistry
@CH3mistry
May 17 2018 20:54
@juanfranblanco I can't enter an ethereum address in your nethereum wallet