--- title: updateWitness description: "Builds an unsigned WitnessUpdateContract transaction that changes the node URL of an existing witness (Super Representative); must be signed and broadcast." keywords: ["updatewitness", "transactionbuilder", "super representative", "witness url", "update witness", "tronweb"] --- # updateWitness > Added in **6.4.0**. Create an unsigned `WitnessUpdateContract` transaction that updates the node URL of an existing witness (Super Representative). The owner account must already be a witness — see [applyForSR](./applyForSR.md) to register one. ## Usage ```javascript // Format const transaction = await tronWeb.transactionBuilder.updateWitness(address, url, options); ``` ## Parameters | Argument | Description | Type | | -------- | ----------- | ---- | | address | The witness owner address (hexstring or base58). Defaults to the instance's `defaultAddress.hex`. | string | | url | The new witness node URL. Must be a valid URL and at most 256 characters. | string | | options | Optional. See the fields below. | `{ permissionId?: number, blockHeader?: object }` | - `permissionId` — permission id for multi-signature. - `blockHeader` — a partial transaction `raw_data` (e.g. `ref_block_bytes`, `ref_block_hash`, `expiration`) that pins the reference block, typically obtained from `await tronWeb.trx.getCurrentRefBlockParams()`. An invalid or over-long (> 256 chars) URL throws `Invalid url provided`. ## Returns Unsigned transaction object. It is **not** broadcast — sign and send it with [`tronWeb.trx.sign`](../trx/sign.md) and [`tronWeb.trx.sendRawTransaction`](../trx/sendRawTransaction.md) for it to take effect on-chain. ## Example ```javascript const transaction = await tronWeb.transactionBuilder.updateWitness( 'TPL66VK2gCXNCD7EJg9pgJRfqcRazjhUZY', 'https://xtron-updated.network' ); console.log(transaction); // output-start { visible: false, txID: 'b8d...e0c9', raw_data: { contract: [ { parameter: { value: { owner_address: '41928c9af0651632157ef27a2cf17ca72c575a4d21', update_url: '68747470733a2f2f7874726f6e2d757064617465642e6e6574776f726b' }, type_url: 'type.googleapis.com/protocol.WitnessUpdateContract' }, type: 'WitnessUpdateContract' } ], ref_block_bytes: '...', ref_block_hash: '...', expiration: 1718000000000, timestamp: 1717999940000 }, raw_data_hex: '...' } // output-end ```