FireStack-Lab / LaksaCsharp

Zilliqa Blockchain C# Library
4 stars 3 forks source link

Send Transaction #2

Open MarkWillems opened 5 years ago

MarkWillems commented 5 years ago

Hi,

Thanks for all the effort so far, I tried to send transactions with the package but ran into a few problems. Will see if I can send a pull request later but here they are:

The GetContractAddressFromTransactionID should be CreateTransaction.

If i correct the above but then I get an "Invalid Signature size". That is were I got stuck for now.

yanbin007 commented 5 years ago

sorry, it‘s my bug, I have fixed it.

MarkWillems commented 5 years ago

Thanks we are getting closer :) Now I get an Invalid signature size back from the Zilliqa Api.

If I check https://apidocs.zilliqa.com/#transaction-related-methods then I see the signature the code generates is 4 chars longer than the example in the docs.

Let me know if you need more information.

MarkWillems commented 5 years ago

Hi another issue I think I ran into with the sending transactions: https://github.com/FireStack-Lab/LaksaCsharp/blob/a98e75814adfcf59d7c5bafd81fdea494020f291/LaksaCsharp/Transaction/Transaction.cs#L64

That substring does not feel right?

MarkWillems commented 5 years ago

@yanbin007 Do you need more information?

nicechoys commented 5 years ago

There seems to be an error in the Schurner signature scheme. Returns an invalid signature scheme.

yanbin007 commented 5 years ago

I have fixed it,thanks。

nicechoys commented 5 years ago

Thanks for fixing the bug. I downloaded the latest source and tested it. But I found something strange. When you call the CreateTransaction method, it returns the hash value only once or twice in ten times, and everything else fails.

{"error":{"code":-8,"data":null,"message":"Invalid Signature size"},"id":"1","jsonrpc":"2.0"} Return this error.

It's a signature value. : 00bce33bb8671842d57b66cbee34664f652f82dd211914adc0aa5a1172eb3ae5943c88be1f0924fd5ce526dcedd0a81aa1b068d2b9d12580d091acb5dd420e76b2

And even if the hash value comes out. The hash value can not be retrieved from https://viewblock.io/zilliqa?network=testnet site. What is the problem?

I always appreciate it. Please check a little more ~

MarkWillems commented 5 years ago

I saw the update, thank you, and I really wanted it to work 🥇 but I got this: {"error":{"code":-8,"data":null,"message":"Invalid Signature size"},"id":"1","jsonrpc":"2.0"}

Testing it this way:

        Wallet wallet = new Wallet();
        string address = wallet.AddByPrivateKey("<privekey>");
        Transaction transaction = new Transaction();

        transaction.Version = "65537";
        transaction.ToAddr = "<addres>";
        transaction.SenderPubKey = "<pubkey>";
        transaction.Amount = "10000000";
        transaction.GasPrice = "1000000000";
        transaction.GasLimit = "1";

        transaction.Provider = new HttpProvider("https://api.zilliqa.com/");
        transaction = wallet.Sign(transaction);
        Console.WriteLine("signature is: " + transaction.Signature);
        CreateTxResult result = TransactionFactory.CreateTransaction(transaction);

@yanbin007 Any other information which you need?

neeboo commented 5 years ago

Working on it @MarkWillems

MarkWillems commented 5 years ago

I sometimes get a Signature which the api accepts, also a transactionid is returned, however the transaction is never executed.

neeboo commented 5 years ago

@MarkWillems would you pull the latest one. and see if the Signature-size problem fixed.

And by the way if you had got the TranID returned, you should use rpc method to track the whether the transaction is accepted by the lookup node. Once you got the receipt from rpc, it means the transaction is accepted and it will give you result with success:true/false.

MarkWillems commented 5 years ago

@neeboo It seem the generaton is stable, no more errors on the size.

However I do not get any transaction done actually. The code return the transaction id but the transaction seems not valid.

The rpc call return "Txn Hash not Present". The comment of 5 days back show the code I executed.

neeboo commented 5 years ago

@MarkWillems not sure if it is you are using the mainnet api. However you may consider using testnet api. Make sure you have some testing token in your address. And you can see the example snippet we provide in the repo README.md

MarkWillems commented 5 years ago

@neeboo are you able to do an transaction on mainnet? So not only receive the transaction but really see the transaction occur?

neeboo commented 5 years ago

@neeboo are you able to do an transaction on mainnet? So not only receive the transaction but really see the transaction occur?

Not really for now

MarkWillems commented 5 years ago

@neebo We should be really close 😄 Signature is valid size but incorrect?

neeboo commented 5 years ago

@neebo We should be really close 😄 Signature is valid size but incorrect?

If you are able to make Txn on Testnet. You should be able to do that on Mainnet. Otherwise its the configuration problem. Would you paste some txn params on Mainnet and the rpc result. And see if we can find out why?