Skip to content

Commit

Permalink
Started the Hotmoka nodes based on Mokamint
Browse files Browse the repository at this point in the history
  • Loading branch information
spoto committed Jun 14, 2024
1 parent bd4df63 commit 67ec6dd
Show file tree
Hide file tree
Showing 20 changed files with 424 additions and 102 deletions.
51 changes: 51 additions & 0 deletions io-hotmoka-node-mokamint-api/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<artifactId>io-hotmoka-node-mokamint-api</artifactId>
<packaging>jar</packaging>
<name>io-hotmoka-node-mokamint-api</name>
<version>${hotmoka.version}</version>
<description>This module defines the API of Hotmoka nodes running over the Mokamint engine. They can be used to build an actual blockchain network based on proof of space.</description>

<parent>
<groupId>io.hotmoka</groupId>
<artifactId>hotmoka</artifactId>
<version>parent</version>
</parent>

<dependencies>
<dependency>
<groupId>io.hotmoka</groupId>
<artifactId>io-hotmoka-node-local-api</artifactId>
<version>${hotmoka.version}</version>
</dependency>
<dependency>
<groupId>io.hotmoka</groupId>
<artifactId>io-hotmoka-node-api</artifactId>
<version>${hotmoka.version}</version>
</dependency>
<dependency>
<groupId>io.hotmoka.annotations</groupId>
<artifactId>io-hotmoka-annotations</artifactId>
<version>${io.hotmoka.annotations.version}</version>
</dependency>
</dependencies>

<profiles>
<profile>
<id>release</id>
<build>
<plugins>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<configuration>
<skipNexusStagingDeployMojo>false</skipNexusStagingDeployMojo>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
Copyright 2024 Fausto Spoto
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package io.hotmoka.node.mokamint.api;

import io.hotmoka.annotations.ThreadSafe;
import io.hotmoka.node.local.api.LocalNode;

