These are chat archives for Nethereum/Nethereum

28th
Sep 2018
Juan Blanco
@juanfranblanco
Sep 28 2018 05:45
@Ilchuk-Mihail there are not optional parameters
@twilightpunkster if you just want to sign a message use Nethereum.Signer
to sign and send a transaction use the other
@proBeejay141 when estimating the contract gas cost
an error has occurred in your contract
so check your solidity logic
proBeejay141
@proBeejay141
Sep 28 2018 07:13
@juanfranblanco its not from solidity, i was passing wrong gas price
but the problem i have now is this, insufficient funds for gas * price + value , while trying to transfer the token
Juan Blanco
@juanfranblanco
Sep 28 2018 08:02
autoestimation is done for you
Michael Ilchuk
@Ilchuk-Mihail
Sep 28 2018 08:05
@juanfranblanco I found solution: I can send empty address like "0x0"
Juan Blanco
@juanfranblanco
Sep 28 2018 08:06
cool, of course
proBeejay141
@proBeejay141
Sep 28 2018 08:08
i wont need to pass the gas price?
what am trying to do is that, i want to transfer the gas price(ether) to the address before transferring the token , so i need to know the gas price to know amount of ether to transfer
Juan Blanco
@juanfranblanco
Sep 28 2018 08:12
got you
you can get the current average gas price using web3.Eth.GasPrice
Juan Blanco
@juanfranblanco
Sep 28 2018 08:19
(sorry not clear enough)..
so then you multiply that by gas amount you can get by Estimating the transaction fee https://github.com/Nethereum/Nethereum.CQS.SimpleTokenTransfer/blob/master/Nethereum.CQS.SimpleTokenTransfer/Program.cs#L141
then to transfer the Ether you will need your usual 21k to do the transfer
Twilight Punkster
@twilightpunkster
Sep 28 2018 08:37
@juanfranblanco well, thats what I'm trying to do, but it gets a bit weird on the unity side of things. Where would nethereum.signer have the equivalent of web3.accounts.sign (data, privatekey) - its actually the only thing I need (everything else works like a charm)
Unity in my case acts like a simple client, that connects to a 3rd party, which works with Nethereum web3 like a charm. However I am pulling my hair out xD
proBeejay141
@proBeejay141
Sep 28 2018 08:52
amount will be in wei right? var transactionMessage = new TransferFunction()
{
FromAddress = senderAddress,
To = receiverAddress,
TokenAmount = 100,
//Set our own price
GasPrice = Web3.Web3.Convert.ToWei(25, UnitConversion.EthUnit.Gwei)
        };
