Private layer

Create an event chain

1
const chain = account.createEventChain(); // Creates an empty event chain with a valid id and last hash
Copied!

Create and sign an event and add it to an existing event chain

1
const EventChain = require('lto-api').EventChain;
2
const Event = require('lto-api').Event;
3
4
const body = {
5
"$schema": "http://specs.livecontracts.io/01-draft/12-comment/schema.json#",
6
"identity": {
7
"$schema": "http://specs.livecontracts.io/01-draft/02-identity/schema.json#",
8
"id": "1bb5a451-d496-42b9-97c3-e57404d2984f"
9
},
10
"content_media_type": "text/plain",
11
"content": "Hello world!"
12
};
13
14
const chain = new EventChain('JEKNVnkbo3jqSHT8tfiAKK4tQTFK7jbx8t18wEEnygya');
15
16
chain.addEvent(new Event(body).signWith(account));
Copied!
Last modified 6mo ago