You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 17, 2025. It is now read-only.
**Members**: The participating members of the contract.
55
-
**Funders**: Those depositing funds into the contract (may be members).
56
-
**Platform** : The server hosting the escrow contract (BitEscrow API).
54
+
**Members** : The participating members of the contract.
55
+
**Funders** : Those depositing funds into the contract (may be members).
56
+
**Agent**: The server agent hosting the escrow contract (BitEscrow API).
57
57
58
58
The protocol is split into three phases: `negotiation`, `funding`, and `settlement`. Each phase represents a round of communication in the protocol.
59
59
@@ -86,17 +86,17 @@ The `members` of the contract must first negotiate and agree on a `proposal` doc
86
86
}
87
87
```
88
88
89
-
If desired, a service `provider`can host a platform for negotiating the proposal. The protocol is designed for third-parties to help with coordination, and offer their own services such as arbitration.
89
+
If desired, a third-party can host the proposal. The protocol is designed for third-parties to help with negotiation, and offer their own services such as arbitration.
90
90
91
-
There is no specification placed on how to communicate a proposal between parties. There are already many great communication protocols that exist in the wild, and they all support JSON. Feel free to use your favorite one!
91
+
There is no specification placed on how to communicate the proposal between parties. There are so many great communication protocols that exist in the wild, and they virtually all support JSON, so feel free to use your favorite one!
92
92
93
-
> Note: The `agent` does not arbitrate disputes or take part in negotiations. This is strictly by design. While BitEscrow may offer these services, the protocol is designed so that members and third-parties can negotiate freely, without the agent being involved.
93
+
> Note: The server `agent` does not take part in negotiations or arbitrate disputes. This is strictly by design. While BitEscrow may offer these services, the protocol is designed so that members and third-parties can negotiate freely, without the agent being involved.
94
94
95
95
### Funding
96
96
97
-
Once a proposal is finalized, it is delivered to the `agent` server, who hosts the contract, and coordinates with `funders`.
97
+
Once a final proposal has been delivered to our server, all terms and endorsements are validated, then a `contract` is formed. The contract is assigned a signing `agent`, which is used to coordinate deposits.
98
98
99
-
Each funder requests a `deposit`account from the agent. This account uses a 2-of-2 multi-signature address with a time-locked refund path.
99
+
Each funder requests a deposit`account` from the agent. This account uses a 2-of-2 multi-signature address with a time-locked refund path.
100
100
101
101
```ts
102
102
interfaceDepositAccount {
@@ -111,7 +111,7 @@ interface DepositAccount {
111
111
}
112
112
```
113
113
114
-
The funder then delivers a batch of pre-signed transactions which authorizes each of the spending paths of the contract.
114
+
The funder then delivers a batch of pre-signed transactions (called a `covenant`), which authorizes each of the spending paths of the contract.
115
115
116
116
```ts
117
117
interfaceCovenantData {
@@ -124,11 +124,11 @@ interface CovenantData {
124
124
}
125
125
```
126
126
127
-
Once the pre-signed `covenant` is made, the funds are locked in escrow. Once all deposits have bee locked and confirmed, the contract becomes active.
127
+
Once the covenant is made, the funds are locked in escrow. Once all the required funds have bee locked and confirmed, the contract becomes active.
128
128
129
129
### Settlement
130
130
131
-
The final round of the escrow process is the `settlement`. This is the most fun part of the protocol, as members of the contract get to debate about how the money shall be spent.
131
+
The final round of the escrow protocol is the `settlement`. This is the most exciting round, as members of the contract get to debate over how the money shall be spent.
132
132
133
133
When the contract becomes active, a virtual machine is started within the contract. This vm includes the `paths`, `programs`, and `tasks` specified in the proposal.
134
134
@@ -198,11 +198,13 @@ Members of the contract can interact with the vm using signed statements, called
198
198
}
199
199
```
200
200
201
-
Each new statement updates the vm, and is added to a git-style commitment chain of hashes. Members can use the vm to settle on a spending path, or lock, unlock, and dispute paths.
201
+
Members can use the vm to settle on a spending path, or lock, unlock, and dispute paths. Each statement that updates the vm is recorded into a hash-chain. The chain validates the full running history of the vm, from activation to settlement.
202
202
203
203
Once the contract vm has settled on a spending path, the agent will complete the relevant pre-signed transaction, and broadcast it, closing the contract.
204
204
205
-
The proposal, covenants, and witness statements combine to create a proof of validity on how the contract should be settled. If the platform broadcasts a transaction without a matching validity proof, then the reputation of the platform is damaged.
205
+
The proposal, covenants, and vm combine to create a proof of validity. This proof covers how the contract should execute at any moment. There is zero ambiguity left to the `agent`.
206
+
207
+
Each contract settlement on mainnet will include a valid proof in order to keep our reputation intact.
206
208
207
209
### Protocol Flow
208
210
@@ -269,151 +271,69 @@ In terms of security, speed, and simplicity, we believe this is the best non-cus
269
271
270
272
## How to Use
271
273
272
-
### Creating a Signer (for contract members)
273
-
274
-
Full example: [01_create_signer.ts](test/demo/01_create_signer.ts)
title : 'Basic two-party contract with third-party arbitration.',
316
-
expires : 14400,
317
-
network : 'signet',
318
-
schedule : [[ 7200, 'close', 'payout|return' ]],
319
-
value : 15000,
320
-
})
321
-
322
-
exportconst roles :Record<string, RolePolicy> = {
323
-
buyer : {
324
-
paths : [
325
-
[ 'heads', 10000 ],
326
-
[ 'draw', 5000 ]
327
-
],
328
-
programs : [
329
-
[ 'endorse', 'close', 'heads|tails', 2 ],
330
-
[ 'endorse', 'dispute', 'heads|tails', 1 ]
331
-
]
332
-
},
333
-
seller : {
334
-
paths : [
335
-
[ 'tails', 10000 ],
336
-
[ 'draw', 5000 ]
337
-
],
338
-
programs : [
339
-
[ 'endorse', 'close', 'heads|tails', 2 ],
340
-
[ 'endorse', 'dispute', 'heads|tails', 1 ]
341
-
]
342
-
},
343
-
agent : {
344
-
payment : 5000,
345
-
programs : [
346
-
[ 'endorse', 'resolve', 'heads|tails', 1 ]
347
-
]
348
-
}
349
-
}
350
-
```
351
-
352
-
### Joining and Endorsing a Proposal
353
-
354
-
```ts
355
-
const [ alice, bob, carol ] =signers
356
-
357
-
proposal.join(roles.buyer, alice)
358
-
proposal.join(roles.seller, bob)
359
-
proposal.join(roles.agent, carol)
360
-
361
-
const signatures =signers.map(mbr=> {
362
-
returnmbr.endorse.proposal(proposal)
363
-
})
364
-
```
365
-
366
-
### Creating a Contract
367
-
368
-
```ts
369
-
const res =awaitalice.client.contract.create(proposal, signatures)
301
+
## Development / Testing
370
302
371
-
if (!res.ok) thrownewError(res.error)
303
+
This project uses the following scripts:
372
304
373
-
const { contract } =res.data
305
+
```md
306
+
build : Compiles the contents of `src` folder to `dist`.
307
+
demo <chain> : Runs the protocol demo for the provided chain.
308
+
load <script> : Executes the script at the provided path.
309
+
release : Builds and tests the current source for release.
310
+
scratch : Executes the `test/scratch.ts` file.
311
+
test : Runs the current test suite in `test/tape.ts`.
374
312
```
375
313
376
-
### Requesting a Deposit Account
314
+
Example of running the demo on the mutiny chain (using npm):
377
315
378
-
```ts
379
-
// Request an account for the member to use.
380
-
const res =awaitalice.deposit.request_acct({
381
-
locktime : 60*60// 1 hour locktime
382
-
})
383
-
384
-
// Check the response is valid.
385
-
if (!res.ok) thrownewError(res.error)
386
-
387
-
// Unpack some of the terms.
388
-
const { account } =res.data
316
+
```bash
317
+
npm run demo mutiny
389
318
```
390
319
391
-
## Development / Testing
392
-
393
-
The documentation for development and testing is currently being fleshed out for an open beta release.
320
+
> The available chains are mutiny, signet, and testnet. Main chain coming soon!
394
321
395
-
If you want to see a naive end-to-end demonstration of the of the protocol, you can use the follwoing command:
322
+
Example of running the current test suite in verbose mode:
396
323
397
324
```bash
398
-
## Using Yarn:
399
-
VERBOSE=true yarn test
400
-
## Using NPM:
401
325
VERBOSE=true npm run test
402
326
```
403
327
404
-
This should spin up an isolated `regtest` version of Bitcoin core (which comes packaged with the repo), and run a flurry of methods which exercise the entire protocol. The full end-to-end test is located in `test/src/tests/e2e.test.ts`.
328
+
Please stay tuned for more documentation and updates!
405
329
406
-
Over the next month, we'll be adding more concrete examples using the `EscrowClient`, plus opening our escrow server to public beta on `testnet` and `mutinynet`.
330
+
## Questions / Issues
407
331
408
-
Please stay tuned!
409
-
410
-
## Issues / Questions / Comments
411
-
412
-
Please feel free to post any kind of issue on the tracker. All feedback is welcome.
332
+
Please feel free to post questions or comments on the issue board. All feedback is welcome.
413
333
414
334
## Contribution
415
335
416
-
Help wanted. All contributions are welcome. :-)
336
+
Help wanted. All contributions are welcome!
417
337
418
338
## Resources
419
339
@@ -467,8 +387,14 @@ Not a run-time dependency, but I use this to incorporate bitcoin core directly i
467
387
468
388
https://github.com/cmdruid/core-cmd
469
389
390
+
**signer**
391
+
392
+
Reference implementation of the new hybrid signing device / wallet we are building for BitEscrow. The documentation needs to be updated. WIP.
393
+
394
+
https://github.com/cmdruid/signer
395
+
470
396
# Footnote
471
397
472
-
My inspiration for this project comes from the Bitcoin space, and the incredibly talented people that keep it alive. From them I gained my knowledge and spirit, and for that I am grateful.
398
+
My inspiration for this project comes from the Bitcoin space, and the incredibly talented people that contribute. I will be forever grateful for their knowledge, kindness and spirit.
473
399
474
-
I wish for Bitcoin to win all the marbles; and become the new global reserve marbles that we all fight over. I firmly believe it will make the world a better place, and bring society towards a new golden age. Maybe we will become space-faring apes that reach beyond the moon.
400
+
I wish for Bitcoin to win all the marbles; and be the new global reserve marbles that we fight over. I firmly believe a better money system will make the world a better place. Maybe we will reach beyond the moon.
0 commit comments