This repository has been archived by the owner on Jun 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Importing assets from Stellar to ZkVM | ||
|
||
This protocol defines the process of importing of assets originally issued on the Stellar into ZkVM and exporting them back to the Stellar network. | ||
|
||
The protocol uses _trusted custodian_ secured with multi-signatures and stateless validation (only the blockchain state is used). | ||
|
||
## Importing assets | ||
|
||
TBD: | ||
|
||
## Exporting assets | ||
|
||
TBD: | ||
|
||
## Asset to flavor mapping | ||
|
||
To map the stellar asset, we will use `metadata` argument that represents an XDR-encoded `Asset` structure | ||
as specified in the `Stellar-ledger-entries.x` XDR file: | ||
|
||
``` | ||
namespace stellar { | ||
typedef PublicKey AccountID; | ||
... | ||
typedef opaque AssetCode4[4]; | ||
typedef opaque AssetCode12[12]; | ||
enum AssetType { | ||
ASSET_TYPE_NATIVE = 0, | ||
ASSET_TYPE_CREDIT_ALPHANUM4 = 1, | ||
ASSET_TYPE_CREDIT_ALPHANUM12 = 2 | ||
}; | ||
union Asset switch (AssetType type) { | ||
case ASSET_TYPE_NATIVE: void; | ||
case ASSET_TYPE_CREDIT_ALPHANUM4: | ||
struct { | ||
AssetCode4 assetCode; | ||
AccountID issuer; | ||
} alphaNum4; | ||
case ASSET_TYPE_CREDIT_ALPHANUM12: | ||
struct { | ||
AssetCode12 assetCode; | ||
AccountID issuer; | ||
} alphaNum12; | ||
}; | ||
} | ||
``` | ||
|
||
The resulting _flavor scalar_ is therefore formed as any other flavor, as a combination of the ZkVM issuer (custodian) key and the metadata identifying the Stellar asset. | ||
|
||
See also [ZkVM `issue` documentation](zkvm-spec.md#issue). |