Version: 25.2.0
Tezos X call preparation (Beta)
Beta. The public API is subject to change.
@taquito/tezosx prepares unsigned NAC calls for compatible Tezos X kernels. It is optional and is not imported by @taquito/utils or the toolkit. The NAC call builders follow kernel revision fb064e9f6a13c0ebd7bb1b7ec6727274e2dc23af.
Install the beta
npm install @taquito/tezosx@next
The npm beta includes the NAC call builders. The Next guide can also cover APIs that have
yet to reach npm. To try one of those APIs, check out a revision that includes it and run
npm ci and npm run build at the repository root. Check that the target network runs a
compatible kernel before using the builders.
Etherlink 8.0 (Horus) migration
Horus is available on Tezos X Previewnet. Confirm the deployed kernel on your target network before changing your integration.
Horus changes the EVM aliases of tz1, tz2, and tz3 accounts. If your app stores or displays
these aliases, recompute them when the target network activates Horus. The alias identifies the
Michelson caller on the EVM interface. Any allowance or other contract state keyed by the old
address still belongs to that address. Already-materialized legacy aliases continue forwarding
native tez. ERC-20 balances and NFTs held at those addresses do not move to the new aliases.
On the target network’s EVM JSON-RPC endpoint, call tez_getTezosEthereumAddress with the Tezos
address as its only parameter. Use tez_getEthereumTezosAddress for the other direction. These
methods derive addresses. For a cross-runtime gateway resolveAddress query, classified: true
with res: 0 means recorded and res: 1 means derived. With classified: false, the input could
not be classified. Ignore its res value. If you cache aliases, include the target network and
derivation version in the cache key.
Refresh cached gas estimates after the upgrade. The Michelson interface refunds the fee for
unused gas and reports common operation errors with Tezos L1 error IDs and fields. Matches on the
old tezlink_error ID or on debug strings need updating. If your app decodes EVM reverts from
cross-runtime calls, a Michelson out-of-gas failure now carries status 429 and body OOG.
See the Horus upgrade proposal, and the Etherlink alias RPCs.
Michelson to EVM
import { buildMichelsonToEvmCall, toTransferParams } from '@taquito/tezosx';
const call = buildMichelsonToEvmCall({
to: '0x1111111111111111111111111111111111111111',
value: 1000000000000000n,
});
const transfer = toTransferParams(call);
value is wei. The example produces a transfer of 1000 mutez to the built-in Michelson gateway. A contract call also supplies ABI calldata and, when its selector is not known, methodSignature. The builder checks that signature against the selector and removes exactly its four bytes. The kernel reconstructs the selector.
gatewayAddress can override the pinned gateway address. A call_evm callback is None by default, or Some with an address representation for a contract accepting bytes. The codec rejects implicit accounts as bytes callbacks. Use simulation to check the parameter type of a deployed entrypoint. For native transfers, omit the callback or pass None.
For a readable callback targeting the default entrypoint, pass the bare KT1 address. The builder preserves an explicit %default suffix, which the pinned kernel rejects.
EVM to Michelson
import { buildEvmToMichelsonCall } from '@taquito/tezosx';
const request = buildEvmToMichelsonCall({
kind: 'call-michelson',
destination: targetContract,
entrypoint: 'set',
parameter: { value: { int: '42' }, type: { prim: 'nat' } },
});
The result has to, data, value in wei and gasLimit. It does not select an account, nonce, chain ID or fees, and does not sign or submit anything. kind: 'transfer' takes an amount in mutez and a tz1 through tz4 or KT1 destination. The builders expose POST calls only. Generic kernel GET support is outside this API.
For a viem client, the transaction field is gas. The builder returns an initial gasLimit estimate. Use a public client and the actual sender on the selected network to estimate gas before signing:
const transaction = {
to: request.to,
data: request.data,
value: request.value,
};
const gas = await publicClient.estimateGas({ account: sender, ...transaction });
const unsignedTransaction = { ...transaction, gas };
publicClient, sender and targetContract come from your application. This example prepares an unsigned transaction and does not send it. A successful gas estimate does not verify other contracts, callbacks or networks.
Entrypoint names start with an ASCII letter, digit or underscore. Subsequent characters may also include ., % and @, up to 31 characters in total.
Parameters can be expressions or canonical binary Micheline. Michelson strings accept printable ASCII and line feeds. For UTF-8 text, use a bytes literal when the receiving contract accepts bytes. Raw input must contain exactly one expression without an outer PACK marker. A raw expression can itself begin with 05, as Some does; do not remove that byte. The codec uses the optional type hint for both validation and encoding. For contract handles, it checks the address and the parameter types supported by implicit accounts. Verifying a deployed contract’s parameter type requires simulation. Non-packable type hints are rejected. Without a hint, the builder validates data structure but cannot check the target schema.
The codec can encode a tz5 address in a typed Michelson parameter. The pinned kernel rejects that address when it decodes the parameter.
Derive aliases offline
import { getEthereumAlias, getTezosAlias } from '@taquito/tezosx';
const evmAlias = getEthereumAlias('tz1aygVpocoeEMU89vXk92sMHqPYFNZVgvrh', 'horus');
const michelsonAlias = getTezosAlias('0x1234567890abcdef1234567890abcdef12345678');
For Tezos-to-EVM derivation, pass the kernel running on your target network. Use ganesha
for Etherlink 7 and horus for Etherlink 8. Horus changes the aliases of tz1, tz2, and
tz3 accounts. EVM-to-Michelson derivation uses the same formula on both kernels.
These helpers derive an address from the input alone. To check whether the alias is recorded
on-chain, use the gateway’s resolveAddress view.
For a cross-runtime lookup, classified: true with res: 0 means recorded and res: 1
means derived. Ignore res when classified is false.
Amounts and verification limits
Amounts accept a bigint, a safe integer number, or an unsigned decimal or 0x integer string. Negative, fractional and unsafe-number inputs are rejected. One mutez is exactly 10^12 wei. Sub-mutez remainders and amounts above 2^63 minus 1 mutez are rejected. toTransferParams also rejects amounts above JavaScript’s safe-integer limit.
Defaults identify the pinned kernel, not every network. Check the target deployment. Initial gas limits are estimates, not guarantees; use read-only eth_estimateGas for the actual call. A successful zero-value Previewnet simulation does not verify funded transfers, custom contracts or callbacks. The selected node’s deployed kernel commit has not been established by these tests.
ABI fixtures use eth-abi 5.2.0 and PyCryptodome Keccak, with raw Micheline and optimized addresses checked against Octez 25.3. The UTF-8 bytes fixture uses Octez 25.2 and Foundry Cast. Gateway parameters containing contract-valued callbacks are compared as raw Micheline, not claimed to be protocol PACK fixtures.
The implementation adapts AurelienFT’s Apache-licensed Octez.js contributions #123 through #126. Source and commit attribution is retained in NOTICE and commit trailers.
Materialize an alias on Horus
Horus can create an alias on-chain before the first cross-runtime call. Use the RPC and sender for the runtime where the alias will be created. Both builders prepare unsigned requests and set the transfer value to zero. The sender still pays fees. First-time Michelson alias creation can also incur a storage burn. EVM precompiles and the Michelson gateway are ineligible as source accounts.
Create an EVM alias for a Michelson account
import { buildEvmAliasMaterialization } from '@taquito/tezosx';
const request = buildEvmAliasMaterialization({
kind: 'implicit',
address: tezosAccountAddress,
publicKey: tezosPublicKey,
});
const gas = await publicClient.estimateGas({ account: evmSender, ...request });
const unsignedTransaction = { ...request, gas };
Use a viem client on the target Etherlink EVM RPC. An implicit tz1 through tz4 account
requires its matching Tezos public key. For a native Michelson contract, use kind: 'contract'
with its KT1 address and omit publicKey.
Create a Michelson alias for an EVM account
import { buildTezosAliasMaterialization } from '@taquito/tezosx';
const transfer = buildTezosAliasMaterialization({
address: evmAccountAddress,
publicKey: evmPublicKey,
});
const estimate = await Tezos.estimate.transfer(transfer);
Configure Tezos with the target Michelson RPC and a signer for the Michelson sender before
estimating. The EVM account address can be lowercase or EIP-55 checksummed. For an EOA whose
native status is unknown to the gateway, supply the matching raw or uncompressed secp256k1
public key in hex. You can omit the key when the gateway can establish that the account is native
from chain state. The transfer parameters work with Tezos.contract.transfer and
Tezos.wallet.transfer.