eTrustWallet: The Idea to End Divorce Forever

Joel Brown | Aug 27, 2020 min read

2020-2021. COVID lockdowns. Bitcoin at $60k. Stimulus checks hitting accounts. Everyone suddenly understood “decentralized finance.”

I was deep in it—ETH, ADA, BTC, and way too many shitcoins. NFTs were the future. Smart contracts were going to change everything. And I had the idea: an immutable trust wallet that would end corruption, prevent government embezzlement, and somehow solve divorces.

I was 22 and very confident.

The Concept

Build a smart contract where:

  1. Owner deposits Ether
  2. Owner sets ONE “special friend” who gets equal withdrawal rights
  3. Once set, the special friend cannot be changed—immutability as a feature, not a bug
  4. Transparency solves trust issues forever

Then I’d turn it into a dApp for “betting and lotteries” because why not.

The Code

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;

contract eTrustWallet { 
    address payable public owner;
    address payable public special_friend;
    enum State {Null, Set}
    State public state;
    
    constructor(){
        owner = payable(msg.sender);
    }
    
    error InvalidState();
    
    modifier inState(State state_) {
        if(state != state_){
            revert InvalidState();
        }
        _;
    }
    
    receive() external payable {}
    
    function withdraw(uint _amount) external{
        require(msg.sender == owner, "Only the owner can call this method");
        payable(msg.sender).transfer(_amount);
    }
    
    function getBalance() external view returns (uint) {
        return address(this).balance;
    }
    
    function setFriend(address payable _friend) inState(State.Null) external {
        require(msg.sender == owner, "Only the owner can call this method");
        state = State.Set;
        special_friend = _friend;
    }
    
    function friend_withdraw(uint _amount) external {
        require(msg.sender == special_friend, "only special friend can call this method");
        payable(msg.sender).transfer(_amount);
    }
}
//eventually this will be made into a decentralized app (dAPP) for betting and lotteries.
```## The Code Breakdown

### Setting Up The Foundation
```solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;

contract eTrustWallet { 
    address payable public owner;
    address payable public special_friend;
    enum State {Null, Set}
    State public state;
    
    constructor(){
        owner = payable(msg.sender);
    }
}

How it works: The person who deploys the contract becomes the owner. The special_friend starts unset, tracked by a State enum (Null or Set). This enum is the key to making the special friend immutable—once set to Set, it can never go back to Null.

I thought this was genius. “Code as law” and all that. What could go wrong?


Accepting Deposits (The Easy Part)

receive() external payable {}

function getBalance() external view returns (uint) {
    return address(this).balance;
}

How it works: The receive() function is a special function in Solidity that allows the contract to accept Ether without any restrictions. Anyone can send money in—no questions asked.

The getBalance() function lets anyone check how much Ether is sitting in the contract. Transparency by default. This was supposed to prevent corruption because “everyone can see the money!”

Turns out transparency without accountability is just… visibility.


Owner Withdrawals & The Special Friend Lock

function withdraw(uint _amount) external{
    require(msg.sender == owner, "Only the owner can call this method");
    payable(msg.sender).transfer(_amount);
}

error InvalidState();

modifier inState(State state_) {
    if(state != state_){
        revert InvalidState();
    }
    _;
}

function setFriend(address payable _friend) inState(State.Null) external {
    require(msg.sender == owner, "Only the owner can call this method");
    state = State.Set;
    special_friend = _friend;
}

How it works: The owner can withdraw whenever they want with the withdraw() function. Simple access control.

But here’s the magic (or tragedy): setFriend() uses the inState(State.Null) modifier, which means it can only be called when the state is Null. Once you call it, the state changes to Set, and that’s it—forever.

Set your spouse’s address? Locked in. Typo in the address? Tough luck. Relationship ends badly? The blockchain doesn’t care about your feelings.

I genuinely believed this immutability would create trust. Instead, I built a relationship commitment device that would make prenups look flexible.


The Special Friend Gets Equal Power

function friend_withdraw(uint _amount) external {
    require(msg.sender == special_friend, "only special friend can call this method");
    payable(msg.sender).transfer(_amount);
}

//eventually this will be made into a decentralized app (dAPP) for betting and lotteries.

How it works: Once set, the special friend has the same withdrawal rights as the owner. No permissions needed, no approval required. True shared control.

The comment at the end is my favorite part. “Eventually this will be made into a dAPP for betting and lotteries.”

Yeah. That didn’t happen.


What I Learned

Immutability isn’t always a feature. Set the wrong address? Too bad. Relationship ends? Still locked in. Special friend loses their keys? Hope you didn’t need that money.

Smart contracts don’t solve social problems. Government corruption isn’t a code problem, it’s a power problem. And good luck explaining to a divorce lawyer why your assets are locked in an immutable Ethereum contract.

Gas fees are real. In 2021, withdrawing $100 might cost you $50 in gas.

The Comment

//eventually this will be made into a decentralized app (dAPP) for betting and lotteries.

Yeah. That didn’t happen.

Looking Back

Bitcoin’s somewhere between $40k-$100k now depending on when you’re reading this. Most shitcoins are dead. NFT games and art companies are still in court.

But I learned more from this naive project than from a dozen tutorials. And honestly? It was a fun time. Everyone was building, everyone was optimistic, and for a brief moment, it felt like code could solve everything.

Now, we have AI.

But I’ll always have a soft spot for eTrustWallet—the smart contract that was going to end corruption, one impossibly large gas fee at a time.

-|