decimal for my token is 18, i have to do this right? var amount = UnitConversion.Convert.ToWei(addressTokenBalance, 18);
@proBeejay141 yeah
Twilight Punkster
@twilightpunkster
Sep 28 2018 09:32
@juanfranblanco I love you!!!
Juan Blanco
@juanfranblanco
Sep 28 2018 09:32
:)
Twilight Punkster
@twilightpunkster
Sep 28 2018 09:32
somehow Visual Studio didn't show that
Too bad we can't hire you
Juan Blanco
@juanfranblanco
Sep 28 2018 09:33
ha ha
also remember that there are two types of signers
one with the "Ethereum" prefix and the normal signer
Twilight Punkster
@twilightpunkster
Sep 28 2018 09:34
I am fairly new to this, I am great in Unity, not so great with blockchain (yet)
mainly if you see any differences it will be due to this
Twilight Punkster
@twilightpunkster
Sep 28 2018 09:34
yeah, I just need the regular signer, we got a different way to send out messages
Juan Blanco
@juanfranblanco
Sep 28 2018 09:34
ah cool
Twilight Punkster
@twilightpunkster
Sep 28 2018 09:36
is there a guide/book that you can recommend that focuses on Unity with Nethereum? So far I got chinese, korean blogs that don't really translate well, and some bare bones Medium blogs. A bit overwhelming.
proBeejay141
@proBeejay141
Sep 28 2018 09:41
decimal for my token is 18, i have to do this right? var amount = UnitConversion.Convert.ToWei(addressTokenBalance, 18); , am not converting to wei and its sending the right value
Juan Blanco
@juanfranblanco
Sep 28 2018 09:42
@twilightpunkster i need to flesh out more the new samples, but it is the same as normal Nethereum. Obviously you hit normal Nethereum now with signing
the link I sent you that includes most of the stuff you need to interact with smart contracts
with the new code gen, everything works the same
@proBeejay141 yeah
that will do, if you pass the number of decimals
it works for any unit conversion
https://github.com/Nethereum/Unity3dSimpleSample/blob/master/Assets/TokenDeployAndSend.cs @twilightpunkster <-- that is the one for contract interaction
Juan Blanco
@juanfranblanco
Sep 28 2018 09:47
https://github.com/Nethereum/Unity3dSimpleSample the readme contains the simple ether transfer
https://github.com/Nethereum/Nethereum.Workbooks/blob/master/docs/index.md these workbooks whilst not Unity specific highlight some of the areas
https://github.com/Nethereum/Nethereum.Flappy and the flappy code (which does not follow the "easier" IMHO to interact with contracts)
we need to add simpler interaction with metamask
Twilight Punkster
@twilightpunkster
Sep 28 2018 09:50
thanks
Juan Blanco
@juanfranblanco
Sep 28 2018 09:50
and integration with the Blockchain Storage, more decentralised stuff
Twilight Punkster
@twilightpunkster
Sep 28 2018 09:51
sorry, flappy bird examples make my eyes hurt xD
Juan Blanco
@juanfranblanco
Sep 28 2018 09:51
lol
Twilight Punkster
@twilightpunkster
Sep 28 2018 09:51
they are just as horrible for me as watching the udemy guy ad on YT
Juan Blanco
@juanfranblanco
Sep 28 2018 09:51
well just look at the code.. that is why i did not include all the assets
Twilight Punkster
@twilightpunkster
Sep 28 2018 09:51
yup, doing so.
Juan Blanco
@juanfranblanco
Sep 28 2018 09:51
they can be found in the Unity site
yeah so many distractions, when the code is kind of simple, but for smart contract interaction do the other
and code gen using vscode (just dont include the service )
Michael Ilchuk
@Ilchuk-Mihail
Sep 28 2018 15:30

How to subscribe to all Transfers events in contract ?

 var @event = contract.GetEvent("Transfer");

var allTransfers = await @event.CreateFilterAsync();   -> Exception

var log = await @event.GetFilterChanges<TransferEvent>(allTransfers);

What is wrong ?

I get error :
Message = "Response status code does not indicate success: 405 (Method Not Allowed)."
Error occurred when trying to send rpc requests(s)

Juan Blanco
@juanfranblanco
Sep 28 2018 15:51
in infura you cannot use filters you can only use get logs
check the workbook
just use GetAllChanges
create the filter first and the use GetAllChanges
or.. for all events in the contract just GetAllChanges and the block range as a parameter
Michael Ilchuk
@Ilchuk-Mihail
Sep 28 2018 15:56
So, I can do it only with local node ?
Juan Blanco
@juanfranblanco
Sep 28 2018 15:57
it is the same / similar
you just dont get the filter to track the last call
you just use the blockrange you want
Michael Ilchuk
@Ilchuk-Mihail
Sep 28 2018 15:59

I need monitor all transfers event - > find my addresses and add balance to users

Addresses - thousands and more in linear speed
I think it's only one way - monitor all transfers

or exist anothers ways ?
How exchanges to do it ?
I think use redis cashe or Spark to improve speed .
but in popular tokens , this events a lot
And maybe you know way how to monitor also eth transfers, to add balance to users
filter all blocks ?