Blockbeat News

Accounts, wallets and smart contracts: the parts of a blockchain app

Blockchain learning series 5 of 12

By Chris DW, Editor

Published

Distinguish an address, a signing tool and a programme with persistent state.

Gold and blue diagram of a signer connected to a contract above three panels: Account, Wallet, Contract. Full text follows.
Gold and blue mark the Blockchain learning series. Account: An address identifies an account on a particular network. Wallet: Helps authorise actions; it does not contain the blockchain. Contract: Code and state follow deployed rules when called.
Open the full-size infographic
Read the infographic as text

Accounts, wallets and smart contracts: the parts of a blockchain app

Distinguish an address, a signing tool and a programme with persistent state.

Account
An address identifies an account on a particular network.
Wallet
Helps authorise actions; it does not contain the blockchain.
Contract
Code and state follow deployed rules when called.

Learning goal: Distinguish an address, a signing tool and a programme with persistent state.

Blockchain learning series 5 of 12. Educational diagrams; not a production architecture.

An address tells you where to look. A wallet helps authorise an action. A smart contract defines rules that run when it is called. Keeping those three ideas separate makes an application's permissions much easier to understand.

This guide assumes you can follow a transaction into a block. We will use Ethereum-style accounts for the practical project, while recognising that other networks organise accounts and programmes differently.

An account belongs to a network context

An address is an identifier, not a person's verified identity. The same-looking address can appear on multiple Ethereum-compatible networks, with different balances, code and history. Record the network alongside an address whenever you save a deployment or send an instruction.

Ethereum distinguishes externally controlled accounts and contract accounts, although modern account features make simplistic wallet categories less reliable. For this course, the practice signer will authorise calls from an ordinary test account. The deployed register will have its own contract address. Ethereum's account documentation explains the account model and current distinctions.

When Alice registers a fingerprint, the contract observes the caller as an address. It does not learn that the caller is Alice, that she works for a university or that she has permission to issue a certificate. Those claims require another mechanism.

Bitcoin uses a different model. A wallet's displayed balance is assembled from unspent transaction outputs, usually shortened to UTXOs. A transaction spends selected outputs and creates new ones with their own spending conditions. It does not update an EVM contract's account storage. Bitcoin's transaction guide explains this model; the development comparison later in the series follows a worked example.

A wallet is an interface to authorisation

Wallet software may display balances, prepare calls and help sign them. The assets and records exist in the network's state, not as files inside the wallet application. Replacing an interface does not by itself move the underlying records.

Authorisation can depend on a private key, several signers, contract rules or other supported arrangements. A recovery phrase is one possible way to back up key material; it is not the definition of ownership or the only account design. Read the wallet and custody guide for those distinctions.

Connecting a website to a wallet is also different from signing a transaction. Connection generally exposes an account to the site under the wallet's permissions. A later signature can authorise a specific action. Readers should examine the requested action rather than assume that a familiar connection prompt makes everything that follows safe.

Keep the application parts separate

Keep the application parts separate
PartWhat it representsRegister example
AddressAn identifier in a network contextThe submitter or deployed contract
Wallet or signerAn authorisation arrangementA disposable local practice account
Contract statePersistent values under deployed rulesBlock number for an address and fingerprint

A contract has code and persistent state

A smart contract is a programme deployed to the network. Its functions define permitted operations, while its state retains the resulting values. It runs when called; the phrase smart contract does not mean an independent agent that wakes up and checks the outside world.

Our register will expose a function that accepts a document fingerprint. It stores the block number under a pair of inputs: caller address and fingerprint. Registering the same fingerprint from another address creates a separate entry. That is deliberate: the register is not trying to award exclusive ownership.

A read function retrieves a stored result. A state-changing call needs a transaction in the public-network version and consumes execution resources. A read performed locally through a node does not submit a state change, although the service supplying the read can charge for access. Solidity's introductory contract example illustrates state and function calls.

Public does not mean trustworthy

Being able to inspect code helps, but readers still need the right deployment, compatible interface and a clear understanding of any upgrade powers. A published source file is not proof that a particular address executes that source. Verification and operational records become important as a project develops.

Similarly, a successful call proves only that execution met the deployed rules. If the rules accept a document fingerprint from any address, success does not certify a recognised issuer. The interface must describe the entry accordingly. Calling it verified ownership would mislead the user.

Predict what the register should return

Alice records fingerprint X. Bob records the same X. Alice then records a changed document with fingerprint Y. How many independent entries should our design contain?

Three: Alice/X, Bob/X and Alice/Y. A later duplicate Alice/X should fail, preserving its first recorded block number. You have understood the account and contract boundary when you can predict those results without relying on a screen's labels.

In the next guide we will decide which parts of this application belong in ordinary software. Most of the page a user sees will still be conventional web development.

Sources

Source note: We have made reasonable efforts to provide sources for material claims. Some third-party sources could not be accessed at publication.

Latest original articles