Welcome to our very first edition of “The Blockchain with OnChain”, a series of articles aimed at tackling the basics and ‘not so’ basics of Web3.
With our latest series, we hope we can break down the technicals and buzzwords so that you don’t have to.
A brief history of…… The Title (And Eminem)
Well, to cut a long story short, OnChainDetective is StarkDeFi’s ‘Lead Developer’ or OCD as we like to call him. So it’s only fitting that we honoured him with the title series, we just haven’t told him yet.
So what's ‘Eminem’ have to do with this?? Not a lot really, but he did once release a track called ‘Business’ and it went something along the lines of “Let's get down to business”, so shall we?
Accounts on Starknet
The crypto space is stacked with many buzzwords, a handful of which encompass the concept of an account on the blockchain. At the core is a wallet whose understanding is critical for trading and management of crypto assets. Like digital wallets such as Google and Apple Pay, crypto wallets allow you to perform transactions via your account on the blockchain. The difference, however, lies in the mechanics of how these transactions are handled and the elements peculiar to the process. Public and private keys are primary examples of such elements, and along with others, will be explored briefly in the order below:
- Cryptographic Keys
- Private Key
- Public Key
- Seed Phrases
- Types of Accounts
The field of cryptography deals with the encryption and decryption of information, and it is the engine around which blockchain is built. Every crypto wallet has a unique pair of private and public keys, which are generated quite differently. Whereas the private key is a randomly generated number, the public key is generated directly from the private key using an elliptic curve multiplication. In turn, the public key is used to generate an address through a hash function. The relationship between the keys is strictly in the forward direction. From the private key, the public key is derived, and then the address from the public key. Making these derivations in the reverse direction is impossible, which ensures stronger security. The private key is used to sign your crypto transactions, the public key verifies these transactions as valid, and the public needs to know your address to send you funds.
A private key consolidates ownership of your account. You might have already guessed that this key must always be kept hidden! Without it, no transactions can be authorised. You will always need the corresponding private key for your account to complete fund transfers. As stated before, it is cryptographically generated and hence extremely difficult to mimic via dubious means.
Unfortunately, once your private key is compromised, nothing can be done about it. Whoever has access to your private key technically owns your account and can make unrestrained transactions. What’s worse is the absence of the forgot key feature in blockchain, which renders a lost or compromised private key irredeemable.
A public key is mathematically generated from your private key. When transactions from your account are digitally signed with the private key and presented on the blockchain, anyone on the network can verify and accept the transaction as valid with the help of your public key. This validation process confirms you as the rightful owner of the funds.
An address is a string of text uniquely identifying your blockchain account. It is algorithmically generated from your public key. Sharing an address is safe; through it, one can receive funds, just like you would receive mail via your email address. On the Ethereum network, an address begins with ‘0x’ followed by 40 alphanumeric characters. An example looks like this 0x95B7656EB7ca66c098mnoB751F7345B5f6d4576G
As we will explain later, a wallet can be used to manage multiple blockchain accounts. The accounts managed by a wallet are collectively protected by a seed phrase. This is in contrast to a private key, which is generated for each individual account. In brief, a seed phrase is a “private key” for a group of blockchain accounts.
This seed phrase is issued when you create a new crypto wallet. Any blockchain account generated within this wallet will be associated with the seed phrase. If you wanted to switch to a new wallet, you could import your accounts individually using their private keys, or much better and more convenient is to use the seed phrase to import them collectively. Like private keys, seed phrases must be kept hidden. A seed consists of 12, 15, 18, 21, or 24 words. An example would look like this: apple pint towel prowl old weak tik send rubber erratic bone present.
By now, you should have already connected the dots on how wallets come into play. Wallets are comparable to your bank mobile applications (not the bank account itself), providing an interface that allows you to manage your crypto accounts. They contain all the information needed to access your funds on the blockchain and complete transactions. Additionally, they allow you to interact with decentralised applications. Wallets can exist as mobile apps or as browser extensions. To secure access to your wallet, you will need to create a password with which you can use to log in securely. Again, the wallet is not your account! It is just an interface that allows you to interact with tokens on the blockchain.
Wallets on Starknet
The two main wallets that allow you to interact on the Starknet Ecosystem are:
- Argent X (available only as a browser extension)
- Braavos (available on ios, android and as a browser extension)
Types of Accounts
An account is a user’s presence on the blockchain. It must be associated with an address to link ownership of assets. An account can be user-controlled (Externally Owned Accounts ) or controlled with code (Contract Account via Account Abstraction).
Externally Owned Account
The elements of an Externally Owned Account are what has been discussed so far regarding private and public keys, seed phrases and addresses. Transactions are the only way to change the state of the blockchain and, thus, the state of an account. This modification can only be triggered from something external to the blockchain, and because of that, every transaction must be initiated from an Externally Owned Account. That is why there is a need for an additional layer of association with keys (public and private) to help account holders authorize and own their transactions. This public-private key pair ensures that individuals making the transactions are none other than the account owners themselves. Interactions with the blockchain occur via a wallet, which implies that Externally Owned Accounts have no associated code or data storage on the blockchain. They exist “external” to the blockchain.
Contract Account (Account Abstraction)
If an account should no more be external to the blockchain, then where is going to be? That’s right! On the blockchain network deployed as a smart contract! When this happens, we say the account has been abstracted. This approach essentially decouples the rigid handshake between a user’s tokens and the signer required to move them, making the authorization of a transaction programmable. It means no more keys and seed phrases but custom authorization logic adjusted to the user’s needs. However, contract accounts incur storage costs for using network storage.
Account Abstraction and the Crypto World
Account abstraction presents a new paradigm of endless possibilities in the crypto world with respect to user experience and security. Let’s explore them below.
1. User Experience
With account abstraction, accounts can be programmed with custom code to authorize transactions and provide user experiences that native Externally Owned Accounts cannot. Customizations could include a mechanism for social recovery in cases where a user’s private key is compromised or lost. Additionally, this may be tailored to eliminate the need for seed phrases and even private keys because it is extremely difficult to keep them safe. For new users, this would mean easy onboarding and fewer complications in interacting with the blockchain and decentralised applications.
The smart contract code itself becomes the security and provides more flexibility. For example, users can use a new signature scheme for their transactions, include processes to monitor fraud, or implement an advanced 2-factor authorization for their crypto transactions. An interesting implementation would be setting transfer limits on accounts to avoid easily emptying them when they are compromised. The possibilities are truly endless, and the concept of account abstraction provides the springboard to launch into an avalanche of wild ideas to improve the crypto space.
Improving UX, security, and accessibility through account abstractions opens the floodgates for mass adoption and appreciable leeway to interact with the blockchain.
At StarkDeFi, we are committed to offering comprehensive DeFi solutions that encourage mass adoptions and improve trust. Check out the genesis of our journey here