node.js software with substrate blockchain sensors data collector function!
Required. Docker must be installed.
You need to run the following command
mkdir config
curl -o ./config/agents.json https://raw.githubusercontent.com/airalab/RoSeMAN/master/config/agents.template.json
curl -o ./config/config.json https://raw.githubusercontent.com/airalab/RoSeMAN/master/config/config.template.jsonMake a white list of addresses, parachane accounts, from which we will collect data in the /config/agents.json file.
If necessary, change the configuration file /config/config.json.
Create a docker-compose.yml file with content
version: "3.8"
services:
app:
container_name: roseman_app
image: vol4/roseman
ports:
- "3000:3000"
volumes:
- ./config:/app/config
depends_on:
- mongo
mongo:
container_name: mongo
image: mongo
Run server
docker compose up -dWeb server launched at http://127.0.0.1:3000
As a user client, you can connect this service to sensors map.
You need to clone the repository.
$ git clone https://github.com/airalab/RoSeMAN.gitCreate configuration files.
$ cp config/config.template.json config.json
$ cp config/agents.template.json agents.json!!! The work requires the Mongodb Database server.
If necessary, change access to the database in the configuration file /config/config.json.
Make a white list of addresses, parachane accounts, from which we will collect data in the /config/agents.json file.
Install requirements.
$ yarn install$ yarn build$ yarn startWeb server launched at http://127.0.0.1:3000
RoSeMAN indexer supports indexing data from different Substrate-based chains (e.g. Robonomics parachains on Polkadot or Kusama).
Configuration is done in the file:
src/indexer/index.js
You need to call the chain() function with appropriate parameters for each network you want to index.
chain(
config.CHAIN_API_POLKADOT,
CHAIN_NAME.POLKADOT,
start,
{
extrinsic: ["datalog", "rws", "digitalTwin/setSource"],
event: ["datalog/NewRecord", "digitalTwin/TopicChanged"],
},
{
rws: [rwsOwner, sensors, dtwin],
datalog: [sensors],
"digitalTwin/setSource": [dtwin],
},
async (block) => {
await LastBlock.updateOne(
{ chain: CHAIN_NAME.POLKADOT },
{ block: block }
).exec();
rosemanBlockRead.set({ chain: "robonomics" }, block);
}
);chain(
config.CHAIN_API_KUSAMA,
CHAIN_NAME.KUSAMA,
start,
{ extrinsic: ["datalog"], event: ["datalog/NewRecord"] },
{ rws: [rwsOwner, sensors], datalog: [sensors] },
async (block) => {
await LastBlock.updateOne(
{ chain: CHAIN_NAME.KUSAMA },
{ block: block }
).exec();
rosemanBlockRead.set({ chain: "robonomics" }, block);
}
);Tip: Most often you need only one chain() call active. Comment out or remove the block for the chain you don't want to index at the moment.
After changing the code → restart the indexer.
As a user client, you can connect this service to sensors map.