Validate Monero transactions on Ethereum smart-contracts
what
A project to enable verifying Monero transactions on Ethereum smart-contracts using a decentralized oracle network.
The outcome of this project will be a new function in ethereum smart contracts that has the following characteristics:
Example input*:
VerifyMoneroTx (txId, txKey, txReceiver)
Example output*:
{"status": "valid", "confirmations": 1, "amount": 10000000}
* The exact semantics of this will change based on the implementation details.
how
To achieve this goal, I will create a Chainlink adapter for Monero that will return the transaction data back on chain. As a chainlink node operator, I am able to deploy and test this adapter on actual infrastructure.
This project will be building on top of some existing projects to achieve this goal:
- localmonero transaction API https://localmonero.co/blocks/api
- llcoins tools by luigi1111 https://github.com/luigi1111/xmr.llcoins.net
- external adapter examples https://github.com/smartcontractkit/external-adapters-js
This work is in part inspired by the existing PayPal adapter, which allows creating smart contracts that can send and verify PayPal transactions on chain. If you would like to understand more about Chainlink and external adapters please refer to the links below:
- https://blog.chain.link/chainlink-2-0-lays-foundation-for-adoption-of-hybrid-smart-contracts/
- https://docs.chain.link/docs/external-adapters/
- https://github.com/smartcontractkit/external-adapters-js/tree/develop/packages/sources/paypal
why
Ethereum has established itself as the de-facto smart contract platform and uses Chainlink as the go-to oracle network. Combining these two technologies it is possible to build smart-contracts based on external triggers, such as incoming and outgoing Monero transactions. In addition, it is also possible to send Monero transactions from an ethereum smart contract using oracles, provided the oracle owns the monero wallet, but this is outside the scope of this proposal.
By fully utilizing a decentralized oracle network, we can create some nice tools and projects:
- A decentralized exchange where you can trade Monero for ERC-20 tokens using Metamask
- Smart contracts triggers based on a Monero tx. For example, send USDC to an address X when a Monero transaction is received at address Y.
Please note that this is not appropriate for all users because the user needs to provide several things on chain which allows a nosy actor to correlate ethereum wallets to Monero addresses, but I strongly believe the benefits outweigh the risks for the use-cases explained above. As a partial counter-measure, we could either enforce or recommend using only sub-addresses in the smart contracts.
As a chainlink node operator, I would be providing this service to my customers. Since it costs virtually nothing to run this adapter, I believe other oracle operators would also support it and help create a trustless decentralized oracle network to verify Monero transactions. I will not go into the details how this works, but the gist of it is that multiple node operators will be incentivised to provide accurate data using reputation and staking mechanisms.
There are several benefits to this proposal besides the possible use-cases outlined above:
- Increased awareness of Monero in the crypto community
- Higher support and interoperability with other platforms
- Another layer of resistance to censorship (CeX delistings)
milestones
Here are the outcomes of each milestone:
Milestone 1 - Create a Chainlink external adapter for monero
- a working external adapter that verifies a Monero transaction. Anyone will be able to run this as a docker container to send a HTTP request with the input parameters and receive the correct output.
Milestone 2 - Write tests, documentation and create an example smart contract
- the external adapter repository has complete documentation, unit, integration tests.
- an ethereum smart contract is hosted on github and deployed on the Rinkeby testnet. I will also provide a guide how to use this smart contract.
If this proposal receives support, I plan to start working on this project on August 1st and work on each milestone for 1 month. I believe each milestone will take me around 40 hours and I intend to work on my free-time so at the current price of Monero this will rate my work at $25/hr. The progress of the project can be tracked at https://github.com/neatnodes/external-adapters-js I will also create a new repository in the future to host smart contracts that utilize this functionality.
future work
- Using this iteration of the project the smart contract has to assume the oracle is correct. In the future, we could potentially expand the oracle result to include more data/proof of the transaction that could be verified on chain.
- We could also consider integrating monero-wallet-rpc support to allow verifying transactions on a local node. This is more costly to the oracle provider, but removes the dependency on localmonero API. This would also enable delivering more exotic use-cases such as sending monero transactions and building DEXes.
- Expand the oracle functions, for example verify transactions using a view key instead of a tx key.
who
My name is neat and I am an avid Monero enthusiast and a Chainlink node operator. I am also an experienced software developer and a security professional and recently I have been spending my time building out chainlink nodes. I believe my knowledge in the field puts me in a great position to understand the problem, complete this work and test it on real infrastructure. This is my first CCS proposal.
extras
Chainlink is blockchain agnostic, so all this functionality should be achievable on any chainlink supported chain, such as Matic, Arbitrum, Fantom, Avalanche, etc.
Expiration: October 1st, 2021