Common data and collections

Just reading about collections and have a ‘what to do in the meantime’ question…

I am coding marketplace functionality and thinking about the buyers shipping address and how to enable displaying the address to the seller with conditions;

a) buyers shipping address not stored centrally,
b) is stored in gaia encrypted,
c) can be displayed unencrypted to the seller.
d) and getFile / putFile with encrypt = true doesn’t work with username != logged in username.

One solution I think is to pass a bitcoin public key to put file…

putFile ( encrypt = bitcoinPubKey )

then getFile in the sellers session yields an object with a “cipherText”. Can this be decrypted by sending it via a secure rpc call to the bitcoin node?

Does this work or is there a less complex / more secure way?

You would use the public app key of the seller to encrypt the address, then use the private app key to decrypt it

In buyer.js

putFile(encrypt = <seller's public app key>)

In seller.js

getFile(decrypt = <seller's private app key>)

Now, you just have to transmit the seller’s app public key when the buyers visits their site.

1 Like

@friedger’s solution is what you want to do in this case. Collections isn’t really meant for this.

1 Like

Thanks @friedger - this is just what I was looking for.

Hi @friedger just a quick follow up after watching your very cool Monster Kingdom video.

OI chat is notifications when both users are online over rtc? Has anyone yet figured out an offline notification between two parties with no prior relationship?

In my use case the question is - how does the buyer notifies the seller of a purchase when;

  • the seller is offline
  • seller and buyer have no prior relationship - i.e. no email etc encrypted with the buyers pubkey.
  • and no data is stored centrally.

I have a workaround involving updating a field of the item in a ‘stateless’ lucene search index via an api call - the idea being the seller sees the change later on but wondering if anyone has any other solutions?

An update on above - an ethereum smart contract is a good solution for this problem as the contract can be read for free by the seller and the data is decentralised. So I should say I am trying to make this work purely on bitcoin! :nerd_face:

@mikecohen.id A smart contract is not suitable for this use case. A decentralized database would be more appropriate, there is no need to know anything about the order of state transitions, just the values are sufficient.

OI Chat can be the solution:

  1. buyer invites seller.id into a chat room “Orders from buyer.id” with a message about the order
  2. seller gets online, sees the invitation and reads the message

I am doing this for OI Calendar, to invite one or more people to events.

The data is stored on the buyers chat server, as this is matrix based this is decentralized in the same way as the gaia storage providers. Users can choose their own OI Chat/matrix server.

There is no need to exchange any other data than the blockstack id and the matrix home server (which should be / is a property of blockstack profile / DID document)

1 Like