init

Init

Web Contract to init a ledger

Documentation


GitHub license npm npm Github Stars

⚡️ Introduction

Init is a web contract to init a ledger

Data Model

Wallet

{
 "@type": "Wallet",
 "webledger": "./webledger.json",
 "webcredits": "./webcredits.json",
 "currency": "Mark"
}

Web Credit

Here is a full example of a Web Credits Object

{
  "@id": "urn:cuid:a74xt3jbin",
  "@type": "Credit",
  "source": "https://melvincarvalho.com/#me"
  "amount": 100,
  "currency": "Mark",
  "destination": "http://webr3.org/nathan#me",
  "description": "for technical help",
  "context": "https://github.com/project-bitmark/bitmark",
  "timestamp": 1640111035
}

Web Ledger

A web ledger in this case can be derived from the credit object

Both the webledger and the web credits will appear as JSON in the webcredits directory, which is in the .gitignore so that it can be a separate entity

Web Contract

The Web Contract is a single file that operates on the webcredits data store and is described here

Signing

Currently signing is done out of band using the gitmark protocol, but explicit signing will be added, in future

✍️ API

init.js

The following switches are allowed

--id          # the id for the wallet object
--currency    # the currency
--walletFile  # the wallet file
--creditFile  # the webcredits file
--ledgerFile  # the webledgers file
--indir       # the webcredits directory, defaults to ./webcredits

or from npm

import init from 'webcontracts-init'

var wallet = {
  id: data.id,
  currency: data.currency
}

function init(wallet, indir, walletFile, ledgerFile, creditsFile)

indir, infile, walletFile, ledgerFile and creditsFile are optional and will default to ../webcredits/webcredits.json

⚖️ License