exchange.IO("sendBase", ...)
Sets a node dedicated solely to broadcasting transactions. Once set, requests such as reading data, querying the nonce, and estimating gas still use the node configured for the exchange object, while signed transactions are sent only to this node. This feature is suitable for private transaction channels such as Flashbots Protect and MEV Blocker, and prevents transactions from being front-run or sandwich-attacked after entering the public mempool.
exchange.IO(k)
exchange.IO(k, url)Examples
Send transactions through MEV Blocker.
javascript
function main() {
// Read requests still go through the node configured for the exchange object; signed
// transactions are sent only to MEV Blocker
var old = exchange.IO("sendBase", "https://rpc.mevblocker.io")
Log("Previous send node:", old, "Current send node:", exchange.IO("sendBase"))
// Subsequent transactions are all sent through the private channel, for example:
// var txHash = exchange.IO("api", "eth", "send", toAddress, value)
// Pass an empty string to clear the setting and restore sending from the configured node
exchange.IO("sendBase", "")
}Returns
| Type | Description |
string | Returns the send node address in effect before the setting; returns an empty string if it was not previously set. |
Arguments
| Name | Type | Required | Description |
k | string | Yes | Function of the |
url | string | No | JSON-RPC address of the node (supports the http or https protocol), for example |
See Also
Remarks
Transactions sent through a private channel are not counted in the pending count of public nodes; when sending transactions consecutively, the local nonce record ensures that the nonce is not reused. For details, see exchange.IO("nonce", ...).
Requests sent to this node do not carry the authentication information (ApiKey) of the node configured for the exchange object.
It affects transactions sent by exchange.IO("api", ...) (transfers and contract writes) and the replacement transactions of exchange.IO("speedUp", ...) and exchange.IO("cancelTx", ...); nothing is sent with dryRun.
Currently only Ethereum (EVM) chains are supported; on TRON the call returns a null value with the error in GetLastError().