How to create a simple “Wallet” smart contract using Solidity ?

Paulina Lewandowska

19 Oct 2022
How to create a simple “Wallet” smart contract using Solidity ?

In the previous tutorial you learned how to create your first smart contract, in this post you will learn how to create a "Wallet" smart contract to which you will be able to send and withdraw Ethereum, of course the contract will be written so that only the owner of the contract will be able to withdraw funds.

What are the keywords: public, external, internal and private ?

You have already learned the keyword public in the previous tutorial "Hello World", it means that the function is public, that is, it can be called both "outside the contract" and inside. Contracts that inherit our contract will have access to such a function.

For example:

uint counter = 0;
    function externalFunction() external  {
        counter++;
        publicFunction();
    }
 
    function publicFunction() public  {
        counter++;
    }

As you can see, the public function can not only be called "outside the smart contract", but also inside it, as in the externalFunction, and just what does this external mean ?

If the function is external, it simply means that it can only be called "outside the smart contract" , just as we called our sayHelloWorld function in the previous tutorial. Contracts that will inherit our contract will have access to the external function.

Two keywords remain : internal and private.

function returnTwoPlusTwo() internal pure returns (uint256)  {
        return 2 + 2;
    }
 
    function returnMsgSender() private view returns (address)  {
        return msg.sender;
    }

Internal is exactly the opposite of external, such a function will not be called "outside the smart contract", but only inside. As with external and public, contracts that inherit such a function will have access to it.

The last is private which means that the function will be visible only in the contract in which it was defined, contracts that inherit our contract will not be able to call it.

Pure vs View

When I showed the functions internal and private, you can see that the words pure and view are added next to these functions. What do they mean ?

When the function is pure, it means that it does not modify or read any data from the blockchain, just like the returnTwoPlusTwo function - it only returns the result of 2+2, it does not load or modify any variable in the smartcontract or blockchain.

Functions with the suffix view, means that the function does not modify data from the blockchain, but instead reads it. For example, the returnMsgSender function reads the value of the msg.sender variable, which represents the address that called the function.

Okay, enough with the theory, let's finally get to work !

How to create "Wallet" smart contract?

First we must, as always, define the version of solidity that we want to use , I will use version 0.8.12, so at the top of the file I type:

pragma solidity 0.8.12;

I am creating a contract called Wallet :

contract Wallet {
   
}

Each wallet has its own owner so will define address on ethreum, who will be the owner of the smart contract. The owner of the smart contract will be the person who will deploy our smart contract.  And we should have a variable thanks to which we can monitor the balance of the smart contract.

