Create Alias Output
An Alias Output is a specific implementation of a UTXO state machine. The Alias ID, the unique identifier of an instance of the deployed state machine, is generated deterministically by the protocol and is not allowed to change in future state transitions.
An Alias Output represents an alias account in the ledger with two control levels and a permanent Alias Address. The account owns other outputs that are locked under the Alias Address. The account keeps track of state transitions (State Index
counter) and controlled foundries (Foundry Counter
) and anchors the layer 2 state as metadata into the UTXO ledger.
Example Code
- Rust
- Typescript (Node.js)
- Python
The following example will:
- Instantiate a
Wallet
, get Alice'sAccount
which was created in the first guide. - Create an Alias Output transaction by calling the
Account.create_alias_output()
function.
- Retry the
Transaction
until included.
The following example will:
- Instantiate a
Wallet
, get Alice'sAccount
which was created in the first guide and sync it. - Create an Alias Output transaction by calling the
Account.createAliasOutput()
function.
- Await for the
Transaction
to get confirmed by calling theAccount.retryTransactionUntilIncluded
function.
- Instantiate a
Wallet
, get Alice'sAccount
which was created in the first guide and sync it. - Prepare an Alias Output transaction by calling the
Account.prepare_create_alias_output()
function, and then send it.
Full Example Code
- Rust
- Typescript (Node.js)
- Python
sdk/examples/how_tos/alias_wallet/request_funds.rs
loading...
bindings/nodejs/examples/how_tos/alias/create.ts
loading...
bindings/python/examples/how_tos/alias/create.py
loading...
Expected Output
Aliases BEFORE:
[
...
]
Sending the create-alias transaction...
Transaction sent: 0x7ce05ab09bc562c7b383067b774edd780e3a9235e9c76a5cccabdd9744b6a719
Block included: https://explorer.shimmer.network/testnet/block/0x603c0e010b4e7665913c04729aad692a1c7557234185e98c821e1142fa49823d
Aliases AFTER:
[
...
]