/**
* A node of a blockchain that relies on the Mokamint engine.
*/
@ThreadSafe
public interface MokamintNode extends LocalNode<MokamintNodeConfig> {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
Copyright 2024 Fausto Spoto
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package io.hotmoka.node.mokamint.api;

import io.hotmoka.annotations.Immutable;
import io.hotmoka.node.local.api.LocalNodeConfig;

/**
* The configuration of a Mokamint node.
*/
@Immutable
public interface MokamintNodeConfig extends LocalNodeConfig<MokamintNodeConfig, MokamintNodeConfigBuilder> {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
Copyright 2024 Fausto Spoto
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package io.hotmoka.node.mokamint.api;

import io.hotmoka.node.local.api.LocalNodeConfigBuilder;

/**
* The builder of a configuration of a Mokamint node.
*/
public interface MokamintNodeConfigBuilder extends LocalNodeConfigBuilder<MokamintNodeConfig, MokamintNodeConfigBuilder> {
}
27 changes: 27 additions & 0 deletions io-hotmoka-node-mokamint-api/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
Copyright 2024 Fausto Spoto
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

/**
* This module defines the API of Hotmoka nodes running over the Mokamint engine.
* They can be used to build an actual blockchain network based on proof of space.
*/
module io.hotmoka.node.mokamint.api {
exports io.hotmoka.node.mokamint.api;

requires io.hotmoka.annotations;
requires io.hotmoka.node.api;
requires io.hotmoka.node.local.api;
}
57 changes: 57 additions & 0 deletions io-hotmoka-node-mokamint/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<artifactId>io-hotmoka-node-mokamint</artifactId>
<packaging>jar</packaging>
<name>io-hotmoka-node-mokamint</name>
<version>${hotmoka.version}</version>
<description>This module implements Hotmoka nodes based on the Mokamint proof of space engine.</description>

<parent>
<groupId>io.hotmoka</groupId>
<artifactId>hotmoka</artifactId>
<version>parent</version>
</parent>

<dependencies>
<dependency>
<groupId>io.hotmoka</groupId>
<artifactId>io-hotmoka-node-mokamint-api</artifactId>
<version>${hotmoka.version}</version>
</dependency>
<dependency>
<groupId>io.hotmoka</groupId>
<artifactId>io-hotmoka-node-local</artifactId>
<version>${hotmoka.version}</version>
</dependency>
<dependency>
<groupId>io.hotmoka</groupId>
<artifactId>io-takamaka-code-constants</artifactId>
<version>${io.takamaka.code.version}</version>
</dependency>
<dependency>
<groupId>io.hotmoka.annotations</groupId>
<artifactId>io-hotmoka-annotations</artifactId>
<version>${io.hotmoka.annotations.version}</version>
</dependency>
</dependencies>

<profiles>
<profile>
<id>release</id>
<build>
<plugins>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<configuration>
<skipNexusStagingDeployMojo>false</skipNexusStagingDeployMojo>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
Copyright 2024 Fausto Spoto
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package io.hotmoka.node.mokamint;

import io.hotmoka.node.api.NodeException;
import io.hotmoka.node.mokamint.api.MokamintNode;
import io.hotmoka.node.mokamint.api.MokamintNodeConfig;

/**
* Providers of blockchain nodes that rely on the Mokamint proof of space engine.
*/
public abstract class MokamintNodes {

private MokamintNodes() {}

/**
* Creates and starts a node with a brand new store, of a blockchain based on Mokamint.
* It spawns the Mokamint engine with an application for handling its transactions.
*
* @param config the configuration of the blockchain
* @return the Mokamint node
* @throws InterruptedException if the current thread is interrupted before completing the operation
* @throws NodeException if the operation cannot be completed correctly
*/
public static MokamintNode init(MokamintNodeConfig config) throws NodeException, InterruptedException {
return null; //new TendermintNodeImpl(config, true);
}

/**
* Starts a Mokamint node that uses an already existing store. The consensus
* parameters are recovered from the manifest in the store, hence the store must
* be that of an already initialized blockchain. It spawns the Mokamint engine
* and connects it to an application for handling its transactions.
*
* @param config the configuration of the blockchain
* @return the Mokamint node
* @throws InterruptedException if the current thread is interrupted before completing the operation
* @throws NodeException if the operation cannot be completed correctly
*/
public static MokamintNode resume(MokamintNodeConfig config) throws NodeException, InterruptedException {
return null; //new TendermintNodeImpl(config, false);
}
}
29 changes: 29 additions & 0 deletions io-hotmoka-node-mokamint/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
Copyright 2024 Fausto Spoto
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

/**
* This module implements Hotmoka nodes running over the Mokamint engine.
* They can be used to build an actual blockchain network based on proof of space.
*/
module io.hotmoka.node.mokamint {
exports io.hotmoka.node.mokamint;
//exports io.hotmoka.node.mokamint.internal.beans to com.google.gson;

requires transitive io.hotmoka.node.mokamint.api;
requires transitive io.hotmoka.node.api;
requires io.hotmoka.annotations;
requires java.logging;
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import io.hotmoka.node.local.api.LocalNodeConfig;

/**
* The configuration of a Tendermint blockchain.
* The configuration of a Tendermint node.
*/
@Immutable
public interface TendermintNodeConfig extends LocalNodeConfig<TendermintNodeConfig, TendermintNodeConfigBuilder> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import io.hotmoka.node.local.api.LocalNodeConfigBuilder;

/**
* The builder of a configuration of a Tendermint blockchain.
* The builder of a configuration of a Tendermint node.
*/
public interface TendermintNodeConfigBuilder extends LocalNodeConfigBuilder<TendermintNodeConfig, TendermintNodeConfigBuilder> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class TendermintNodeConfigImpl extends AbstractLocalNodeConfig<Tendermint
* if a brand new Tendermint blockchain is created.
* That configuration will then be used for the execution of Tendermint.
* This might be missing, in which case a default Tendermint configuration is created,
* with the same node as single validator. It defaults to {@code null}.
* with the same node as single validator. It defaults to empty.
*/
public final Optional<Path> tendermintConfigurationToClone;

Expand Down
Loading

0 comments on commit 67ec6dd

Please sign in to comment.