> ## Documentation Index
> Fetch the complete documentation index at: https://docs.shinami.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Transaction.build()'s hidden requests

> An example of the extra Node requests you'll create when building a transaction.

## Summary

Calling Transaction.build() on a [programmable Transaction Block](https://docs.sui.io/guides/developer/sui-101/building-ptb) is generally required before executing a transaction. Unless you [build your transaction offline](https://docs.sui.io/guides/developer/sui-101/building-ptb#building-offline), this method takes a Fullnode client and uses it to make additional requests to a Sui Fullnode in order to gather the information it needs to build the programmable transaction block. You can also pass a Transaction into the Shinami or Mysten SDK's `devInspectTransactionBlock` method, in which case it calls `Transaction.build()` on the Transaction before sending the `sui_devInspectTransactionBlock` request to the Sui network ([covered below](/developer-guides/sui/move-guides/transaction-block-build-requests#devinspecttransactionblock)). Finally, our SDK helper method `buildGaslessTransaction`, used to prepare a Transaction for sponsorship with our Gas Station, also calls `Transaction.build()` ([covered below](/developer-guides/sui/move-guides/transaction-block-build-requests#buildgaslesstransaction-shinami-typescript-sdk)).

We made this guide so you can better:

1. understand the `Transaction.build()` process
2. estimate your usage and billing with your Node provider.

<Info>
  **Notes:**

  The examples below show 4-5 Node Service requests generated from calling `Transaction.build()`. However, the count of requests can increase above 5 for larger and different transaction blocks. You can run a test with your transactions and observe your own results.
</Info>

## Transaction.build()

In order to build the transaction, the [`Transaction` build method](https://github.com/MystenLabs/ts-sdks/blob/main/packages/sui/src/transactions/Transaction.ts#L765) uses the Fullnode client you pass it to make a variety of JSON-RPC requests to get the information it needs to build the transaction. This can include, but is not necessarily limited to, fetching the current reference gas price, retrieving the structured representation of any Move calls, fetching information about any objects involved in the transaction, and checking the available gas coins of the address paying for the gas (sender or otherwise).

*The exact type and count of requests your Transaction.build() calls produce will vary based on the contents of your transaction blocks.*

When you build the transaction block, you pass in a Sui Fullnode client:

<CodeGroup>
  ```bash Shinami TypeScript SDK theme={null}
  const nodeClient = new SuiClient({ url: getFullnodeUrl("testnet") });
  let txb = new Transaction();
  // populate the Transaction
  const txBytes = await txb.build({ client: nodeClient, onlyTransactionKind: false});
  ```
</CodeGroup>

One of my recent calls to`txb.build()` produced the following requests to the client I provided it:

```
"sui_getNormalizedMoveFunction": 1,
"sui_getProtocolConfig": 1,
"sui_multiGetObjects": 1,
"suix_getCoins": 1,
"suix_getReferenceGasPrice": 1
```

*The exact type and count of requests your Transaction.build() calls produce will vary based on the contents of your transaction blocks.*

## devInspectTransactionBlock

`devInspectTransactionBlock` can be sent a Transaction. If you do this, [it will call Transaction.build() with the input block](https://github.com/MystenLabs/ts-sdks/blob/main/packages/sui/src/jsonRpc/client.ts#L777) , which will lead to additional Node Service requests made from the build process.

<CodeGroup>
  ```bash Shinami TypeScript SDK theme={null}
  let txb = new Transaction();
  // populate the Transaction

  await nodeClient.devInspectTransactionBlock({
      transactionBlock: txb,
      sender: SENDER_ADDRESS
  });
  ```
</CodeGroup>

One of my recent calls to `sui_devInspectTransactionBlock` with an Transaction produced four requests to Shinami's Node service:

```
"sui_getNormalizedMoveFunction": 1,
"sui_getProtocolConfig": 1,
"sui_multiGetObjects": 1,
"sui_devInspectTransactionBlock": 1
```

*The exact type and count of requests your Transaction.build() calls produce will vary based on the contents of your transaction blocks.*

## buildGaslessTransaction (Shinami TypeScript SDK)

Our SDK has a helper function called `buildGaslessTransaction` to prepare a Transaction for Gas Station sponsorship. Here is an example of calling it with a function to populate a transaction:

<CodeGroup>
  ```bash Shinami TypeScript SDK theme={null}
  import { buildGaslessTransaction } from "@shinami/clients/sui";
  ...
  await buildGaslessTransaction(
    (txb) => {
      txb.moveCall({
        target: "0xfa0e78030bd16672174c2d6cc4cd5d1d1423d03c28a74909b2a148eda8bcca16::clock::access",
        arguments: [txb.object('0x6')],
      });
    },
    {
      sui: nodeClient
    }
  );
  ```
</CodeGroup>

This function [calls `Transaction.build()`](https://github.com/shinamicorp/shinami-typescript-sdk/blob/main/packages/clients/src/sui/gas.ts#L188). As a result, it will produce the same set of requests that would get produced if you called `Transaction.build()` directly on a similarly populated Transaction.
