Welcome to the Dash Forum!

Please sign up to discuss the most innovative cryptocurrency!

Open Bazaar Integration

Discussion in 'Dash Core Team' started by vertoe, Aug 15, 2014.

  1. vertoe

    vertoe Three of Nine

    Joined:
    Mar 28, 2014
    Messages:
    2,573
    Likes Received:
    1,652
    Trophy Points:
    1,283
    I've looked into this and its quite challenging on a conceptual stage. How does a notary sign transactions with darkcoin? I'm so tired I need some rest, but if anyone has an idea, please let me know.. The bitcoin integration is deeper than expected. It's by design not created for multiple currencies.
     
  2. Lord Of The Internet

    Joined:
    Jun 11, 2014
    Messages:
    138
    Likes Received:
    46
    Trophy Points:
    78
    we CANNOT let razor beat us at this.

    if it takes a bounty, then so be it.

    it's just my personal opinion, but almost everything should be put to a halt so we can focus on getting into the openbazaar before any other altcoins.
     
  3. Lord Of The Internet

    Joined:
    Jun 11, 2014
    Messages:
    138
    Likes Received:
    46
    Trophy Points:
    78
    if it turns out to be impossible without a major update, then openbazaar should be forked. One for bitcoin and one for altcoins.
     
  4. karisu

    karisu Member

    Joined:
    Jun 30, 2014
    Messages:
    70
    Likes Received:
    26
    Trophy Points:
    58
    I would be up for some coding too and since OpenBazaar seems to be a lot in python it is easier to dive in than into the darkcoin code. But it would be ashame if they have nested the currency so deep in their code. Didn't they say at one point that in theory every altcoin which support multisignatures should be possible to add?
     
    • Like Like x 1
  5. vertoe

    vertoe Three of Nine

    Joined:
    Mar 28, 2014
    Messages:
    2,573
    Likes Received:
    1,652
    Trophy Points:
    1,283
    It's not the code, its the logic behind it.

    If you sell and item, you have a seller and a buyer and a notary, 3 people who create a multisig transaction. They all sign it with their bitcoin keys to finally create it.

    Now imagine a logic that allows you to do that with darkcoin and not bitcoin. The seller can simply switch from BTC to DRK, that's easy. OK, the buyer sees the DRK, that's easy too, but how should the system detect if a notary is able to sign this off with DRK too? This is currently what we need to look at. If anyone could help me with that, I would be more than happy.

    Looking at the code should not be that hard, currently we need to consider how this should work on a conceptual stage.
     
    • Like Like x 1
  6. karisu

    karisu Member

    Joined:
    Jun 30, 2014
    Messages:
    70
    Likes Received:
    26
    Trophy Points:
    58
    I don't see it yet why it should be so complicated to integrate but if bitcoin is so deeply integrated it will be of course difficult to just add some message passing into the system. I will have a look into the "notary" entity and how that is plugged into the system in the first place. Besides I will check how multisig works.
     
  7. tungfa

    tungfa Administrator
    Dash Core Team Foundation Member Masternode Owner/Operator Moderator

    Joined:
    Apr 9, 2014
    Messages:
    8,961
    Likes Received:
    6,735
    Trophy Points:
    1,283
    how do we get a bounty going for this ???
    i tried to get a grip on OB but i believe it is all in the code for now as the testnet is not up yet.
    this would be great for DRK and i think we should throw some effort behind it !!

    so how do we get a bounty that somebody really can dive into that code and work on a fork ??
     
  8. thelonecrouton

    thelonecrouton Well-known Member
    Foundation Member

    Joined:
    Apr 15, 2014
    Messages:
    1,135
    Likes Received:
    813
    Trophy Points:
    283
    Maybe wishful thinking, but maybe the notary thing is a non-issue. Notaries will presumably advertise their services, and make use of the built in trust/reputation system. If OB becomes a popular platform then there will be plenty of notaries who can sign off on a contract involving DRK - it's exactly the same as with BTC, you just need a DRK wallet - and none of that (as I understand it) is handled by the OB code, OB just brings the three parties together?
     
  9. tungfa

    tungfa Administrator
    Dash Core Team Foundation Member Masternode Owner/Operator Moderator

    Joined:
    Apr 9, 2014
    Messages:
    8,961
    Likes Received:
    6,735
    Trophy Points:
    1,283
    and the 3 exchange wallet addresses correct ? BTC or DRK !?
     
  10. thelonecrouton

    thelonecrouton Well-known Member
    Foundation Member

    Joined:
    Apr 15, 2014
    Messages:
    1,135
    Likes Received:
    813
    Trophy Points:
    283
    I think the buyer sends funds to the notary wallet, which are then released to the seller when the buyer tells the notary 'goods recieved OK' and signs his end. Notary then signs too and transaction proceeds, seller gets paid.

    So as long as all three know they're creating a multisig DRK transaction, no problems?

    I've never messed with multisigs, maybe I should give it a go and see how they actually work using testnet.

    edit: Will def need some experimentation ... :eek:

    http://bitcoin.stackexchange.com/qu...ulti-signature-2-of-3-transaction/10593#10593
    https://github.com/spesmilo/sx#multisignature-n-m-transactions
     
    #40 thelonecrouton, Aug 26, 2014
    Last edited by a moderator: Aug 26, 2014
  11. vertoe

    vertoe Three of Nine

    Joined:
    Mar 28, 2014
    Messages:
    2,573
    Likes Received:
    1,652
    Trophy Points:
    1,283
    I think that's the problem, how do the 3 know each other is able to do this with DRK?
     
  12. tungfa

    tungfa Administrator
    Dash Core Team Foundation Member Masternode Owner/Operator Moderator

    Joined:
    Apr 9, 2014
    Messages:
    8,961
    Likes Received:
    6,735
    Trophy Points:
    1,283
    QUOTE="vertoe, post: 18072, member: 195"]I think that's the problem, how do the 3 know each other is able to do this with DRK?[/QUOTE]

    why
    don't they agree on it before !
    DARK or BTC ... as long as they all have the right wallets no problem ?
    no? doesn't it depend more on buyer and seller what currency they wanna use (notary is just in the middle but sure wants part of any deal so he will be flexible with any currency)
     
  13. vertoe

    vertoe Three of Nine

    Joined:
    Mar 28, 2014
    Messages:
    2,573
    Likes Received:
    1,652
    Trophy Points:
    1,283
    The notary is picked quite randomly as I understand.
     
  14. thelonecrouton

    thelonecrouton Well-known Member
    Foundation Member

    Joined:
    Apr 15, 2014
    Messages:
    1,135
    Likes Received:
    813
    Trophy Points:
    283
    Nobody can force the buyer and seller to accept some randomly chosen notary. The buyer and seller are in communication, they have to be as OB doesn't handle the transaction at all, they can agree a notary between them. If OB doesn't have an inbuilt 'Notary Market', one will spring up almost immediately, which would make OB pretty much coin-agnostic, any currency that can do multisig will do.
     
  15. tungfa

    tungfa Administrator
    Dash Core Team Foundation Member Masternode Owner/Operator Moderator

    Joined:
    Apr 9, 2014
    Messages:
    8,961
    Likes Received:
    6,735
    Trophy Points:
    1,283
    the buyer and seller agree on a Notary from the list available
     
  16. iHeartSmartArt

    Joined:
    May 2, 2014
    Messages:
    151
    Likes Received:
    59
    Trophy Points:
    88
    #46 iHeartSmartArt, Aug 26, 2014
    Last edited by a moderator: Aug 26, 2014
    • Like Like x 3
  17. tungfa

    tungfa Administrator
    Dash Core Team Foundation Member Masternode Owner/Operator Moderator

    Joined:
    Apr 9, 2014
    Messages:
    8,961
    Likes Received:
    6,735
    Trophy Points:
    1,283
    beta version less than a week they just posted
     
    • Like Like x 1
  18. thelonecrouton

    thelonecrouton Well-known Member
    Foundation Member

    Joined:
    Apr 15, 2014
    Messages:
    1,135
    Likes Received:
    813
    Trophy Points:
    283
    emailed!
     
    • Like Like x 2
  19. iHeartSmartArt

    Joined:
    May 2, 2014
    Messages:
    151
    Likes Received:
    59
    Trophy Points:
    88
    What did you e-mail? This may take more then asking. Which Darkcoin Multi-sig website do we have currently? Only one person needs to submit it.
     
    • Like Like x 1
  20. thelonecrouton

    thelonecrouton Well-known Member
    Foundation Member

    Joined:
    Apr 15, 2014
    Messages:
    1,135
    Likes Received:
    813
    Trophy Points:
    283
    I simply asked them to consider Darkcoin as well, given that the underlying protocol is identical to Bitcoin and multisig works in exactly the same way, and pointed them to the latest daemon and qt wallet.
     
  21. iHeartSmartArt

    Joined:
    May 2, 2014
    Messages:
    151
    Likes Received:
    59
    Trophy Points:
    88
    Open Bazaar and Bitrated are open-sourced. So its up to us to do this.
    Open Bazaar plans to integrate Bitrated,
    First we build multisig on http://electrum-drk.org/
    Then E-mail Bitrated to add our wallet option.

    OB plans to release version 1.0 with AltCoin Notary Ability, (Fall or next year.)
    My impression is, Alts will just have to wait...Unless, your coin has a multisig wallet on Bitrated.
     
    #51 iHeartSmartArt, Aug 26, 2014
    Last edited by a moderator: Aug 26, 2014
    • Like Like x 1
  22. iHeartSmartArt

    Joined:
    May 2, 2014
    Messages:
    151
    Likes Received:
    59
    Trophy Points:
    88
    Might want to shout that at the folks making bitcoin multi-sig wallets. They could make an DRK android wallet with multi sig today. It should'nt be that difficult to apply Bitcoin technology to Darkcoin.
     
    #52 iHeartSmartArt, Aug 26, 2014
    Last edited by a moderator: Aug 27, 2014
    • Like Like x 1
  23. tungfa

    tungfa Administrator
    Dash Core Team Foundation Member Masternode Owner/Operator Moderator

    Joined:
    Apr 9, 2014
    Messages:
    8,961
    Likes Received:
    6,735
    Trophy Points:
    1,283
    so they would be writing the code ?
    how much is something like that ?
     
  24. thelonecrouton

    thelonecrouton Well-known Member
    Foundation Member

    Joined:
    Apr 15, 2014
    Messages:
    1,135
    Likes Received:
    813
    Trophy Points:
    283
    darkcoind does multisig already, it just needs some prettification. If I can get my head around how it works I can make a multisig GUI in pyqt.
     
    • Like Like x 5
  25. iHeartSmartArt

    Joined:
    May 2, 2014
    Messages:
    151
    Likes Received:
    59
    Trophy Points:
    88
    I keep a chatlog in their IRC,
    Open Bazaar is looking at using Freenet : https://freenetproject.org/
    "The advantage of OpenBazaar is not just anonymity. It needs to be accessible. There's a reason freenet isn't used by everyone for one reason or another. If there are issues with free not adopting I don't want that to hinder people from using open bazaar" <brianhoffman>
    At some point we will want to have Open Bazaar use some of our Darkcoin Net when its ready. Because freenet nodes are free, the majority of nodes are controlled by anyone. To be truly anonymous you'd need something Darkcoin to host your OB as an access gateway for a price in anonymous ecash. Darkcoin being the first ever.
     
    #55 iHeartSmartArt, Aug 27, 2014
    Last edited by a moderator: Aug 27, 2014
  26. tungfa

    tungfa Administrator
    Dash Core Team Foundation Member Masternode Owner/Operator Moderator

    Joined:
    Apr 9, 2014
    Messages:
    8,961
    Likes Received:
    6,735
    Trophy Points:
    1,283
    here a little visual inspiration ...>>
     
  27. thelonecrouton

    thelonecrouton Well-known Member
    Foundation Member

    Joined:
    Apr 15, 2014
    Messages:
    1,135
    Likes Received:
    813
    Trophy Points:
    283
    Wow, took bloody hours but I'm now at the point where I can chuck some code together with a vague hope that it might work. ;)

    Finding comprehensible documentation on how multisig actually works is quite hard.

    Current plan: provide a simple GUI wallet for DRK users to generate, and send and receive what they need to, to/from other parties in a multisig clusterTX for use with OB or, well, anywhere else.

    Here's the logic/flow I'm going with for testing:
    Code:
    1. Mediator asks Seller for a pubkey. (darkcoind validateaddress <selleraddress>)
    
       outputs:   SELLER-PUBKEY
    
    2. Mediator asks Buyer for a pubkey. (darkcoind validateaddress <buyeraddress>)
    
       outputs:   BUYER-PUBKEY
    
    3. Mediator gets a pubkey for Mediator. (darkcoind validateaddress <mediatorraddress>)
    
       outputs:   MEDIATOR-PUBKEY
    
    4. Mediator creates Multisig Address (MA) from the 3 pubkeys. (darkcoind createmultisig 2 ‘[“<SELLER-PUBKEY>", "<MEDIATOR-PUBKEY>", "<BUYER-PUBKEY>”]'
    
       outputs:   MA
           redeemSCRIPT
    
    5. Mediator sends MA and sriptPUBKEY to Buyer and Seller
    
    6. Buyer sends DRK to MA (darkcoind sendtoaddress <MA> <amount>)
    
       outputs:   TXID
    
    7. Seller checks MA, sees payment from Buyer
    
    8. Seller sends goods to Buyer
    
    9. Buyer happy?
     
       YES:       Buyer sends Seller BUYER-PRIVKEY
             Seller signs with BUYER-PRIVKEY
             Seller signs with SELLER-PRIVKEY
             Seller gets funds from MA (GOTO REDEEM)     *seller paid*
    
    
       NO (or dishonest):   EITHER:     
             Mediator sends MEDIATOR-PRIVKEY to Buyer   *sides with Buyer*   # other stuff can happen here
             Buyer signs with MEDIATOR-PRIVKEY           #
             Buyer signs with BUYER-PRIVKEY             # eg, Buyer returns goods to Seller
             Buyer gets funds from MA (GOTO REDEEM)     *buyer gets refund*   #
                               # they all need to sort
             OR:                   #
             Mediator sends MEDIATOR-PRIVKEY to Seller   *sides with Seller*   # it out between them
             Seller signs with MEDIATOR-PRIVKEY           #
             Seller signs with SELLER-PRIVKEY           #
             Seller gets funds from MA (GOTO REDEEM)     *seller paid anyway*   # IDGAF :)
    
    
    
    REDEEM:
    
    At this point, Buyer or Seller has their own privkey, plus one sent from Mediator
    
    1. getrawtransaction (darkcoind getrawtransaction TXID 1)
               
       outputs:     a bunch of crap, we want the vout with the largest amount (voutL), the smaller one if it exists will probably be the tx fee to miners
       from output get:    voutLindexVALUE, voutLhexkeyVALUE, voutLAMOUNT
    
    2. Pick an address you want it sent to: STADDRESS
    
    3. createrawtransaction (darkcoind createrawtransaction '[{"txid”:”TXID","vout”:voutLindexVALUE,"scriptPubKey”:”voutLhexkeyVALUE","redeemScript”:”redeemSCRIPT"}]' ‘{“STA”:<voutLAMOUNT>}'’
    
       output: RAWHEXTRANSACTION
    
    4. signrawtransaction with MEDIATORPRIVKEY (darkcoind signrawtransaction ‘RAWHEXTRANSACTION' '[{"txid”:”<TXID>","vout”:voutLindexVALUE,"scriptPubKey”:”voutLhexkkeyVALUE","redeemScript”:”redeemSCRIPT"}]' ‘[“MEDIATORPRIVKEY”]'
    
       output: HEX1SIGNED
    
    5. signrawtransaction with BUYERPRIVKEY or SELLERPRIVKEY (darkcoind signrawtransaction ‘RAWHEXTRANSACTION' '[{"txid”:”<TXID>","vout”:voutLindexVALUE,"scriptPubKey”:”voutLhexkkeyVALUE","redeemScript”:”redeemSCRIPT"}]' ‘[“BUYER/SELLERPRIVKEY”]'
    
       output: HEX2SIGNED
    
    6. thank fuck, let's broadcast it! (darkcoind sendrawtransaction HEX2SIGNED)
    
    7. The End
    
    Here's the GUI so far:
    [​IMG]
    (edit: orange input boxes initially ask for buyer and seller pubkeys)

    I thought I had it cracked but I have hit a snag though in creating the multisig address, hopefully just a stupid mistake on my part but I have added a comment to vertoe's JIRA bug at

    http://jira.darkcoin.qa/browse/DRK-20

    Open to suggestions!
     
    #57 thelonecrouton, Aug 27, 2014
    Last edited by a moderator: Aug 27, 2014
    • Like Like x 7
  28. thelonecrouton

    thelonecrouton Well-known Member
    Foundation Member

    Joined:
    Apr 15, 2014
    Messages:
    1,135
    Likes Received:
    813
    Trophy Points:
    283
    Sorry vertoe for further clogging up your thread with my technicolour rubbish, but it helps me understand the process.

    Changed the Arbiter UI slightly:
    [​IMG]

    Buyer and Seller Uis are pretty much the same, here's the Seller one:
    [​IMG]

    So, the steps are:

    1. Buyer and Seller generate a new address and associated pubkey and send their pubkeys to the Arbiter (with some form of transaction reference so Arbiter can match them up!)
    2. Arbiter generates a new address and associated pubkey, then adds all 3 pubkeys together, creates the Multisig Address, and sends the details to the Buyer and Seller
    3. Buyer sends payment to the Multisig Address
    4. Seller checks payment has been made
    5. Seller sends goods to Buyer
    6. Buyer is happy, sends their privkey to Seller, Seller can now retreive the DRK from the Multisig Address

    or

    7. Arbitration ensues, Arbiter decides who gets the additional privkey (the Arbiters) needed to retrieve the DRK from the Multisig Address

    Just waiting for Evan/flare to fix darkcoind multisig or tell me where I'm screwing up... :oops:

    At no point should the Arbiter be in possession of any privkey except their own, so Arbiter cannot steal the DRK

    Note: The flaw (haha, one of them anyway) in this implementation is that if the Arbiter withholds the redeemscript key, neither the Buyer or Seller can retrieve the DRK in the Multisig Address. There's probably just something I still haven't understood about it though... maybe they can get it another way, no idea at the moment...
     
    • Like Like x 4
  29. karisu

    karisu Member

    Joined:
    Jun 30, 2014
    Messages:
    70
    Likes Received:
    26
    Trophy Points:
    58
    That looks very very neat. Am I getting this right, that if someone would have a running OpenBazaar Instance and your script it should be possible to create a multisig transaction usable for an order in openBazaar
     
  30. iHeartSmartArt

    Joined:
    May 2, 2014
    Messages:
    151
    Likes Received:
    59
    Trophy Points:
    88
    Nice work Crutons Cluster!

    Will this calculate arbitor fees too? We can't rely on Open Bazaar for any part in transactions . They take nothing for being a party and do nothing with coins. That is up to the multisig.
    The arbitor is supposed to be this honorable person held accountable, or called Proof of burn, familiarize yourself with types of arbitors in the bitcoin world so far: https://www.bitrated.com/u

    For 'The flaw', Maybe a time limit count down 48 hours after both the buyer is happy and the seller is happy, if the arbitor is absent.

    or send the entire case to a new arbitor, maybe a predetermined 'reference arbitor' agreed to, if the main arbitor goes afk. Doesn't this get complicated fast. @ thelonecrouton