Skip to content

Instantly share code, notes, and snippets.

@drwasho
Last active August 29, 2015 14:23
Show Gist options
  • Save drwasho/856eb7a3361788b98689 to your computer and use it in GitHub Desktop.
Save drwasho/856eb7a3361788b98689 to your computer and use it in GitHub Desktop.

OpenBazaar v1 Contracts

Physical Goods - Fixed Price

{
   "01_vendor" : {
      "01_listing" : {
         "01_metadata" : {
            "01_obcv" : "",
            "02_expiry" : "",
            "03_category" : "physical good",
            "04_category_sub" : "fixed price"
         },
         "02_id" : {
            "01_guid" : "",
            "02_pubkeys" : {
               "bitcoin" : "",
               "pgp" : ""
            },
            "03_passcard" : ""
         },
         "03_item" : {
            "01_title" : "",
            "02_description" : "",
            "03_condition" : "",
            "04_price" : {
               "bitcoin" : "",
               "fiat" : {
                  "01_price" : "",
                  "02_currency_code" : ""
               }
            },
            "05_images" : {
               "image_hashes" : [ "" ],
               "image_urls" : [ "" ]
            },
            "06_keywords" : [ "" ],
            "07_process_time" : ""
         },
         "04_shipping" : {
            "01_free" : false,
            "02_flat_fee" : {
               "01_bitcoin" : {
                  "01_domestic" : "",
                  "02_international" : ""
               },
               "02_fiat" : {
                  "01_price" : {
                     "01_domestic" : "",
                     "02_international" : ""
                  },
                  "02_currency_code" : ""
               }
            },
            "03_est_delivery" : {
               "01_domestic" : "",
               "02_international" : ""
            },
            "04_api" : {
               "01_api_src" : "Shippo",
               "02_carriers" : [ "FedEx", "UPS" ],
               "03_package" : {
                  "01_length" : "",
                  "02_width" : "",
                  "03_height" : "",
                  "04_distance_unit" : "",
                  "05_weight" : "",
                  "06_mass_unit" : ""
               },
               "04_shipping_origin" : {
                  "01_country" : "",
                  "02_zip" : ""
               }
            }
         },
         "05_moderator" : {
            "01_guid" : "",
            "02_pubkeys" : {
               "01_pgp" : "",
               "02_escrow_pubkey" : ""
            },
            "03_passcard" : "",
            "04_service" : {
               "01_service_fee" : "",
               "02_service_desc" : ""
            }
         }
      },
      "02_signatures" : {
         "bitcoin" : "sig(01_vendor.01_listing)",
         "pgp" : "sig(01_vendor.01_listing)"
      }
   },
   "02_buyer" : {
      "01_order" : {
         "01_ref" : "'OB' prefix + base58(RIPEMD-160[01_vendor])",
         "02_id" : {
            "01_btc_pubkey" : ""
         },
         "03_item" : {
            "01_semantics" : {},
            "02_shipping" : {
               "01_encrypted_address" : "pgp(nonce XOR shipping address)",
               "02_sha256_nonce" : "sha256(nonce)",
               "03_enc_nonce" : "vendor_pgp(nonce)",
               "04_api_shipping_cost" : {
                  "01_bitcoin" : "",
                  "02_fiat" : {
                     "01_price" : "",
                     "02_currency_code" : ""
                  }
               }
            }
         },
         "04_multisignature" : {
            "01_chaincode" : "",
            "02_multisignature_address" : "",
            "03_redemption_script" : "",
            "04_txid" : ""
         }
      },
      "02_signatures" : {
         "bitcoin" : "sig(02_buyer.02_order)"
      }
   },
   "03_vendor" : {
      "01_invoice" : {
         "01_ref" : "base58(RIPEMD-160[02_buyer])",
         "02_shipping" : {
            "01_tracking_id" : "",
            "02_shipper" : "",
            "03_payout" : {
               "01_payout_address" : "",
               "02_signed_tx" : ""
            },
            "04_rev_est_delivery" : ""
         },
         "03_pickup" : {
            "01_encrypted_address" : "bitcoin_ecc(nonce XOR pickup address)",
            "02_sha256_nonce" : "sha256(nonce)",
            "03_enc_nonce" : "buyer_bitcoin_ecc(nonce)"
         }
      },
      "02_signatures" : {
         "bitcoin" : "sig(03_vendor.01_invoice)",
         "pgp" : "sig(03_vendor.01_invoice)"
      }
   },
   "04_buyer" : {
      "01_receipt" : {
         "01_ref" : "base58(RIPEMD-160[03_vendor])",
         "02_item" : {
            "01_received" : true
         },
         "03_payout" : {
            "01_signed_tx" : "",
            "02_txid" : ""
         },
         "04_rating" : {
            "01_transaction_rating" : "",
            "02_item_quality" : "",
            "03_item_description" : "",
            "04_shipping_time" : "",
            "05_customer_service" : "",
            "06_review" : ""
         },
         "05_dispute" : {
            "01_dispute" : false,
            "02_claim" : ""
         }
      },
      "02_signatures" : {
         "bitcoin" : "sig(04_buyer.01_receipt)"
      }
   }
}

