Adding human readable terms to Solidity contracts
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
app
contracts
environments
terms
test
.gitignore
LICENSE.txt
README.md
package.json
toolkit.js
truffle.js

README.md

Ricardian Contracts for Solidity

A simple abstract contract for implementing Ricardian contracts as part of a SmartContract.

In this case there is a an offerer, which is initially the address creating the contract.

  • The offerer creates a contract like a terms of service and uploads it to IPFS.
  • The resulting ipfs hash is added to the contract using the changeContract function
  • At this point the contract is considered active
  • Other parties can call the accept() function providing the same ipfs hash
  • This is recorded as an acceptance of the contract by the msg.sender
  • The contract author can mark functions as hasAccepted, which means that they are only allowed to be used by parties who have accepted the agreement

Changing the contract

The offerer can change the agreement using the same changeContract function

To force parties to accept the new agreement, a modifier hasAcceptedLatest can be used on functions

Running example:

You need a local ipfs node running at the moment or change code in app.js to point at a public one.

Install truffle and testrpc

npm install -g truffle
npm install -g ethereumjs-testrpc

In a terminal start testrpc:

testrpc

In another terminal install the contract and run the server:

truffle deploy
truffle serve

Try it out