WELUPS Document
Search
⌃K

Sending Transaction

Any operation contracting with WELUPS network is a transaction. A transaction can be Welups transfer, WRC-10 transfer, freezing & unfreezing, voting, Etc.

The routine for sending

A normal routine for sending a transaction is:
Create -> Sign -> Broadcast -> (wait) -> Lookup and get receipt
Welups SDK defines the same protobufs include all RPC APIs and transaction related classes, also, Welups SDK wraps the functions in WelClient.class.

An simple example

public static void sendTrx()
{
System.out.println("============= TRC transfer =============");
WelClient client = new WelClient("172.104.51.182:16669","172.104.51.182:16669","private key");
try {
TransactionExtention transactionExtention = client.transfer("414203485a535a4072C9FBFaADDfe2A010AD0BcdB0", "41a9c46373aEB4749E3CE45acA242b027A46f486f9", 20_000_000);
Transaction signedTxn = client.signTransaction(transactionExtention);
String ret = client.broadcastTransaction(signedTxn);
System.out.println("======== Result ========\n" + ret.toString());
}
catch (Exception e) {
System.out.println("error: " + e);
}
}
result:
public static void sendTrx()
============= TRC transfer =============
transactionExtention
transaction {
raw_data {
ref_block_bytes: "\355<"
ref_block_hash: "\325\003\3051\266\232\236\025"
expiration: 1641471042000
contract {
type: TransferContract
parameter {
type_url: "type.googleapis.com/protocol.TransferContract"
value: "\n\025AB\[email protected]\311\373\372\255\337\342\240\020\255\v\315\260\022\025A\251\304cs\256\264t\236<\344Z\312$+\002zF\364\206\371\030\200\332\304\t"
}
}
timestamp: 1641470984417
}
}
txid: "\266\360\025\326\270<O\364j\vla$D\315I\314\207{\334\363\276\331:6[\200\216A\227\361%"
result {
result: true
}
signedTxn
raw_data {
ref_block_bytes: "\355<"
ref_block_hash: "\325\003\3051\266\232\236\025"
expiration: 1641471042000
contract {
type: TransferContract
parameter {
type_url: "type.googleapis.com/protocol.TransferContract"
value: "\n\025AB\[email protected]\311\373\372\255\337\342\240\020\255\v\315\260\022\025A\251\304cs\256\264t\236<\344Z\312$+\002zF\364\206\371\030\200\332\304\t"
}
}
timestamp: 1641470984417
}
signature: "\304\3763\"\265\257y\203\376\237\372\304\342\215>\247\\wj\326\355\345\232\022\216\006\233F4\356\350\322$I\\\312v\330\r\177\256\003\372\253\311\3151\373kF\212Lm\266&f\3506L\234\270\355\224\256\000"
======== Result ========
b6f015d6b83c4ff46a0b6c612444cd49cc877bdcf3bed93a365b808e4197f125
In Wel SDK, the routine is:
  1. 1.
    Create a WelClient object with your private key.
  2. 2.
    Obtain a TransactionExtention object from WelClient.transfer().
  3. 3.
    Call WelClient.signTransaction()to sign the transaction with your private key binding with the WelClient object.
  4. 4.
    Call WelClient.broadcastTransaction() to broadcast the transaction and get a TransactionReturn for analysis.