===

Digital Goods - Fixed Price

{
   "01_vendor" : {
      "01_listing" : {
         "01_metadata" : {
            "01_obcv" : "",
            "02_expiry" : "",
            "03_category" : "digital content",
            "04_category_sub" : "fixed price"
         },
         "02_id" : {
            "01_guid" : "",
            "02_pubkeys" : {
               "bitcoin" : "",
               "pgp" : ""
            },
            "03_passcard" : ""
         },
         "03_digital_content" : {
            "01_title" : "",
            "02_description" : "",
            "03_price" : {
               "bitcoin" : 0,
               "fiat" : {
                  "01_price" : "",
                  "02_currency_code" : ""
               }
            },
            "04_images" : {
               "image_hashes" : [ "" ],
               "image_urls" : [ "" ]
            },
            "05_keywords" : [ "" ],
            "06_process_time" : "",
            "07_ephemeral" : ""
         },
         "04_moderator" : {
            "01_guid" : "",
            "02_pubkeys" : {
               "01_pgp" : "",
               "02_escrow_pubkey" : ""
            },
            "03_passcard" : "",
            "04_service" : {
               "01_service_fee" : "",
               "02_service_desc" : ""
            }
         }
      },
      "02_signatures" : {
         "bitcoin" : "sig(01_vendor.01_listing)",
         "pgp" : "sig(01_vendor.01_listing)"
      }
   },
   "02_buyer" : {
      "02_order" : {
         "01_ref" : "'OB' prefix + base58(RIPEMD-160[01_vendor])",
         "02_id" : {
            "01_btc_pubkey" : ""
         },
         "03_digital_content" : {
            "01_semantics" : {}
         },
         "03_multisignature" : {
            "01_chaincode" : "",
            "02_multisignature_address" : "",
            "03_redemption_script" : "",
            "04_txid" : ""
         }
      },
      "02_signatures" : {
         "bitcoin" : "sig(02_buyer.02_order)"
      }
   },
   "03_vendor" : {
      "01_invoice" : {
         "01_ref" : "base58(RIPEMD-160[02_buyer])",
         "02_source" : {
            "01_content_source" : {
               "01_enc_url" : "bitcoin_ecc(nonce XOR URL)",
               "02_enc_password" : "bitcoin_ecc(nonce XOR password)",
               "03_sha256_nonce" : "sha256(nonce)",
               "04_enc_nonce" : "buyer_bitcoin_ecc(nonce)"
            },
            "02_payout" : {
               "01_payout_address" : "",
               "02_signed_tx" : ""
            }
         }
      },
      "02_signatures" : {
         "bitcoin" : "sig(03_vendor.01_invoice)",
         "pgp" : "sig(03_vendor.01_invoice)"
      }
   },
   "04_buyer" : {
      "01_receipt" : {
         "01_ref" : "base58(RIPEMD-160[03_vendor])",
         "02_digital_content" : {
            "01_received" : true
         },
         "03_payout" : {
            "01_signed_tx" : "",
            "02_txid" : ""
         },
         "04_rating" : {
            "01_transaction_rating" : "",
            "02_content_quality" : "",
            "03_content_description" : "",
            "04_customer_service" : "",
            "05_feedback" : ""
         },
         "05_dispute" : {
            "01_dispute" : false,
            "02_claim" : ""
         }
      },
      "02_signatures" : {
         "bitcoin" : "sig(04_buyer.01_receipt)"
      }
   }
}