contract Wallet {
    address public owner;
    uint public balance;
    constructor() {
        owner = msg.sender;
    }

Let's create a function by which we can transfer funds to the smart contract.

function depositEther() external payable{
        balance += msg.value;
    }

There are two new words in this function : payable and msg.value.

If the function is payable it means that with the function call we can send ethereum to the smart contract, and msg.value is simply the amount of wei sent with the function call.

Now let's create a function by which we can withdraw the sent ethereum, of course, only the owner of the smart contract should be able to do so.

function withdrawEther(uint amount) external{
        require(msg.sender == owner, "Only owner can call this function");
        require(amount <= balance, "Amount exceeds balance");
        balance -= amount;
        payable(owner).transfer(amount);
    }

Require makes the function return an error with the message we specified when the condition given in it fails.

In the function, we had to convert the owner variable from address to address payable, because ethereum can only be sent to addresses with the keyword payable.

Summary

And that's it ! Smart contract is ready ! Go ahead and try to play with it, and if you succeed, even improve it. 

In the next tutorial in the Nextrope Academy series, we will show how to write a simple auction smart contract.

Most viewed


Never miss a story

Stay updated about Nextrope news as it happens.

You are subscribed

Blockchain for Creators: Secure and Sustainable Infrastructure

Miłosz Mach

07 Nov 2025
Blockchain for Creators: Secure and Sustainable Infrastructure

In today’s digital creative space, where the lines between art and technology are constantly blurring, projects like MARMALADE mark the beginning of a new era - one where creators can protect their work and maintain ownership through blockchain technology.

For Nextrope, being part of MARMALADE goes far beyond implementing features like screenshot blocking or digital watermarking. It’s about building trust infrastructure - systems that empower creators to thrive in the digital world safely and sustainably.

A new kind of blockchain challenge

Cultural and educational projects come with a completely different set of challenges than typical DeFi systems. Here, the focus isn’t on returns or complex smart contracts - it’s on people: artists, illustrators, educators.

That’s why our biggest task was to design secure yet intuitive infrastructure - lightweight, energy-efficient, and accessible for non-technical users exploring Web3 for the first time.

“Our mission wasn’t to build another financial protocol. It was to create a layer of trust for digital creators.”
— Nextrope Team

Security that stays invisible

The best security is the kind you don’t notice.
Within MARMALADE, we focused on making creators' protection seamless:

  • Screenshot blocking safeguards artworks viewed in browsers.
  • Dynamic watermarking helps identify unauthorized copies.
  • Blockchain registry ensures every proof of ownership remains transparent and immutable

“Creators shouldn’t have to think about encryption or private keys - our job is to make security invisible.”

Sustainability by design

MARMALADE also answers a bigger question - how to innovate responsibly.
Nextrope’s infrastructure relies on low-emission blockchain networks and modular architecture that can easily be adapted for other creative or cultural initiatives.

This means the technology built here can support not only artists but also institutions, universities, and educators seeking to integrate blockchain in meaningful ways.

Beyond technology

For Nextrope, MARMALADE is more than a project — it’s proof that blockchain can empower culture and creators, not just finance. By building tools for digital artists, we’re helping them protect their creativity and discover how technology can amplify human expression.

Plasma blockchain. Architecture, Key Features & Why It Matters

Miłosz Mach

21 Oct 2025
Plasma blockchain. Architecture, Key Features & Why It Matters

What is Plasma?

Plasma is a Layer-1 blockchain built specifically for stablecoin infrastructure combining Bitcoin-level security with EVM compatibility and ultra-low fees for stablecoin transfers.

Why Plasma Blockchain Was Created?

Existing blockchains (Ethereum, L2s, etc.) weren’t originally designed around stablecoin payments at scale. As stablecoins grow, issues like congestion, gas cost, latency, and interoperability become constraints. Plasma addresses these by being purpose-built for stablecoin transfers, offering features not found elsewhere.

  • Zero-fee transfers (especially for USDT)
  • Custom gas tokens (separate from XPL, to reduce friction)
  • Trust-minimized Bitcoin bridge (to allow BTC collateral use)
  • Full EVM compatibility smart contracts can work with minimal modifications

Plasma’s Architecture & Core Mechanisms

EVM Compatibility + Smart Contracts

Developers familiar with Ethereum tooling (Solidity, Hardhat, etc.) can deploy contracts on Plasma with limited changes making it easy to port existing dApps or DeFi, similar to other EVM-compatible infrastructures discussed in the article „The Ultimate Web3 Backend Guide: Supercharge dApps with APIs".

Gas Model & Token Mechanism

Instead of forcing users always to hold XPL for gas, Plasma supports custom gas tokens. For stablecoin-native flows (e.g. USDT transfers), there is often zero fee usage, lowering UX friction.

Bitcoin Bridge & Collateral

Plasma supports a Bitcoin bridge that lets BTC become collateral inside smart contracts (like pBTC). This bridges the security of Bitcoin with DeFi use cases within Plasma.
This makes Plasma a “Bitcoin-secured blockchain for stablecoins".

Security & Finality

Plasma emphasizes finality and security, tuned to payment workloads. Its consensus and architecture aim for strong protection against reorgs and double spends while maintaining high throughput.
The network launched mainnet beta holding over $2B in stablecoin liquidity shortly after opening.

Plasma Blockchain vs Alternatives: What Makes It Stand Out?

FeaturePlasma (XPL)Other L1 / L2
Stablecoin native designusually second-class
Zero fees for stablecoin transfersrare, or subsidized
BTC bridge (collateral)only some chains
EVM compatibilityyes in many, but with trade-offs
High liquidity early✅ (>$2B TVL)many chains struggle to bootstrap

These distinctions make Plasma especially compelling for institutions, stablecoin issuers, and DeFi innovators looking for scalable, low-cost, secure payments infrastructure.

Use Cases: What You Can Build with Plasma Blockchain

  • Stablecoin native vaults / money markets
  • Payment rails & cross-border settlement
  • Treasury and cash management flows
  • Bridged BTC-backed stablecoin services
  • DeFi primitives (DEX, staking, yield aggregation) optimized for stablecoins

If you’re building any product reliant on stablecoin transfers or needing strong collateral backing from BTC, Plasma offers a compelling infrastructure foundation.

Get Started with Plasma Blockchain: Key Steps & Considerations

  1. Smart contract migration: assess if existing contracts can port with minimal changes.
  2. Gas token planning: decide whether to use USDT, separate gas tokens, or hybrid models.
  3. Security & audit: focus on bridge logic, reentrancy, oracle risks.
  4. Liquidity onboarding & market making: bootstrap stablecoin liquidity, incentives.
  5. Regulation & compliance: stablecoin issuance may attract legal scrutiny.
  6. Deploy MVP & scale: iterate fast, measure gas, slippage, UX, security.