0

This is the interface that is required for a token to be an ERC20 token

contract ERC20Interface {
    function totalSupply() public constant returns (uint);
    function balanceOf(address tokenOwner) public constant returns (uint balance);
    function allowance(address tokenOwner, address spender) public constant returns (uint remaining);
    function transfer(address to, uint tokens) public returns (bool success);
    function approve(address spender, uint tokens) public returns (bool success);
    function transferFrom(address from, address to, uint tokens) public returns (bool success);

    event Transfer(address indexed from, address indexed to, uint tokens);
    event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
}

I want to keep private the address of who owns my token. So I deleted the Transfer event and the Approval event. I also made the balanceOf function private.

Is there still some way for a public person to find out who owns one of my tokens? Also is there some way for a public person to know when a trade has taken place?

Test1 Test2
  • 327
  • 2
  • 9

2 Answers2

1

Is it private?

No

Is there still some way for a public person to find out who owns one of my tokens? Also is there some way for a public person to know when a trade has taken place?

The storage of the contract can be inspected, and the transaction data can be inspected. This data is necessarily public. The best you can do is make it harder for your median user to find this information (although the people who know what they're doing could dig it out and then publish it).

Is it an ERC20 token?

No

This is the interface that is required for a token to be an ERC20 token... I deleted the Transfer event and the Approval event. I also made the balanceOf function private.

Note that deleting those things makes it not an ERC20 token anymore. Those are required in the ERC20 spec.

What now?

Transactions that are private on a public blockchain is an ongoing area of research. If you really want to implement this, it will take diving into the current research in the space, getting familiar with things like ZK-SNARKS and alternatives.

carver
  • 2,229
  • 12
  • 28
0

Yes, one of the major features of Bitcoin and Ethereum are that they are public. When anyone uses your smart contract, all their actions are recorded, necessarily and by design, in the blockchain.

See this tx which called a smart contract method. Notice how I can see who sent what to whom, what function was called, and with what parameters.

Tyler Zeller
  • 254
  • 2
  • 8