===

Services - Fixed Price

{
   "01_vendor" : {
      "01_listing" : {
         "01_metadata" : {
            "01_obcv" : "",
            "02_expiry" : "",
            "03_category" : "services",
            "04_category_sub" : "fixed price"
         },
         "02_id" : {
            "01_guid" : "",
            "02_pubkeys" : {
               "bitcoin" : "",
               "pgp" : ""
            },
            "03_passcard" : ""
         },
         "03_service" : {
            "01_title" : "",
            "02_description" : "",
            "03_price_deposit" : {
               "bitcoin" : 0,
               "fiat" : {
                  "01_price" : "",
                  "02_currency_code" : ""
               }
            },
            "04_rate" : {
               "bitcoin" : 0,
               "fiat" : {
                  "01_price" : "",
                  "02_currency_code" : ""
               }
            },
            "05_images" : {
               "image_hashes" : [ "" ],
               "image_urls" : [ "" ]
            },
            "06_keywords" : [ "keyword1" ],
            "07_process_time" : ""
         },
         "04_moderator" : {
            "01_guid" : "",
            "02_pubkeys" : {
               "01_pgp" : "",
               "02_escrow_pubkey" : ""
            },
            "03_passcard" : "",
            "04_service" : {
               "01_service_fee" : "",
               "02_service_desc" : ""
            }
         }
      },
      "02_signatures" : {
         "bitcoin" : "sig(01_vendor.01_listing)",
         "pgp" : "sig(01_vendor.01_listing)"
      }
   },
   "02_buyer" : {
      "02_order" : {
         "01_ref" : "'OB' prefix + base58(RIPEMD-160[01_vendor])",
         "02_id" : {
            "01_btc_pubkey" : ""
         },
         "03_service" : {
            "01_semantics" : "",
            "02_service_address" : {
               "01_encrypted_address" : "pgp(nonce XOR service address)",
               "02_sha256_nonce" : "sha256(nonce)",
               "03_enc_nonce" : "vendor_pgp(nonce)"
            }
         },
         "04_multisignature" : {
            "01_chaincode" : "",
            "02_multisignature_address" : "",
            "03_redemption_script" : "",
            "04_txid" : ""
         }
      },
      "02_signatures" : {
         "bitcoin" : "sig(02_buyer.02_order)"
      }
   },
   "03_vendor" : {
      "01_invoice" : {
         "01_ref" : "base58(RIPEMD-160[02_buyer])",
         "02_services_rendered" : {
            "01_comments" : "",
            "02_payout" : {
               "01_payout_address" : "",
               "02_signed_tx" : ""
            }
         }
      },
      "02_signatures" : {
         "bitcoin" : "sig(03_vendor.01_invoice)",
         "pgp" : "sig(03_vendor.01_invoice)"
      }
   },
   "04_buyer" : {
      "01_receipt" : {
         "01_ref" : "base58(RIPEMD-160[03_vendor])",
         "02_service" : {
            "01_service_rendered" : true
         },
         "03_payout" : {
            "01_signed_tx" : "",
            "02_txid" : ""
         },
         "04_rating" : {
            "01_transaction_rating" : "",
            "02_service_quality" : "",
            "03_service_description" : "",
            "05_feedback" : ""
         },
         "05_dispute" : {
            "01_dispute" : false,
            "02_claim" : ""
         }
      },
      "02_signatures" : {
         "bitcoin" : "sig(04_buyer.01_receipt)"
      }
   }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment