{"id":19139956,"url":"https://github.com/arcblock/block-contract","last_synced_at":"2026-06-09T19:30:15.560Z","repository":{"id":96024923,"uuid":"274355245","full_name":"ArcBlock/block-contract","owner":"ArcBlock","description":"A decentralized contract platform that people can sign, view and trust","archived":false,"fork":false,"pushed_at":"2023-01-11T04:19:20.000Z","size":4842,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":20,"default_branch":"master","last_synced_at":"2025-01-03T14:49:59.243Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ArcBlock.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-06-23T08:44:49.000Z","updated_at":"2020-06-27T23:21:03.000Z","dependencies_parsed_at":"2023-04-24T16:47:32.604Z","dependency_job_id":null,"html_url":"https://github.com/ArcBlock/block-contract","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArcBlock%2Fblock-contract","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArcBlock%2Fblock-contract/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArcBlock%2Fblock-contract/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArcBlock%2Fblock-contract/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ArcBlock","download_url":"https://codeload.github.com/ArcBlock/block-contract/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240221508,"owners_count":19767443,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T07:15:46.341Z","updated_at":"2026-06-09T19:30:15.494Z","avatar_url":"https://github.com/ArcBlock.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Block Contract\n\nBlock contract is to build decentralized contract that people can sign, view and trust. To protect the privacy, the content of the contract will *NOT* be hosted in the blockchain, *only the hash* of the content is store in the chain.\n\n## High level design\n\nThe prototype of the flow of the app looks like this:\n\n![prototype](docs/prototype.jpg)\n\n## Contract Templates\n\n[Accord Project](https://www.accordproject.org) is a great open source tool to generate legal contracts.  The ultimate goal is integrate this project with Accord [Legal Contract Template Studio](https://studio.accordproject.org).\n\n## Blockchain\n\nWe will use ArcBlock's Blockchain Framework to build a custom blockchain for this project's demo.  The block explorer lives here: [Block Contract Block Explorer](https://contract.abtnetwork.io/dashboard)\n\nIt's possible to use other blockchains, such as Ethereum, Bitcoin to record the contract through Open Chain Access Protocol (OCAP), but it will be limited in features.\n\n## DB schema for contract\n\nFor contract created by the user, we store it as the following schema in mongo:\n\n```javascript\nconst ContractSchema = new mongoose.Schema({\n  // the did is calculated by sha3(concat(content, hash, signatures list without each sig))\n  _id: { type: String, required: true, trim: true },\n  requester: {type: String, required: true, trim: true},\n  synopsis: { type: String, required: true, trim: true },\n  content: { type: Buffer, required: true },\n  hash: { type: String, required: true },\n  signatures: [{\n    name: { type: String, required: true, trim: true },\n    email: { type: String, required: true, trim: true },\n    signedAt: { type: Date },\n    signature: { type: Buffer }\n  }],\n  finished: { type: Boolean, default: false},\n  address: { type: String, default: '' },\n  createdAt: { type: Date },\n  updatedAt: { type: Date },\n});\n```\n\n## Run this project from Repo\n\n### Requirements\n\n- Node.js v10+\n\n### Get code and install dependencies\n\n```bash\ncd block-contract\nmake dep\nnode tools/declare.js\n```\n\n### Prepare the configuration\n\nBefore running the app, you need to put a `.env` file into your repo:\n\n```bash\ncat \u003e .env\nSKIP_PREFLIGHT_CHECK=true\n\nDATA_DIR=\".data\"\nAPP_TOKEN_SECRET=\"c196792a8a14be2d3f10646079001a37e634ebbd99643c543f\"\nAPP_TOKEN_TTL=\"1d\"\nAPP_PORT=\"3030\"\nAPP_SK=\"0x4848947cc88b2e83682dec00e681d9ca057c582c0bc9fd42a1ce6c386361d2bda24f683f458bad332b2c913fd374493b08aca1993f2640cbfccd962951c220c0\"\nAPP_ID=\"zNKaoF3y3MiDHkisK2Dt8FgGVY6dXP6XETQr\"\n\nCHAIN_ID=\"playground\"\nCHAIN_HOST=\"https://playground.network.arcblockio.cn/api\"\n\nREACT_APP_APP_NAME=\"Block Contract\"\nREACT_APP_APP_DESCRIPTION=\"A decentralized contract platform that people can sign, view and trust\"\nREACT_APP_BASE_URL=\"http://192.168.1.2:3030\"\nREACT_APP_API_PREFIX=\"\"\n\nMAILGUN_USER=\"\u003cyour mailgun user\u003e\"\nMAILGUN_PASSWORD=\"\u003cyour mailgun password\u003e\"\n```\n\nNote that you need to put your gmail user/pass and tune the BASE_URL here.\n\nMake sure that you have your cellphone installed [ABT Wallet](https://abtwallet.io/en/) and it is under the same WIFI as your laptop running the app. Then:\n\n### Start the Block Contract app\n\n```bash\nmake run\n```\n\n## Screen Shots\n\nPages are being added so screen shots will be gradually available:\n\n### The home page\n\n![Block contract](docs/block_contract.jpg)\n\n### Step 1: Scan QR code to login (provided by Forge React Starter kit)\n\n![login 1](docs/login1.jpg)\n\nAfter you scanned the QR code with ABT wallet:\n\n![login 2](docs/login2.jpg)\n\nThen you are redirect to profile page. User can see the existing contracts:\n\n![List contracts](docs/list_contracts.jpg)\n\n### Step 2: Create a new contract\n\nYou may want to create a new contract:\n\n![Create contract](docs/create_contract.jpg)\n\nAnd all the signers will go emails like this:\n\n![Email content](docs/email.jpg)\n\n### Step 3 (for signer): Sign the contract\n\nAs a signer, when you got the email, if you click the \"View the Contract\" button or the link, you will get:\n\n![Sign 1](docs/sign1.jpg)\n\nThen scan the QR code with the wallet app:\n\n![Sign 2](docs/sign2.jpg)\n\nOnce accepted, you signature will be put into the agreement. If all parties finished signing, the doc is signed:\n\n![Signed 1](docs/signed1.jpg)\n\n### Step 4 (anyone): Verify the contract in the chain\n\nThen anyone can check the signatures on the chain:\n\n![Signed 2](docs/signed2.jpg)\n\nWe could make this view much better later on.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farcblock%2Fblock-contract","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farcblock%2Fblock-contract","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farcblock%2Fblock-contract/lists"}