Browse Source

add auto node shell

tags/1.4.0^2
zhangshuang 4 years ago
parent
commit
194ddb4e75
6 changed files with 91 additions and 1 deletions
  1. +1
    -1
      core
  2. +18
    -0
      deploy/deploy-peer/pom.xml
  3. +10
    -0
      deploy/deploy-peer/src/main/resources/scripts/active-parti.sh
  4. +10
    -0
      deploy/deploy-peer/src/main/resources/scripts/deactive-parti.sh
  5. +10
    -0
      deploy/deploy-peer/src/main/resources/scripts/reg-parti.sh
  6. +42
    -0
      samples/sdk-samples/src/main/java/com/jd/blockchain/sdk/samples/SDK_Update_ConsensusSettings_Demo.java

+ 1
- 1
core

@@ -1 +1 @@
Subproject commit 22a63e4fe85398a090f7e4abf99cd212549be70f
Subproject commit b5a9bd9155034260d8babebb6d8701c3627c226b

+ 18
- 0
deploy/deploy-peer/pom.xml View File

@@ -58,6 +58,24 @@
<version>${core.version}</version>
</dependency>

<dependency>
<groupId>com.jd.blockchain</groupId>
<artifactId>tools-regparti-booter</artifactId>
<version>${core.version}</version>
</dependency>

<dependency>
<groupId>com.jd.blockchain</groupId>
<artifactId>tools-activeparti-booter</artifactId>
<version>${core.version}</version>
</dependency>

<dependency>
<groupId>com.jd.blockchain</groupId>
<artifactId>tools-deactiveparti-booter</artifactId>
<version>${core.version}</version>
</dependency>

</dependencies>

<build>


+ 10
- 0
deploy/deploy-peer/src/main/resources/scripts/active-parti.sh View File

@@ -0,0 +1,10 @@
#!/bin/bash

OME=$(cd `dirname $0`;cd ../; pwd)
boot_file=$(ls ../libs | grep tools-activeparti-booter-)
if [ ! -n "$boot_file" ]; then
echo "tools-activeparti-booter is null"
else
echo "active participant"
java -jar $HOME/libs/$boot_file $*
fi

+ 10
- 0
deploy/deploy-peer/src/main/resources/scripts/deactive-parti.sh View File

@@ -0,0 +1,10 @@
#!/bin/bash

OME=$(cd `dirname $0`;cd ../; pwd)
boot_file=$(ls ../libs | grep tools-deactiveparti-booter-)
if [ ! -n "$boot_file" ]; then
echo "tools-deactiveparti-booter is null"
else
echo "deactive participant"
java -jar $HOME/libs/$boot_file $*
fi

+ 10
- 0
deploy/deploy-peer/src/main/resources/scripts/reg-parti.sh View File

@@ -0,0 +1,10 @@
#!/bin/bash

HOME=$(cd `dirname $0`;cd ../; pwd)
boot_file=$(ls ../libs | grep tools-regparti-booter-)
if [ ! -n "$boot_file" ]; then
echo "tools-regparti-booter is null"
else
echo "register new participant"
java -jar $HOME/libs/$boot_file $*
fi

+ 42
- 0
samples/sdk-samples/src/main/java/com/jd/blockchain/sdk/samples/SDK_Update_ConsensusSettings_Demo.java View File

@@ -0,0 +1,42 @@
package com.jd.blockchain.sdk.samples;

import com.jd.blockchain.ledger.PreparedTransaction;
import com.jd.blockchain.ledger.TransactionResponse;
import com.jd.blockchain.ledger.TransactionTemplate;
import com.jd.blockchain.utils.Property;

import java.util.ArrayList;
import java.util.List;

public class SDK_Update_ConsensusSettings_Demo extends SDK_Base_Demo {

public static void main(String[] args) {
new SDK_Update_ConsensusSettings_Demo().updateSettings();
}

public void updateSettings() {

List<Property> properties = new ArrayList<Property>();

// 修改bftsmart.conf配置文件中的选项;
properties.add(new Property("system.communication.useSenderThread", "false"));

Property[] propertiesArray = properties.toArray(new Property[properties.size()]);

TransactionTemplate txTpl = blockchainService.newTransaction(ledgerHash);

txTpl.settings().update(propertiesArray);

// TX 准备就绪;
PreparedTransaction prepTx = txTpl.prepare();

// 使用私钥进行签名;
prepTx.sign(adminKey);

// 提交交易;
TransactionResponse transactionResponse = prepTx.commit();

System.out.println(transactionResponse.isSuccess());

}
}

Loading…
Cancel
Save