create2
Call Re-added v210 → v323, v326 → current #3Deploys a contract using CREATE2 for deterministic addressing.
View calls on chainCall Workflow
This diagram shows the call execution flow: starting with create2, passing through validation
(signature, nonce, mortality, fee payment), then pre-dispatch checks, followed by dispatch which emits events: Log, Created, CreatedFailed and modifies storage: AccountCodes, AccountCodesMetadata, AccountStorages, and finally post-dispatch where ExtrinsicSuccess is emitted and fees are settled.
Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.
Click items to navigate. Pan and zoom to explore.
Used by: developers
The Big Picture
CREATE2 enables knowing the contract address before deployment - essential for advanced patterns.
Use Cases
- Predictable addresses
- Counterfactual deployment
- Factory patterns
From Chain Metadata
Issue an EVM create2 operation.
Input Parameters
| # | Name | Type | Description |
|---|---|---|---|
| 0 | source | H160 | source (H160) |
| 1 | init | Vec<u8> Vec | init (Vec<u8>) |
| 2 | salt | H256 | salt (H256) |
| 3 | value | U256 | value (U256) |
| 4 | gas_limit | u64 | gas_limit (u64) |
| 5 | max_fee_per_gas | U256 | max_fee_per_gas (U256) |
| 6 | max_priority_fee_per_gas | Option | max_priority_fee_per_gas (Option) |
| 7 | nonce | Option | nonce (Option) |
| 8 | access_list | Vec<(H160, Vec<H256>)> Vec | access_list (Vec<(H160, Vec<H256>)>) |
| 9 | authorization_list | Vec<AuthorizationListItem> Vec | authorization_list (Vec<AuthorizationListItem>) |
Permissions
Origin
Unknown
Required Role
Permission data inferred from metadata. May be incomplete.
Requirements
- Valid init code
- Salt specified
- Sufficient gas
- Whitelisted if required
Effects
Events Emitted
Storage Modified
Postconditions
- Contract at address from salt + init code hash
Side Effects
- Address predictable before deployment
Code Examples
import { ApiPromise, WsProvider } from "@polkadot/api";
import { stringCamelCase } from "@polkadot/util";
const provider = new WsProvider("wss://entrypoint-finney.opentensor.ai:443");
const api = await ApiPromise.create({ provider });
// Build create2 call
const source = 0 as any /* H160 */;
const init = 0;
const salt = 0 as any /* H256 */;
const value = 0 as any /* U256 */;
const gas_limit = 0;
const max_fee_per_gas = 0 as any /* U256 */;
const max_priority_fee_per_gas = 0 as any /* Option */;
const nonce = 0 as any /* Option */;
const access_list = 0 as any /* Vec<(H160, Vec<H256>)> */;
const authorization_list = 0 as any /* Vec<AuthorizationListItem> */;
const call = api.tx[stringCamelCase("EVM")][stringCamelCase("create2")](
source,
init,
salt,
value,
gas_limit,
max_fee_per_gas,
max_priority_fee_per_gas,
nonce,
access_list,
authorization_list
);Version History
v210 block 4,345,556 9 args
v326 block 6,608,228 10 args Current
Runtime Info
- Pallet Index
- 22
- Call Index
- 3
- First Version
- v210
- Current Version
- v393