These are chat archives for Nethereum/Nethereum

30th
Oct 2017
vinyyoo
@vinyyoo
Oct 30 2017 12:47
hello
i m trying to run function balnaceof using Nethereum
but it always return output as 0
can anybody help me short out this problem
Juan Blanco
@juanfranblanco
Oct 30 2017 14:54
have you deployed your contract?
and returns 0?
@vinyyoo
usernameisalreadytaken1236428934
@usernameisalreadytaken1236428934
Oct 30 2017 15:45

hello, I have such situation

var account = Account.LoadFromKeyStore(jsonSecretString, "MyPassword");
var web3 = new Web3(account, "1.2.3.4:8545");
var contract = web3.Eth.GetContract(contractAbi, contractAddress);
var transferFromFunction = contract.GetFunction("transferFrom");
var transferResult = await transferFromFunction.CallAsync<bool>(accountWithTokensAddress, someTestAddressWhereIwantToTransferTokens, 1000);
//transferResult always false

//also I tried 
var result = await transferFromFunction.SendTransactionAsync(accountAddressFromLoadFromKeyStore, accountWithTokensAddress, someTestAddressWhereIwantToTransferTokens, 1000);
//intrinsic gas too low

everything works fine when I'm using ethereum wallet(of course it settuped to local node - 127.0.0.1:8545 and I have private key in keystore)
How I can figure out what the problem?
Add private key to dedicated node look like bad idea.

Juan Blanco
@juanfranblanco
Oct 30 2017 16:16
@usernameisalreadytaken1236428934 i don't undestand the question
but if you want to connect to a public node
you can do it the same way
your private key is local
you don't need to run a local node, you can connect to infura in the same way
Juan Blanco
@juanfranblanco
Oct 30 2017 16:37
@usernameisalreadytaken1236428934 ahh
just read your comments
right the first call won't work
you are not "putting" that transaction on chain
calls just query the state of the chain
now the second.. add more gas
you can use EstimateGasAsync on the function to give you the amount of gas
FirefightGI
@FirefightGI
Oct 30 2017 17:42
So I'm trying to understand the relationship between Nethereum and Solidity, my current understanding is that with Nethereum we can get and execute functions from Ethereum contracts on the blockchain but is that it? Is there a way I can compile a .sol file and store it on an account without external software? I'm creating a visual scripting solution from inside Unity, the end result should be something like Remix: https://remix.ethereum.org/#version=soljson-v0.4.18+commit.9cf6e910.js I apologize if I'm asking a bit of a noob question but I'm having trouble figuring this all out on my own, I can generate a .sol file through visual scripting but am not sure where to start to create a way to compile it then test it over a test network then publish it on the blockchain. I'd say I'm new to Ethereuem but not to JS and C# I just need some directions on what to methods to call if they exist.
Juan Blanco
@juanfranblanco
Oct 30 2017 17:43
to compile solidity, you need the solidity compiler
that is in c++ or javascript (which is generated from c++)
FirefightGI
@FirefightGI
Oct 30 2017 17:44
Is that external or included with Nethereum?
Juan Blanco
@juanfranblanco
Oct 30 2017 17:44
no that is external
you can use the visual studio code solidity extension plugin ;) https://marketplace.visualstudio.com/items?itemName=JuanBlanco.solidity
just kidding
the javascript version is
FirefightGI
@FirefightGI
Oct 30 2017 17:47
Is it required for it to be compiled before going onto the blockchain?
yes
FirefightGI
@FirefightGI
Oct 30 2017 17:48
The solidity code will be written by the user during runtime in Unity so I need to build-in the compiler.
well you can use the c++ solidity compiler
or the solc-js
you can install it on the machine
but you will need the AST for solidity
also you will need to understand the compiler
and best practices
issues on re-entrancy etc
you could go low level too
BUT really i would not recommend it
FirefightGI
@FirefightGI
Oct 30 2017 17:52
hmmm
Juan Blanco
@juanfranblanco
Oct 30 2017 17:53
So overall you want to create something that will produce a solidity contract, using building blocks like scratch?
FirefightGI
@FirefightGI
Oct 30 2017 17:53
yeah, that's what I got.
Juan Blanco
@juanfranblanco
Oct 30 2017 17:53
a long time ago somebody did something in those lines
FirefightGI
@FirefightGI
Oct 30 2017 17:56
I'm guessing this won't be as easy as importing solc-js into unity and feeding it a .sol file and being able to redirect the console output to UI.
well that is mainly what you will need to do
FirefightGI
@FirefightGI
Oct 30 2017 17:57
that looks like he just converted scratch to write sol
Juan Blanco
@juanfranblanco
Oct 30 2017 17:57
i don't know how good will be unity importing solc-js
yes
mainly
if you are doing a desktop app
FirefightGI
@FirefightGI
Oct 30 2017 17:57
UnityScript is pretty much JavaScript so idk either
Juan Blanco
@juanfranblanco
Oct 30 2017 17:57
you can have a node dependency or the c++
FirefightGI
@FirefightGI
Oct 30 2017 17:58
Do you know if there are any cloud based compliers or networks I could send it to without having the client compile it on their machine?
Juan Blanco
@juanfranblanco
Oct 30 2017 17:59
i don't know if remix will do it
but you can create that yourself easily
FirefightGI
@FirefightGI
Oct 30 2017 18:01
I don't know, I'm not so great with network programming
I'll try and import the solc-js into Unity first then look into setting up a cloud compiler. If I knew EtherScript was a thing I probably wouldn't have pursued this but it seems pretty barebones so I wont give up now.
Juan Blanco
@juanfranblanco
Oct 30 2017 18:06
oh no etherscript did not go any further
as far as I know, that was in 2014
FirefightGI
@FirefightGI
Oct 30 2017 18:06
What I'm building will be more advanced, just got to get around this compiler thing. Etherscript looks pretty dead.
Juan Blanco
@juanfranblanco
Oct 30 2017 18:06
nevertheless I thought it was rather cool
yes it is, 2014 like I said
although i recommend getting a very good understanding of solidity first
(or in between)
FirefightGI
@FirefightGI
Oct 30 2017 18:09
Solidity is pretty much JavaScript so the syntax is pretty easy for me to pick up, there is just a ton of terminology involved with Ethereum I'm unfamiliar with. But I've only been at this for about 2 weeks so I'm still learning.
I've written visual scripting tools before, but they were in C# written with C# so compilation wasn't a problem.
Juan Blanco
@juanfranblanco
Oct 30 2017 18:12
ah nice
very nice
FirefightGI
@FirefightGI
Oct 30 2017 18:13
So I'm writing a VS tool in C# that writes Solidity that will be complied by a compiler written in either C++ or JavaScript....fun stuff, better get to it.
JS compiler didn't work well with unity.
all the errors.
XD well I'll look into getting it onto the cloud.
Juan Blanco
@juanfranblanco
Oct 30 2017 18:30
yes that will be much easier
you can even configure it locally
to do the compilation
mainly decoupling it
from the cloud if needed
what about using c++ directly
at the end of the day unity does il2cpp in some intances
FirefightGI
@FirefightGI
Oct 30 2017 18:33
I'm contacting my server provider to see if I can get it installed on the servers I already run and can just hook it up to the event system like I would a multiplayer game in Unity. If that doesn't work out I'll look into the c++ compiler.
Does the solc-JS require the binary or is it included in the wrapper?
Juan Blanco
@juanfranblanco
Oct 30 2017 18:51
solc-js is the c++ solidity compiler in javascript
but that can be converted to javascript
you will need node to execute locally