VaultCreate

[Source]

Creates a new Vault ledger entry, an MPTokenIssuance ledger entry for the vault’s shares, and an AccountRoot for the vault’s pseudo-account.

Only the Vault Owner can initiate this transaction.

Note

Currently, the same account that creates the vault must also create other protocols, though this may change in the future.

(Requires the Single Asset Vault amendment )

Example VaultCreate JSON

{
  "TransactionType": "VaultCreate",
  "Account": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX",
  "Fee": "12",
  "Flags": 0,
  "LastLedgerSequence": 7108682,
  "Sequence": 8,
  "Data": "5468697320697320617262697472617279206D657461646174612061626F757420746865207661756C742E",
  "Asset": {
    "currency": "USD",
    "issuer": "rIssuer1234567890abcdef1234567890abcdef",
  },
  "AssetMaximum": 0,
  "MPTokenMetadata": "5468697320697320617262697472617279206d657461646174612061626f757420746865204d50542073686172652e",
  "WithdrawalPolicy": "0x0001",
  "DomainID": "77D6234D074E505024D39C04C3F262997B773719AB29ACFA83119E4210328776"
}

VaultCreate Fields

In addition to the common fields, VaultCreate transactions use the following fields:

Field NameJSON TypeInternal TypeRequired?Description
DataStringBlobNoArbitrary vault metadata, in hex format, limited to 256 bytes.
AssetString/ObjectIssueYesThe asset to be held in the vault. This can be XRP, a Fungible Token, or an MPT. If the asset is a Fungible Token, the transaction creates a trust line between the vault's pseudo-account and the issuer of the asset. If the asset is an MPT, the transaction creates an MPToken object for the vault's pseudo-account.
AssetMaximumNumberUInt64NoThe maximum asset amount that can be held in a vault.
MPTokenMetadataStringBlobNoArbitrary metadata about the share MPToken, in hex format, limited to 1024 bytes. Use this field if the vault's asset is an MPT.
WithdrawalPolicyNumberUInt8NoIndicates the withdrawal strategy used by the vault. The default value is 0x0001, mapped to the string strFirstComeFirstServe. See WithdrawalPolicy.
DomainIDStringHash256NoThe PermissionedDomain object ID associated with the shares of this vault. If provided, the transaction creates a private vault, which restricts access to accounts with credentials in the specified Permissioned Domain.

VaultCreate Flags

VaultCreate transactions support additional values in the Flags field, as follows:

Flag NameValueDescription
tfVaultPrivate0x00010000Indicates that the vault is private. This flag can only be set when creating the vault.
tfVaultShareNonTransferable0x00020000Indicates the vault share is non-transferable. This flag can only be set when creating the vault.

WithdrawalPolicy

A WithdrawalPolicy defines the strategy for processing withdrawal requests from a vault. This policy governs how liquidity is removed. Currently, only one strategy is supported:

Policy NameValueDescription
strFirstComeFirstServe0x0001Requests are processed on a first-come, first-served basis. With this strategy, a depositor can redeem any amount of assets, provided they hold a sufficient number of shares.

Transaction Cost

Since the VaultCreate transaction creates a new AccountRoot object for a vault’s pseudo-account, it incurs a higher than usual transaction cost to deter ledger spam. Instead of the standard minimum of 0.00001 XRP, VaultCreate must destroy an incremental owner reserve, currently 0.2 XRP.

Error Cases

Besides errors that can occur for all transactions, VaultCreate transactions can result in the following transaction result codes:

Error CodeDescription
tecNO_AUTHOccurs if the asset is an MPT and the lsfMPTCanTransfer flag is not set in the MPTokenIssuance object, meaning the vault cannot be created with a non-transferable MPT.
tecLOCKEDOccurs if the asset is an MPT and the lsfMPTLocked flag is not set in the MPTokenIssuance object, meaning the asset is locked.
tecFROZENOccurs if the asset is a Fungible Token and the lsfGlobalFreeze flag is set on the VaultOwner. This means a vault cannot be created for a frozen asset.
temMALFORMEDOccurs when the tfVaultPrivate flag is not set, and a DomainID is provided, meaning the VaultOwner is attempting to create a public vault with a PermissionedDomain.
tecNO_ENTRYOccurs if the PermissionedDomain object with the provided DomainID does not exist.
temMALFORMEDOccurs if the Data field is larger than 256 bytes.
tecINSUFFICIENT_RESERVEOccurs when there is insufficient AccountRoot.Balance for the Owner Reserve.