BTC20 Smart Chain accounts are fundamental entities that enable transactions and interactions on the BTC20 Smart Chain network. These accounts can hold BTCC balances, send transactions, and interact with smart contracts. Below, we explore the types of accounts, their functionalities, and how they are created and managed.
Account Types on BTC20 Smart Chain
BTC20 Smart Chain supports two primary types of accounts:
Externally-Owned Accounts (EOA)
- Controlled by private keys.
- Can initiate transactions.
- Used for BTCC and token transfers.
Contract Accounts
- Deployed as smart contracts.
- Execute transactions only when triggered.
- Enable complex operations like token transfers or new contract creation.
Key Differences Between EOA and Contract Accounts
| Feature | Externally-Owned Account (EOA) | Contract Account |
|---|---|---|
| Creation Cost | Free | Requires network storage fees |
| Transaction Initiation | Yes | Only in response to received transactions |
| Private Keys | Yes | No (controlled by smart contract code) |
| Flexibility | Limited to transfers | Can execute complex logic |
Structure of a BTC20 Smart Chain Account
Every BTC20 Smart Chain account contains four critical fields:
Nonce
- Tracks transaction count (EOA) or contract creations (contract accounts).
- Prevents replay attacks.
Balance
- Holds the BTCC balance in wei (1 BTCC = 1e+18 wei).
CodeHash
- References the EVM code for contract accounts.
- Empty for EOAs.
StorageRoot
- Encodes storage contents via a Merkle Patricia trie.
Externally-Owned Accounts and Key Pairs
An EOA consists of:
- A private key (64 hex characters) for signing transactions.
- A public key, derived using Elliptic Curve Digital Signature Algorithm (ECDSA).
- A public address (last 20 bytes of Keccak-256 hash of the public key).
👉 Learn more about securing your private keys
Creating an Account
- Generate a random private key (e.g.,
fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd036415f). - Derive the public key using ECDSA.
- Generate the public address from the public key.
Note: Never share your private key! It grants full control over your account.
Contract Accounts
Contract accounts are identified by a 42-character hexadecimal address (e.g., 0x06012c8cf97bead5deae237070f9587f8e7a266d). The address is determined during deployment based on:
- The creator’s address.
- The transaction nonce.
👉 Explore smart contract deployment
Validator Keys and BLS
BTC20 Smart Chain uses BLS keys to identify validators. These keys enable efficient aggregation, reducing bandwidth requirements for consensus. Without BLS, validator staking minimums would be significantly higher.
Wallets vs. Accounts
- Account: A keypair for user-owned BTC20 Smart Chain interactions.
- Wallet: An interface (e.g., MetaMask) to manage your account.
FAQs About BTC20 Smart Chain Accounts
Q1: Can I recover a lost private key?
A1: No. Private keys cannot be recovered. Always store backups securely.
Q2: Are contract accounts more secure than EOAs?
A2: They serve different purposes. Contracts execute predefined logic, while EOAs require manual transaction signing.
Q3: What’s the minimum BTCC balance for an account?
A3: None. Accounts can exist with zero balance, but transactions require gas fees.
Q4: How do I convert wei to BTCC?
A4: 1 BTCC = 1e+18 wei. Use a converter tool for calculations.
Q5: Can a contract account initiate transactions?
A5: Only in response to receiving a transaction (e.g., via a function call).
Q6: What’s the role of BLS keys in validators?
A6: They enable efficient signature aggregation, lowering network overhead.
By understanding these concepts, you can securely manage your BTC20 Smart Chain accounts and leverage their full potential. For further details, refer to the official BTC20 Smart Chain documentation.