Ephemeral Deposits
Using ephemeral 0x-accounts served on the library side
Last updated
Was this helpful?
Using ephemeral 0x-accounts served on the library side
Last updated
Was this helpful?
The ephemeral deposit scheme was designed to give the ability to deposit to a zk-account from the smart contracts (e.g. bridges). The idea is to temporary give control over the deposited funds to some EOA, which can then make a regular permittable deposit.
Such an EOA is an ad-hoc generated account derived from the zk-account spending key. So the library controls ephemeral private keys and has full access over the funds on the ephemeral addresses
Since deposits to a single zkBob account can be made from different smart contract wallets, reusing the same ephemeral EOA address is not a good idea, as it can be used to link together independent deposits. A better option is to use a newly generated EOA address for each new deposit.
Using ephemeral deposit scheme is an early developed feature. At now the are more suitable to process external deposits
To use an ephemeral deposit you should send funds to the ephemeral address first. The address must have a sufficient balance to process the deposit and cover the relayer fee.
amountGwei
- token amount to deposit into an account (in pool dimension).
ephemeralIndex
- an index of the ephemeral address.
relayerFee
- a raw which will be used to estimate the total transaction fee (will requested under the hood when undefined).
Promise
returns jobId
returned by relayer which can be use to monitor the transaction.
Scanning over the ephemeral addresses pool to find the first address which was not in use. The address is considering to be non-used if token balance, native balance, native and permit nonces are zero.
Promise
returns index of the first non-used ephemeral address.
index
- an index of requested ephemeral address.
Request details of all ephemeral addresses which were already used.
index
- an index of the ephemeral address.
Promise
returns number of incoming token transfers to the ephemeral address with the requested index.
index
- an index of the ephemeral address
Promise
returns number of outgoing token transfers to the ephemeral address with the requested index.
Use this method only for emergency reasons. Everyone who has the private key has full control over the funds on that ephemeral address.
index
- an index of the ephemeral address
A string with the private key in the hex representation
The library generates ephemeral addresses with (hierarchical deterministic wallets). So the every address has an index (the last HD path component).
Promise
returns object.
Promise
returns array of objects.