starlinglab / signal-x-proofmode

Proof-of-concept implementation of ProofMode notarization layer in Signal Messenger
GNU General Public License v3.0
1 stars 2 forks source link

Register hash and signature on MobileCoin #22

Closed basilesimon closed 1 year ago

basilesimon commented 1 year ago

This task aims to permit the registration of some integrity proofs on a third-party ledger, namely MobileCoin – a cryptocurrenty and transaction system already built into Signal.

The MobileCoin team indicated that they thought we could leverage the Memo field of the transaction (max 64 bytes) to, for example, declare the hash of the image.

n8fr8 commented 1 year ago

In short, the key areas of work is to build on the existing logic and UX in the “org.thoughtcrime.securesms.payment” package.

In particular, CreatePaymentFragment and ConfirmPaymentFragment. These layout how a transaction is created using a CreatePaymentViewModel and confirmed using a ConfirmPaymentViewModel. Once the user has their MobileCoin wallet setup with funds, we can piggy back on the existing UX to send the truncated proof hash as a note with a small MobileCoin transaction (say .01MOB or $0.02).

The MOB Notarization UX flow would trigger after you capture proof and choose to send it to someone. This would be a second “confirm notarization?” step since it involves money. The proof recipient would then receive both the proof zip, and the .01MOB with the memo.

As a stretch goal, we could integrate looking up transactions in the wallet to match against proof zip hashes.

We could also explore having the MOB notarization not sent to the proof recipient, but to a Signal bot that then creates a public log of the MOB transaction and the truncated proof hashes from the note on Github or some other public “append only” log. This is how we can get around the issue of MOB transactions being private and encrypted.

n8fr8 commented 1 year ago

Late night progress: Automated .1MOB transaction sent with each proof, with the memo field containing the first 16 digits of the proofhash for easy visual comparison with the proof zip name

signal-2023-02-15-014020_002 signal-2023-02-15-014020_004 signal-2023-02-15-014020_003

plans from here, but in short 1) on proof display, lookup wallet transactions and try to find a match 2) investigate runing mob notarization earlier in process so that the output can be included in proof zip bundle (maybe allow sending to a fixed notary recipient or send money to yourself?)

e can also send a pico mob amount like .00001 MOB that is something like $0.000015USD as the amount so that there is no real economic impact

n8fr8 commented 1 year ago

Also should test to see if our txid can be found here: https://mobilecoin.com/ecosystem/block-explorer/

"Anytime you buy, sell, send, or receive MobileCoin, you can utilize the block explorer to check on the status of your transactions. Once you initiate a transaction, you should receive an automatically-generated transaction hash and can use the hash to look up details of the payment and whether it was successful."

n8fr8 commented 1 year ago

I was able to match a transaction in my wallet with a public block: https://block-explorer.mobilecoin.foundation/block/1281456 “Payment ID: 6021572c-009d-4dd3-87ce-0c44bb2676f6 2023-02-15 09:44:37.947 28651-28698 ConfirmPaymentViewModel org.thoughtcrime.securesms W tx pub key: 04��O�ֿC|WjƎq�I��Kh~���K 2023-02-15 09:44:37.948 28651-28698 ConfirmPaymentViewModel org.thoughtcrime.securesms W received in block: 1280527 at 15 Feb 2023 06:38:00 GMT 2023-02-15 09:44:37.948 28651-28698 ConfirmPaymentViewModel org.thoughtcrime.securesms W spent in block: 1281456 at 15 Feb 2023 14:14:34 GMT”

TXO Pubkey 0402c8a74ec720e3c145926ca79287ea7e85152a4a0ba05e18b0b37bbd16371e should match tx pub key: 04��O�ֿC|WjƎq�I��Kh~���K if I had encoded the log output right. so we can send a notary transaction, store the signed record of it in the proof zip, and then the recipient of that proofzip (or our proofcheck tool) can look up the block in the mobilecoin blockchain ledger, to find the matching TXO PubKey. We don’t have the hash still in the public ledger, but this is something like a kidnapped person holding up a newspaper to prove they are alive i suppose :)

n8fr8 commented 1 year ago

Newer MobileCoin explorere: https://block-explorer-jccxbsaubq-uc.a.run.app/blocks/1281884

n8fr8 commented 1 year ago
n8fr8 commented 1 year ago

Screenshot_20230221_102934_Signal Screenshot_20230221_102943_Signal

n8fr8 commented 1 year ago

You can find the notarization in the public explorer:

Public service: https://block-explorer.mobilecoin.foundation/

New service under development: https://block-explorer-jccxbsaubq-uc.a.run.app/

This also has an API that we could integrate into the ProofCheck service for automatic tx matching:

Block Explorer is querying data from our public Full-Service node which is what you will want to use here The endpoint is at: https://readonly-fs-mainnet.mobilecoin.com/wallet/v2 To get a block, see these docs: https://mobilecoin.gitbook.io/full-service-api/v/develop/api-endpoints/v2/block/get_block Other APIs you might find useful at that endpoint (unfortunately most aren’t doc’ed yet): get_blocks get_recent_blocks search_ledger get_network_status

n8fr8 commented 1 year ago

Build 20 nightly now available: https://ship.bitrise.io/apps/67c67ce8167b9828

n8fr8 commented 1 year ago

Latest builds (build 21) allows you to tap on the notarization TX in the proofmode view, to copy and paste. You can then use this to lookup the transaction into the public MobileCoin explorer.