The Bitpowr Safe Contract is a non-custodial smart contract wallet designed to minimize transaction fees and simplify onboarding users to web3 applications with support for multiple chains.
Most EVM chain wallets are typically controlled by a single private key. Each address generated is associated with an account and a corresponding private key for fund access.
However, the Bitpowr Safe Contract introduces a unique approach. It allows for the deployment of a distinct smart contract wallet for each user, which can be controlled by either a deployer’s private key, multiple private keys, or individual users’ private keys. This offers more control over user onboarding and transaction fee management.
The Bitpowr Safe Contract utilizes the
create2 method to generate gasless on-chain wallet addresses, which can be deployed when users deposit funds into the address or at any time.
- Multi-Chain Support: Ethereum, Polygon, Binance Smart Chain, Tron.
- Custodial & Non-Custodial: The Bitpowr Safe Contract can be operated as both a non-custodial wallet or a custodial one, depending on the preferences of the deployer.
- Fee Abstraction: Deployers can cover the transaction fees. Fees are only incurred when users deposit funds, allowing flexibility in fee management.
- Batch Transaction: Support for batch transferring multiple assets, including ERC20, ERC721, and ERC1155 (work in progress).
- Flush: Capability to flush tokens to the deployer’s address.
- Auto Flush: Native assets like ETH and MATIC are automatically flushed to the master address upon incoming deposits.
The Bitpowr Safe Contract is written in Solidity and is technically compatible with all EVM chains.
Currently supported networks:
- Ethereum - Mainnet, Ropsten
- Polygon - Mainnet, Mumbai
- Binance Smart Chain - Mainnet, Testnet
- Tron - Mainnet, Shasta
Gas & Transaction Fees
The Bitpowr Safe Contract is a smart contract wallet designed to manage and abstract transaction fees, relieving users of this burden. Transaction fees are covered in native chain assets by the deployer or owner of the wallet.
Sending Out Transactions
To initiate transactions, users need to call the smart contract’s transfer command to execute on-chain transfers to the desired addresses. The cost of the transaction is the expense of calling this function, with gas fees incurred based on the gas required to execute the transfer method.
To start using the Bitpowr SDK, you can install it via npm or yarn:
bashCopy code $ npm install --save @bitpowr/contract
bashCopy code $ yarn add @bitpowr/contract
.npmrc file containing our private package registry configuration is required to install the package.
lessCopy code @bitpowr:registry=https://gitlab.com/api/v4/packages/npm/ //gitlab.com/api/v4/projects/26875049/packages/npm/:_authToken=<sdkToken> //gitlab.com/api/v4/packages/npm/:_authToken=<sdkToken>
Wallet Contracts Comment
There are two types of EVM chain wallets: Externally Owned Account (EOA) and Smart Contract Wallet. One is deployed on the blockchain, and the other does not require deployment.
Bitpowr Safe utilizes a smart contract wallet, which allows the implementation of custom functionalities, logic, and behaviors supported by the virtual machine.
Bitpowr employs factory contracts to clone contracts on-chain when deploying a new wallet, utilizing the
create2 method to generate feeless on-chain wallets.
Bitpowr Safe comprises two main contracts:
- AddressFactory: The address factory facilitates address deployment, and predicts addresses using
- Address: The Address contract serves as the wallet deployed to manage user funds.
The address factory is a factory proxy contract that aids in cloning and deploying contracts to an address generated uniquely via create2.
- deployAddress: Deploys a proxy contract to a uniquely generated address using a salt passed to the
create2command. This method essentially clones and deploys a previously deployed contract to a new address.
- predictAddress: Generates gasless smart contract addresses that can be provided to users without incurring a fee. This ensures that the predicted address is uniquely generated using the given salt and the owner’s address, eliminating any address collisions.
- predictDeterministicAddress: If you prefer generating a custom salt using a specific language, you can directly pass the salt to this function.
The Address contract is responsible for holding assets and executing on-chain transactions and operations. It automatically flushes incoming native assets to the deployer’s/owner’s address.
The deployer is, by default, the owner of the address, and ownership can be transferred to another address using the
- getBalance: Retrieves the balance of native and ERC20 assets.
- transferOwnership: Transfers contract ownership to another address, typically the user’s address.
- transfer: Executes native and ERC20 transactions to another address, incurring gas fees only for calling the function.
- transferToMany: Initiates transfers to multiple addresses in a single transaction, with the option to specify the ERC20 token for the transfer.
- flush: Flushes native assets to the deployer’s/owner’s address.
- flushTokens: Flushes a single ERC20 token to the deployer’s/owner’s address.
- flushMultipleTokens: Flushes multiple ERC20 tokens to the deployer’s/owner’s address.
- enableAutoFlush: Enables auto flush for incoming deposits of native assets.
- disableAutoFlush: Disables auto flush for incoming deposits of native assets.
- changeTransferGasLimit: Adjusts the gas limit for on-chain transfers.
Genesis contracts are templates deployed and stored on the blockchain, which can later be cloned on-chain to create additional contracts. These contracts are built on the Proxy and Factory Contracts. The
AddressFactory contracts are deployed to the blockchain as genesis contracts, enabling the generation of gasless addresses, contract deployment, and on-chain asset management while allowing individuals to retain control of their private keys. Bitpowr deploys these contracts on each supported chain, enabling users to clone these contracts on-chain while maintaining their private keys.