Skip to content

Instantly share code, notes, and snippets.

@drwasho
Last active July 31, 2017 23:16
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save drwasho/352a565475a7f1e6dda0 to your computer and use it in GitHub Desktop.
Insurance contracts in OpenBazaar

OpenBazaar Insurance Contracts

Insurance Contract - Base Template

  • As with all Ricardian contracts in OpenBazaar, there are 4 stages:
    1. Vendor offer
    2. Buyer order
    3. Vendor order confirmation
    4. Buyer receipt
  • A completed Ricardian contract is called a 'trade receipt'

Stage 1: vendor_offer

  • Replaces listing object in the Ricardian contract (e-commerce)
"vendor_offer" : {
	 "listing" : {
			"metadata" : {
				 "version" : "",
				 "expiry" : "",
				 "category" : "",
				 "category_sub" : "fixed price"
			},
			"id" : {
				 "guid" : "",
				 "pubkeys" : {
						"guid" : "",
						"bitcoin" : ""
				 },
				 "blockchain_id" : ""
			},
			"insurance" : {
				"policy_name" : "",
				"policy_id" : "",
				"insured_subject" : "",
				"term_days" : 0,
				"type" : "",
				"coverage" : [],
				"exclusion" : [],
				"conditions" : [],
				"policy_limit" : {
					"bitcoin" : "",
					"fiat" : {
						"price" : "",
						"currency_code" : ""
					}
				},
				"reserve" : {
				   "percentage" : 0,
				   "bitcoin" : "0.1",
				   "fiat" : {
				      "price" : "",
				      "currency_code" : ""
				   }
				},
				"premium" : {
				   "frequency_days" : 0,
				   "bitcoin" : "",
				   "fiat" : {
				      "price" : "",
				      "currency_code" : ""
				   }
				},
				"excess" : {
				   "bitcoin" : "",
				   "fiat" : {
				      "price" : "",
				      "currency_code" : ""
				   }
				}
			},
			"moderators" : [
				 {
						"guid" : "",
						"pubkeys" : {
							 "guid" : {
									"key" : "",
									"signature" : ""
									},
							 "escrow" : {
									"key" : "",
									"signature" : ""
									}
						},
						"blockchain_id" : ""
				 }
			]
	 },
	 "signatures" : {
			"guid" : "sig(vendor_offer.listing)"
	 }
},

Stage 2: buyer_order

  • The details from the Buyer necessary to finalize the insurance contract go in buyer_order.order.order.properties
"buyer_order" : {
	 "order" : {
			"ref" : {
				 "algorithm" : "base58(RIPEMD-160[vendor_offer])",
				 "ref_hash" : ""
			},
			"id" : {
				 "guid" : "",
				 "pubkeys" : {
						"bitcoin" : "",
						"guid" : ""
				 },
				 "blockchain_id" : ""
			},
			"order" : {
				 "properties" : {}
			},
			"multisignature" : {
				 "chaincode" : "",
				 "vendor_sig" : "",
				 "redemption_script" : "",
				 "txid" : ""
			}
	 },
	 "signatures" : {
			"guid" : "sig(buyer_order.order)"
	 }
},

Stage 3: vendor_order_confirmation

"vendor_order_confirmation" : {
	 "confirmation" : {
			"ref" : {
				 "algorithm" : "base58(RIPEMD-160[buyer_order])",
				 "ref_hash" : ""
			},
			"comments" : ""
	 },
	 "signatures" : {
			"guid" : "sig(vendor_order_confirmation.confirmation)"
	 }
},

Stage 4: buyer_receipt

"buyer_receipt" : {
	 "receipt" : {
			"ref" : {
				 "algorithm" : "base58(RIPEMD-160[vendor_order_confirmation])",
				 "ref_hash" : ""
			},
			"listing" : {
				 "received" : true
			},
			"payout" : {
				 "signed_tx" : "",
				 "txid" : ""
			},
			"rating" : {
				 "feedback" : 0,
				 "quality" : 0,
				 "description" : 0,
				 "delivery_time" : 0,
				 "customer_service" : 0,
				 "review" : ""
			},
			"dispute" : {
				 "dispute" : false,
				 "claim" : ""
			}
	 },
	 "signatures" : {
			"guid" : "sig(buyer_receipt.receipt)"
	 }
}

Insurance Contract - Fully Collateralized

  • Example: house insurance for a meteor strike
  • The full insurance limit/assurance is locked in a multisignature (multisig) escrow address
  • The buyer of the insurance policy pays into the same multisig escrow address
"insurance" : {
	"policy_name" : "Acme - House Meteorite Insurance",
	"policy_id" : "1234a",
	"insured_subject" : "Home",
	"term_days" : 30,
	"type" : "fully collateralized",
	"coverage" : [ "meteorite damage" ],
	"exclusion" : [ "comet damage" ],
	"conditions" : [ "Meteorite must impact free of the insured party's interference." ],
	"policy_limit" : {
		"bitcoin" : "1",
		}
	},
	"premium" : {
		"frequency_days" : 1,
		"bitcoin" : "0.01"
	},
	"excess" : {
		"bitcoin" : "0.05",
		}
	}
},

