Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transaction signing #3

Open
ErkanKule opened this issue Mar 12, 2019 · 22 comments
Open

Transaction signing #3

ErkanKule opened this issue Mar 12, 2019 · 22 comments

Comments

@ErkanKule
Copy link

Hi ,

There is no sample for transaction signing

I has a transfer contract for TRX ,

        TransferContract trx = new TransferContract();
        trx.Amount = 100;
        trx.OwnerAddress = Google.Protobuf.ByteString.CopyFrom("TPMcVMR5PsGqsywBtXmjwxEVTtmBzWYaJv", Encoding.ASCII);
        trx.ToAddress = Google.Protobuf.ByteString.CopyFrom("TYZ9AYiuCsNyzhYGosUE1Zeay6DLn96w5p", Encoding.ASCII);

I had private key or ECKey too ,

what next to sign trx in c# ?

@artem03
Copy link

artem03 commented Oct 9, 2020

@ErkanKule Have you found a solution to your question? If so, could you share how to sign a transaction directly in C #

@EnjoX
Copy link

EnjoX commented Mar 12, 2021

I'm also interessted if somebody found a solution

@MRayp
Copy link

MRayp commented Apr 24, 2021

any news? it really should be with some sample code

@EnjoX
Copy link

EnjoX commented Apr 25, 2021

I did it this way but im not sure if its correct, but would be nice if u can test ist.

private const string SignAlgorithmName = "SHA-256withECDSA";
public byte[] SignTransaction(byte[] data)
{
ISigner signer = SignerUtilities.GetSigner(SignAlgorithmName);
signer.Init(true, _privateKey);
signer.BlockUpdate(data, 0, data.Length);
byte[] sigBytes = signer.GenerateSignature();
return sigBytes;
}

@MRayp
Copy link

MRayp commented Apr 26, 2021

I did it this way but im not sure if its correct, but would be nice if u can test ist.

private const string SignAlgorithmName = "SHA-256withECDSA";
public byte[] SignTransaction(byte[] data)
{
ISigner signer = SignerUtilities.GetSigner(SignAlgorithmName);
signer.Init(true, _privateKey);
signer.BlockUpdate(data, 0, data.Length);
byte[] sigBytes = signer.GenerateSignature();
return sigBytes;
}

and how do you send it to the blockchain? i appreciate if you send full sample of your solution.

@EnjoX
Copy link

EnjoX commented Apr 26, 2021

I have never tried.
Its documented at https://developers.tron.network/docs/account
If you want to test it you can use https://developers.tron.network/reference#walletbroadcasttransaction-1
I will also test it if i have time

@sunny-boy3
Copy link

Does anyone have a full example of signing and broadcasting?

@MRayp
Copy link

MRayp commented Jul 26, 2021

Does anyone have a full example of signing and broadcasting?

Not with this library, but check this out:
https://github.com/stoway/TronNet#sample-3-contract-trc20-transfer-usdt

@Mae6e
Copy link

Mae6e commented Nov 20, 2021

@MRayp hi, how i can use TronNet with .net framework 4.7 ??

@MRayp
Copy link

MRayp commented Nov 21, 2021

@MRayp hi, how i can use TronNet with .net framework 4.7 ??

I used it in dotnet core... you should implement it in .net 4.7 yourself .

@Mae6e
Copy link

Mae6e commented Nov 22, 2021

@MRayp ok. because .net framework does not support grpc ... .thank you

@ramincsy2
Copy link

@maede71 Can multiple inputs and multiple outputs be specified for the transaction?
That is, he sent tron from 3 addresses to one address?

@Mae6e
Copy link

Mae6e commented Feb 23, 2022

@ramincsy2 i dont know. tronprotocol documentation:
The adopted transaction model is the account model instead of the UTXO model. Currently, only one-to-one transaction services are available, meaning that one-to-many or many-to-one transactions are not supported.

help;
https://github.com/tronprotocol/documentation/blob/master/TRX/Tron-overview.md
and:
https://developers.tron.network/docs/transactions-1

@ramincsy2
Copy link

@maede71 How do big exchanges manage the wallets of the users?

for example: when we want to withdraw TRC20 from our wallets we need to pay fee in TRX, which causes a large amount of fee that is not an economic way for us. wold you please offer any solution for this.

@ramincsy2
Copy link

@maede71 Thank you for your guidance

@Mae6e
Copy link

Mae6e commented Feb 25, 2022

@ramincsy2
I think it's paid from a main wallet. And after a while, the users' wallets are transferred to the main wallet. And the cost is paid from the user withdrawal fee. This method prevents small amounts from remaining in the wallets. Maybe there are better solutions, if you find a solution, share it with us...

@ramincsy2
Copy link

@maede71
I need help
I want to sign the transaction trc20 usdt offline
for .net or c#

@Mae6e
Copy link

Mae6e commented May 22, 2022

@ramincsy2
I did not work on this and I do not know anything. on .NET4.7 or core??
How do you use it? And what can I do to help?

@ramincsy2
Copy link

@maede71
.NET4.7
I can sign the transaction offline for trx trc10
but I can not sign the smart contract for trc20 offline
I want to send usdt trc20 but the signature is offline

@ramincsy2
Copy link

but I can not sign the smart contract for trc20 offline
I want to send usdt trc20 but the signature is offline

@EhsanGhanbari
Copy link

Does anyone have a full example of signing and broadcasting?

Not with this library, but check this out: https://github.com/stoway/TronNet#sample-3-contract-trc20-transfer-usdt

it doesn't work!

@Mae6e
Copy link

Mae6e commented Jan 26, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants