Skip to content

Instantly share code, notes, and snippets.

@resilience-me
resilience-me / bitcoin-smart-contract-with-resilience-protocol.js
Last active September 16, 2015 11:41
basic resilience-smart-contract framework. these will be launched on Ethereum and on NodeJS servers (think Codiu§) that log their data to the Horizon blockchain.
/** Bitcoin Smart-Contract with Resilience protocol
*
*/
var express = require('express');
var fs = require('fs');
var app = express();
var bodyParser = require('body-parser')
var Bitnation = require('./bitnation.core.js');
require('./bitnation.horizon.js');
var jQuery = require('jquery');
(function (Bitnation, $) {
/**
* Profile data service class
*/
@resilience-me
resilience-me / resilience-bitcoin-smart-contract.js
Created July 16, 2015 22:03
basic resilience-smart-contract framework. these will be launched on Ethereum and on NodeJS servers (think Codiu§) that log their data to the Horizon blockchain.
/** Bitcoin Smart-Contract with Resilience protocol
*
*/
var express = require('express');
var fs = require('fs');
var app = express();
var bodyParser = require('body-parser')
/** Bitcoin Smart-Contract with Resilience protocol
* pre-blockchain version for enthusiasts
*/
var express = require('express');
var app = express();
var bodyParser = require('body-parser')
// pseudocode example
contract owned {
address owner;
function owned() { owner = msg.sender; }
function transfer(address to) onlyowner returns (bool success){
owner = to;
return true;
}
// This contract can be used to hold money while an item is in transit
// during purchase.
// This protocol is a variation of a protocol by Oleg Andreev which is
// described at
// https://gatecoin.com/blog/2015/10/blockchain2-disrupting-disrutors/
//
// Assume Bob wants to buy an item worth x Ether from Alice.
// Alice creates this contract and and sends 2x Ether to the contract
// together with its creation transaction.
// If Bob does not react, Alice can get her money back.
contract poi {
bool debug;
uint blockNum;
uint groupSize;
bytes32 entropy;
uint public numUsers;
mapping(address => bytes32) public userHash;
/// @title Taxeme System
/// @author Jeffrey B. Petersen
contract TaxemeSystem {
struct Taxeme {
uint32 rate;
uint size;
Member creator;
}

Taxeme

A component of the Resilience taxation system.

Rules

Everyone issues a proportional tax rate that defines their personal "taxeme".

An individual can change their personal taxeme at any time to have any rate from 0% to 100%.

Anyone can have multiple taxemes at once, but only the master copy of their personal taxeme.