https://github.com/dltcollab/raam.client.js
IOTA-based messaging protocol, allowing access of arbitrary messages in O(1)
https://github.com/dltcollab/raam.client.js
blockchain iota m2m messaging tangle
Last synced: 6 months ago
JSON representation
IOTA-based messaging protocol, allowing access of arbitrary messages in O(1)
- Host: GitHub
- URL: https://github.com/dltcollab/raam.client.js
- Owner: DLTcollab
- License: isc
- Created: 2019-05-28T19:10:08.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2020-09-04T01:21:53.000Z (over 5 years ago)
- Last Synced: 2025-01-12T00:14:50.253Z (over 1 year ago)
- Topics: blockchain, iota, m2m, messaging, tangle
- Language: JavaScript
- Size: 77.1 KB
- Stars: 1
- Watchers: 9
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# RAAM - Random Access Authenticated Messaging
RAAM is a second layer data communication protocol for IOTA, enabling protected
data stream access and publishing, organized in so called channels.
RAAM uses the same quantum-resistant signature scheme and hash function used in IOTA to sign transactions.
These techniques enable the construction of secure data channels providing data integrity and
authorship authentication. Furthermore the data is encrypted and, hence it is stored on the tangle,
immutable. By using optional passwords for a channel or for specific messages reading access can be limited
to a specific private audience. RAAM can be used without any changes to IOTA nodes. Each message strenthens
the IOTA network, because RAAM messages at their core are a set of zero-value transactions, confirming other
transactions on the tangle.
The messages in a channel do not have to be accessed from first to last, but can be accessed in any random order in O(1).
For that only the channel id and the index of the message are needed.
**Features**
- [x] indexed messages
- [x] access of arbitrary messages in O(1)
- [x] authentication (proof of authorship) and spam protection of channels
- [x] 4 different security levels
- [x] private mode with channel password
- [x] public mode with finding messages by address
- [x] encrypting different messages with different passwords
- [x] subscribing to new messages in channel
- [x] constructing messages and publishing them later
- [x] channel branching
RAAM enables messaging for a variety of use cases which need privacy and integrity for data communication. This includes
M2M communication for the IoT in consumer electronics as well as in machines in industrial contexts, such as
autonomous data marketplaces, supply chains, mobility and smart cities.
This JavaScript library acts as a reference implementation showcasing the specified abilities of the protocol.
## Basic usage
After downloading and importing the library into your project it will provide access to all functions for reading and
writing from/to RAAM channels.
**Generating a new channel and publishing a message**
```js
const RAAM = require('raam.client.js');
const iota = require('@iota/core').composeAPI({
provider: 'https://node.deviceproof.org'
});
const seed = "DONTGIVEYOURSEEDTOANYBODYELSEDONTGIVEYOURSEEDTOANYBODYELSEDONTGIVEYOURSEEDTOANYBODYELSE";
(async () => {
try {
const raam = await RAAM.fromSeed(seed, { security: 1, height: 4, iota });
await raam.publish("HELLOIOTA");
} catch (e) {
console.error(e);
}
})();
```
**Reading from a channel**
```js
const { RAAMReader } = require('raam.client.js');
const iota = require('@iota/core').composeAPI({
provider: 'https://node.deviceproof.org',
});
const channelId = "Y9FFZOE9VAOJYBMBISYDMZDWVO9ITKX9WPKUN9AESERDXLHZFAQRNJLNH9QERJWFHFFRLNO9ODSTOAVOW";
const raam = new RAAMReader(channelId, { iota });
(async () => {
try {
let response = await raam.fetch({start: 0, end: 2});
console.log(response.messages);
} catch (e) {
console.error(e);
}
})();
```
Take a look at the [API Reference](docs/api.md) to learn more.
## How it works
Due to Winternitz one time signature scheme used in IOTA, you need multiple signing keys for multiple messages.
A reader can verify the integrity of a message by using the verifying key included in the message.
A reader can also verify, that a message has the same author than all other messages in the channel, which
is called authentication. For that, RAAM uses a Merkle tree signing scheme, where the verifying keys of all messages in
a channel are the leafs of the tree. From all verifying keys the root of the tree, the Merkle root, is constructed, which
acts as the id for a RAAM channel.
Therefore, someone who publishes a message in a RAAM channel must not only possess the key that signed this message,
but all other signing keys for the channel as well. To authenticate the authorship of a message the Merkle root is
reconstructed by using the verifying key of the message and other parts of the tree, which are provided aswell.
Since the Merkle root is generated by hashing, it is impossible to reconstruct certain leafs (verifying keys) from
a given Merkle root, the same way it is impossible to forge a signing key from a given verifying key. This way it is easy
to ensure that two different messages in the same channel belong to the same author.
Because of that the maximum amount of messages that can be published in a channel depends on the size of a Merkle tree,
which has to be created in advance.