SmartAccount Factories
ECDSASmartAccount and MultisigECDSASmartAccount for SmartAccount.
ECDSASmartAccount
A ECDSASmartAccount
is a factory which creates a SmartAccount
instance
that uses single ECDSA key for signing payload.
create
Creates a SmartAccount
instance that uses a single ECDSA key for signing payload.
Inputs
Parameter | Type | Description |
---|---|---|
address | HexStr | The account address. |
secret | HexStr | The ECDSA private key. |
provider | Web3 | The provider to connect to. |
Example
from eth_account import Account
from eth_account.signers.local import LocalAccount
from web3 import Web3
from zksync2.account.smart_account import SmartAccount, ECDSASmartAccount
from zksync2.module.module_builder import ZkSyncBuilder
if __name__ == "__main__":
ZKSYNC_PROVIDER = "https://sepolia.era.zksync.dev"
zksync = ZkSyncBuilder.build(ZKSYNC_PROVIDER)
account = ECDSASmartAccount.create(multisig_address, [private_key_1, private_key_2], self.zksync)
MultisigECDSASmartAccount
A MultisigECDSASmartAccount
is a factory which creates a SmartAccount
instance
that uses multiple ECDSA keys for signing payloads.
The signature is generated by concatenating signatures created by signing with each key individually.
create
Creates a SmartAccount
instance that uses multiple ECDSA keys for signing payloads.
Inputs
Parameter | Type | Description |
---|---|---|
address | string | The account address. |
secret | [HexStr] | The list of the ECDSA private keys. |
provider | Web3 | The provider to connect to. |
Example
from eth_account import Account
from eth_account.signers.local import LocalAccount
from web3 import Web3
from zksync2.account.smart_account import SmartAccount, MultisigECDSASmartAccount
from zksync2.module.module_builder import ZkSyncBuilder
if __name__ == "__main__":
ZKSYNC_PROVIDER = "https://sepolia.era.zksync.dev"
zksync = ZkSyncBuilder.build(ZKSYNC_PROVIDER)
account = MultisigECDSASmartAccount.create(multisig_address, [private_key_1, private_key_2], self.zksync)