Insurance Contract - Partially Collateralized

Example: house insurance for a meteor strike

  • A fraction of the insurance limit/assurance is locked in a multisignature (multisig) escrow address
  • The buyer of the insurance policy pays into the same multisig escrow address
"insurance" : {
	"policy_name" : "Acme - House Meteorite Insurance",
	"policy_id" : "1234b",
	"insured_subject" : "Home",
	"term_days" : 30,
	"type" : "partially collateralized",
	"coverage" : [ "meteorite damage" ],
	"exclusion" : [ "comet damage" ],
	"conditions" : [ "Meteorite must impact free of the insured party's interference." ],
	"policy_limit" : {
	   "bitcoin" : "1"
	   }
	},
	"reserve" : {
	   "percentage" : 0,
	   "bitcoin" : "0.1"
	   }
	},
	"premium" : {
	   "frequency_days" : 1,
	   "bitcoin" : "0.005"
	},
	"excess" : {
	   "bitcoin" : "0.01"
	}
},

Insurance Contract - No Limit

  • Example: house insurance for a meteor strike
  • This insurance policy doesn't have a limit
  • The insurer exposes themselves to the entire financial loss of the buyer
  • The insurer may hold a reserve amount in multisig escrow
  • The buyer of the insurance policy pays into a multisig escrow address
"insurance" : {
	"policy_name" : "Acme - House Meteorite Insurance",
	"policy_id" : "1234c",
	"insured_subject" : "Home",
	"term_days" : 30,
	"type" : "zero limit",
	"coverage" : [ "meteorite damage" ],
	"exclusion" : [ "comet damage" ],
	"conditions" : [ "Meteorite must impact free of the insured party's interference." ],
	"reserve" : {
	   "bitcoin" : "1"
	   }
	},
	"premium" : {
	   "frequency_days" : 1,
	   "bitcoin" : "0.05"
	},
	"excess" : {
	   "bitcoin" : "0.1"
	}
},

Transaction Insurance in OpenBazaar

  • Example: transaction insurance for OpenBazaar
"insurance" : {
	"policy_name" : "Acme - OpenBazaar Transactional Insurance",
	"policy_id" : "1234d",
	"insured_subject" : "Home",
	"term_days" : 365,
	"type" : "partially collateralized",
	"coverage" : [ "Failure to recover funds during a dispute resolution." ],
	"exclusion" : [ "comet damage" ],
	"conditions" : [ "Meteorite must impact free of the insured party's interference." ],
	"policy_limit" : {
	   "bitcoin" : "10"
	   }
	},
	"reserve" : {
	   "percentage" : 10,
	   "bitcoin" : "1"
	   }
	},
	"premium" : {
	   "frequency_days" : 30,
	   "bitcoin" : "0.5"
	},
	"excess" : {
	   "bitcoin" : "0.5"
	}
},

Reinsurance Contract in OpenBazaar

Excess of Loss Reinsurance

"insurance" : {
	"policy_name" : "Acme - Reinsurer Insurance",
	"policy_id" : "1234e",
	"insured_subject" : "Home",
	"term_days" : 365,
	"type" : "reinsurance, excess of loss",
	"coverage" : [ "A limited value range if a claim exceeds the pre-established threshold." ],
	"exclusion" : [ "comet damage" ],
	"conditions" : [ "Meteorite must impact free of the insured party's interference." ],
	"policy_limit" : {
	   "bitcoin" : "10-100"
	   }
	},
	"reserve" : {
	   "percentage" : 10,
	   "bitcoin" : "1"
	   }
	},
	"premium" : {
	   "frequency_days" : 30,
	   "bitcoin" : "0.5"
	},
	"excess" : {
	   "bitcoin" : "0.5"
	}
},

Proportional Reinsurance

"insurance" : {
	"policy_name" : "Acme - Reinsurer Insurance",
	"policy_id" : "1234f",
	"insured_subject" : "Home",
	"term_days" : 365,
	"type" : "reinsurance, proportional",
	"coverage" : [ "A portion of the claim." ],
	"exclusion" : [ "comet damage" ],
	"conditions" : [ "Meteorite must impact free of the insured party's interference." ],
	"policy_limit" : {
	   "bitcoin" : "10"
	   },
	   "portion_of_claim" : "30"
	},
	"reserve" : {
	   "percentage" : 10,
	   "bitcoin" : "1"
	   }
	},
	"premium" : {
	   "frequency_days" : 30,
	   "bitcoin" : "0.5"
	},
	"excess" : {
	   "bitcoin" : "0.5"
	}
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment