With pEOS we set out to provide the world with the tools to protect its economic privacy, utilizing modern, efficient and fast untraceable token transfer transactions, running on a state of the art blockchain platform.
This endeavor is much larger that just delivering pEOS. We consider part of our mission to help educate, provide support, provide tools, and accelerate any aspect of the EOS blockchain in the direction of providing privacy enabled features and technologies. We strongly believe in the multiplicative effect this can have to every aspect of the EOS ecosystem.
(We are aware of the Everipedia attempt at implementing UTXOs, but unfortunately that implementation is more of a “pay to key” system, and doesn’t provide the characteristics required in order to implement on top of it any of the privacy algorithms that true UTXOs implementations allow. We’ll come back to that later in the article).
So what is a UTXO anyway?
UTXO stands for Unspent Transaction Output. It was first used in Bitcoin, and is one type of output -which can be either unspent (UTXO) or spent-. The total balance of a wallet is calculated by tracking and adding all UTXOs spendable by that wallet. Transactions work by spending a number of those UTXOs and generating new UTXOs for the receiver and for any change that goes back to the original owner. Amounts in UTXOs don’t mutate. You can’t spend only some part of a UTXO. You spend it as a whole.
These constraints on what a UTXO is and how it is immutable, is what allows for privacy algorithms to be build on top of them. For example, the privacy algorithm CoinJoin is possible with the code we release today as is!
The code we release today dates from the early beginnings of the pEOS project and its exploration period. Even though it’s relatively old it still is fully usable, and we hope it helps many projects implement proper UTXOs in their tokens or projects in general.
The contract extends the standard token protocol with two additional actions. The loadutxo action and the transferutxo action. With the loadutxo action the user can take funds from a regular EOS account in order to create a new UTXO, and with the transferutxo the user can create full transactions concerning UTXOs.
A transaction concerning UTXOs consists of a number of UTXOs used as inputs and a number of new outputs. Exactly like you have in bitcoin. For the most common type of transaction configurations (like sending to a new address, plus one change address, or sending to a regular EOS account) you can use the command line tool that is included in the github repository. This tool will also manage your keys and act as a wallet.
Try it on Jungle Testnet
The system is deployed on Jungle testnet and you can use it with the command line tool directly. The address of the contract on Jungle is
netpeostoken. Invoking the tool without any argument prints out the help screen:
You can get additional help by passing the command name followed by
To get you wallet you use the
balance command like this:
To get an analytical view of your UTXOs you use the
This way we can see that our wallet has a total of 98.0000 PEOS, that can be sourced from 2 UTXOs. One with 88.0000 PEOS and one with 10.0000 PEOS. Notice that the above balance is not visible on any EOS account anymore!
Now lets say you want to send an amount of 11.0000 PEOS to someone with the address
EOS8Dj5BLdUe1iAi6xNJnZ3bvNEMxDHX6bf4DGesA8USTwj4byJES . Simple:
This will result in spending both our UTXOs and creating 2 new UTXOs according to the tool’s UTXO selection strategy. One that will go to the recipient and one that will hold our change. Lets issue a new balance command to check our UTXOs:
As you can see a new address was created to hold our change, and the original UTXOs are now spent.
The transfer command can be used to transfer from and to EOS accounts also. If instead of EOS public keys you provide an EOS account for a from or a to address, the tool will issue the appropriate contract action to make the transfer.
If you need to receive PEOS you can use the
receive command like this:
You can now send this address to someone and he can pay you in PEOS.
This version of the tool uses the EOSIO native wallet to generate and protect keys and also to sign transactions. I suggest you create a new wallet with the
cleos tool and set that in the configuration of
The tool has many more features, that is not the intention of this article to describe. For example it can output transactions without transmitting, and relay transactions already composed.
How does this UTXO compares to Everipedia’s Pay2Key “UTXO”?
So how does the proposed implementation compares to Everipedia’s UTXOs? What is more appropriate for your requirements? Well lets look at some bullet points:
- With Everipedia’s solution you can’t combine multiple UTXOs to fund single or multiple new outputs in one compound transaction. Therefore you can’t do CoinJoin type anonymization.
- Everipedia UTXOs are not unique and are mutable. pEOS UTXOs adhere completely to the definition of UTXOs as used in Bitcoin, Monero, etc. Everipedia requires to keep track of a nonce for each account, as it need to order the mutations happening to UTXOs. If you need an Ethereum style accounting system, Everipedia is the way to go.
- Sequencing of transfers can be problematic.
- Everipedia’s UTXOs use an intermediary IQ_UTXO token instead of just IQ. pEOS works directly with any token without additional tokens needed.
As we see, the two implementations are both good for different things. Everipedia will provide you with easy accounting, simplicity in wallet implementation, and pseudonymity. But if you need to implement algorithms like CoinJoin, RingCT, MimbleWimble, etc the Everipedia code won’t be able to support it.
The proposed implementation on the other hand replicates the original Bitcoin type UTXO model, and therefore enables all the privacy algorithms implemented on top of it, enabling true anonymity.
Final words and next steps
With this source code release we hope to have provided great insight to developers working on EOS smart contracts. I can’t stress enough that this is not the pEOS tech promised in the whitepaper. This is 5% of it.Also this is not our wallet implementation -a special post is coming next just for that-. The command line wallet tool in this repository is just for testing the UTXO contract and it was never intended to be even close to user friendly.
In an upcoming development post we are going to focus more on optimization issues. For example how to optimize the verification of UTXOs and create a “SegWit” kind of transaction that will offload bandwidth and CPU from the EOS blockchain.
Disclaimer. EOSwriter does not endorse any content or product on this page. While we aim at providing you with all the important information we could obtain, readers should do their own research before taking any actions related to the company and carry full responsibility for their decisions, nor this article can be considered as an investment advice.