Get Signed Transaction

Option 1: Write your function: Get Signed Transaction

After Step 1 you will get a estimate_trx is the cost of the buy order. Then you will sing transactionBuilder to create a transfer transaction with an amount transfer equal estimate_trx from buyer's address to fund of Tronsave market:

const dataSendTrx = await tronWeb.transactionBuilder.sendTrx('TRONSAVE_FUND_ADDRESS', estimate_trx, 'BUYER_ADDRESS')
const signed_tx = await tronWeb.trx.sign(dataSendTrx, 'PRIVATE_KEY');
  • change BUYER_ADDRESSis the buyer's public address

  • change PRIVATE_KEY is buyer's private key

  • change TRONSAVE_FUND_ADDRESS is our Tronsave fund address on mainnet

Our Tronsave fund address is

TWZEhq5JuUVvGtutNgnRBATbF8BnHGyn4S

Option 2: Use Tronsave Get Signed Transaction API

POST https://api.tronsave.io/v0/signed-tx

Request params

Field
Position
Type
Required
Description

address

body

string

true

The buyer's public address

private_key

body

string

true

The buyer's private key

estimate_trx

body

number

true

Request params example

{
    "address": "TM6ZeEgpefyGWeMLuzSbfqTGkPv8Z65432",
    "private_key": "{{yourprivateKey}}",
    "estimate_trx": 13500000 //from Step1
 }

Responses

{
      "visible": false,
      "txID": "446eed36e31249b98b201db2e81a3825b185f1a3d8b2fea348b24fc021e58e0d",
      "raw_data": {
        "contract": [
          {
            "parameter": {
              "value": {
                "amount": 13500000,
                "owner_address": "417a0d868d1418c9038584af1252f85d486502eec0",
                "to_address": "41055756f33f419278d9ea059bd2b21120e6add748"
              },
              "type_url": "type.googleapis.com/protocol.TransferContract"
            },
            "type": "TransferContract"
          }
        ],
        "ref_block_bytes": "0713",
        "ref_block_hash": "6c5f7686f4176139",
        "expiration": 1691465106000,
        "timestamp": 1691465046758
      },
      "raw_data_hex": "0a02071322086c5f7686f417613940d084b5999d315a68080112640a2d747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e5472616e73666572436f6e747261637412330a15417a0d868d1418c9038584af1252f85d486502eec0121541055756f33f419278d9ea059bd2b21120e6add74818e0fcb70670e6b5b1999d31",
      "signature": ["xxxxxxxxx"]
    }

Last updated