These are chat archives for Nethereum/Nethereum

8th
Feb 2017
MashB
@MashB
Feb 08 2017 06:05
yes I was missing that code , got it working after mining
thanks
Juan Blanco
@juanfranblanco
Feb 08 2017 06:06
excellent :smile:
MashB
@MashB
Feb 08 2017 06:16
how to check data in block added or not ? using eth commands
right now from Nethereum I'm able to add data to storage , but while retrieving it always returns empty
Juan Blanco
@juanfranblanco
Feb 08 2017 06:19
what are you trying to do?
are you sending a transactions with Data associated to it
and want to retrieve the transaction again?
or are you using a contract to store the data and want to retrieve it using a call
MashB
@MashB
Feb 08 2017 06:32
I'm sending transaction to add data , later doing "Call" to retrieve the same info
ex. AddEmployee( 101, "Abc") using sendtransaction passing gas value etc . Later call GetEmployedd(101) using CallAsync
Juan Blanco
@juanfranblanco
Feb 08 2017 06:34
ok you might have run out of gas when sending the transaction
get the transaction receipt
using the transaction hash
Eth.GetTransactionReceipt.SendRequestAsync(txnHash);
and check if Gas Used and Sent match
that will be an indicator of running out of gas
rickzanux
@rickzanux
Feb 08 2017 06:36
how the two values indicate the @running out of gas@?
MashB
@MashB
Feb 08 2017 06:36
for sendtransaction I verified gas I sent and consumed is same
rickzanux
@rickzanux
Feb 08 2017 06:37
negative values? they are equal?
Juan Blanco
@juanfranblanco
Feb 08 2017 06:42
transaction.Gas == transactionReceipt.GasUsed)
Mainly if what you send, is the same as what it was used
both can be found on the receipt
that indicates that you might have ran out of gas
rickzanux
@rickzanux
Feb 08 2017 06:42
ok thanks
Juan Blanco
@juanfranblanco
Feb 08 2017 06:43
a more complex way to check this is to use Debug in Geth
MashB
@MashB
Feb 08 2017 06:44
since this is test node .. how to ensure we have enough gas for transactions
Juan Blanco
@juanfranblanco
Feb 08 2017 06:44
Note that the structure of the code now has changed for version 2.0
@MashB just add more gas
that is to deploy a contract, but parameters should be the same
are** (order might be slightly different)
MashB
@MashB
Feb 08 2017 06:47
I'm refering the latest code
MashB
@MashB
Feb 08 2017 06:52
right same code signature. How can I share my code just for you to have a look
Juan Blanco
@juanfranblanco
Feb 08 2017 06:52
just message private or a private gist
MashB
@MashB
Feb 08 2017 07:01
Concept is simple , I'm keeping customer info , and exposing methods to fetch customerinfo
changed the gas, pass only 0 as Ether / Wei
MashB
@MashB
Feb 08 2017 07:19
ok trying
Juan Blanco
@juanfranblanco
Feb 08 2017 07:20
and change the byte[] to string
on the function output so you can read them
check your types as the contract is outputting 1 instead of 111
you have uints and ints in solidity that might be the issue
MashB
@MashB
Feb 08 2017 07:21
yes to testing I had done it , will update code
Awesome it is working now :)
thanks a lot
Juan Blanco
@juanfranblanco
Feb 08 2017 07:21
:smile:
MashB
@MashB
Feb 08 2017 07:22
Can you explain what exactly was happening
Juan Blanco
@juanfranblanco
Feb 08 2017 07:22
also if you use vscode the solidity extension auto generates your services
and function outputs, events etc

what happened is that you did not supply enough gas to pay for the storage
so the transaction was successful but the contract part wasn't
MashB
@MashB
Feb 08 2017 07:23
hmm
got it
Juan Blanco
@juanfranblanco
Feb 08 2017 07:24
transaction successful means that the transaction is recorded in the blockchain
but the contract execution wasn't
(slightly better explanation, i hope)
MashB
@MashB
Feb 08 2017 07:25
one more question , how do we get the history of transaction details ? is it only through event concept /
MashB
@MashB
Feb 08 2017 07:32
@juanfranblanco can you verify this contract implementation , I want to return list info , since struct return is not possible , I'm trying to do it by passing array tuple https://gist.github.com/MashB/fe2539a8dd8243d20cae68e603490e81#file-contract-sol-L47
Juan Blanco
@juanfranblanco
Feb 08 2017 07:49
you will need to iterate using a counter
for transaction history, yes events and filters
check the video tutorials for events and filters
or the written one (probably is faster)
MashB
@MashB
Feb 08 2017 07:51
Got it.
any option on getting list of info from contract I shared
Juan Blanco
@juanfranblanco
Feb 08 2017 07:53
if you want to get all
simple option is to have a counter of how many items you have
and pass an index
you could use a mapping
Juan Blanco
@juanfranblanco
Feb 08 2017 07:56
if you make the mapping public
and the index public too
you can use that
you can call customerDetails(1).. DeserialisingToObject
ahhh
so blind!!!!!
so you are passing arrays as an output
MashB
@MashB
Feb 08 2017 07:58
yes passing array ,is there any alternative approach to this
Juan Blanco
@juanfranblanco
Feb 08 2017 07:58
yes that should work.. as the types are fixed
no there is not the concept as a complex type output
MashB
@MashB
Feb 08 2017 08:00
but for data i need to make multiple calls, is there a way to get all at once
Juan Blanco
@juanfranblanco
Feb 08 2017 08:01
what you have done might work, I don't know about how big the document can get
MashB
@MashB
Feb 08 2017 08:03
Single data with multiple output is working fine. but GetAllCustomers(0 returns array of tuple.. Solidity compiler test works as expected . Trying to get it worked using Nethereum DTO
@MashB
What test data you have put there? there is a mobile with a huge number...
[FunctionOutput]
        public class AllCustomerData
        {
            [Parameter("int256[]", "mobile", 1)]
            public List<BigInteger> mobile { get; set; }

            [Parameter("bytes32[]", "customerName", 2)]
            public List<string> customerName { get; set; }

            [Parameter("bytes32[]", "serviceProvider", 3)]
            public List<string> serviceProvider { get; set; }
        }
you will need to use List<T> to decode the specific elements
MashB
@MashB
Feb 08 2017 09:38
mobile number is just 10 digit number data
ex. "Mahesh1", 222, "Airtel1"
"Mahesh2", 333, "Airtel2"
"Mahesh3", 444, "Airtel3"
Juan Blanco
@juanfranblanco
Feb 08 2017 09:42
oh when i return all the data I get some mixed data, it might be the contract you gave me
also as a note if you are using string and bytes32 conversion
string might be bigger than 32 bytes so that wont work all the time
you could enforce bytes32 all the time when you add a customer
should be big enough for your use case
(string is dynamic, bytes32 is fixed..)
there is also some mix of uint and int too in the contract
let me know how it goes...
MashB
@MashB
Feb 08 2017 11:02
Sure will update you .. thanks for the information
Juan Blanco
@juanfranblanco
Feb 08 2017 18:03
@all there is a rc-1 for Nethereum 2, as there are some small breaking changes as new projects are going to be created for Geth and Parity plus the decoupling into further projects. Here is package for portatble https://www.nuget.org/packages/Nethereum.Portable/2.0.0-rc1 and small description is here https://github.com/Nethereum/Nethereum/releases/tag/2.0.0-rc1
There are minimum breaking changes just check the info on the pre-release