* release/1.4.0: upgraded bft-mart module; upgraded version of core module and bft-smart module; modify sdk version, compile, import package error optimized the default values of bftsmart.config; upgraded version of kvdb; upgraded versions of submodules; upgraded the version of core; upgraded version to 1.4.0.RELEASE; fix deactive node command line error fix shell error modify version to 1.4.0 release, and add miss code init release 1.4.0; Update repo.sh Update repo.sh Fix remote config error in the first time. Renamed the types in ledger database for more appropriate expression; completed extracting crypto data types as interface; upgraded framework and core; updated framework; # Conflicts: # deploy/deploy-peer/src/main/resources/scripts/active-parti.sh # deploy/deploy-peer/src/main/resources/scripts/deactive-parti.sh # explorer # samples/pom.xml # samples/sdk-samples/src/main/java/com/jd/blockchain/sdk/samples/SDKDemo_Tx_Persistance.java # samples/sdk-samples/src/main/java/com/jd/blockchain/sdk/samples/SDK_InsertData_Demo.java # samples/sdk-samples/src/test/java/test/com/jd/blockchain/sdk/test/SDK_Contract_Test.java # samples/sdk-samples/src/test/java/test/com/jd/blockchain/sdk/test/SDK_GateWay_BatchInsertData_Test_.javatags/1.4.0^2
@@ -1,4 +1,3 @@ | |||||
#调用当前脚本目录下 env.sh 脚本,设置环境变量,处理当前传入参数; | #调用当前脚本目录下 env.sh 脚本,设置环境变量,处理当前传入参数; | ||||
if [ ! $ENV_SHELL ] | if [ ! $ENV_SHELL ] | ||||
then | then | ||||
@@ -103,6 +102,10 @@ do | |||||
cd $BASE_DIR | cd $BASE_DIR | ||||
done | done | ||||
#首次执行同步更新子模块的远程仓库 origin 的地址会将主项目地址更改,以下操作确保主项目远程仓库地址正确 | |||||
git config remote.origin.url $REMOTE_ORIGIN_URL | |||||
git config remote.origin.pushurl $REMOTE_ORIGIN_URL | |||||
#检查是否要跳过子模块更新环节; | #检查是否要跳过子模块更新环节; | ||||
if [ $SKIP_SUBMODULES_UPDATE == 1 ] | if [ $SKIP_SUBMODULES_UPDATE == 1 ] | ||||
then | then | ||||
@@ -5,7 +5,7 @@ | |||||
<parent> | <parent> | ||||
<groupId>com.jd.blockchain</groupId> | <groupId>com.jd.blockchain</groupId> | ||||
<artifactId>deploy-root</artifactId> | <artifactId>deploy-root</artifactId> | ||||
<version>1.4.0-SNAPSHOT</version> | |||||
<version>1.4.0.RELEASE</version> | |||||
</parent> | </parent> | ||||
<artifactId>deploy-gateway</artifactId> | <artifactId>deploy-gateway</artifactId> | ||||
@@ -3,23 +3,23 @@ | |||||
<dependency> | <dependency> | ||||
<groupId>com.jd.blockchain</groupId> | <groupId>com.jd.blockchain</groupId> | ||||
<artifactId>sdk-client</artifactId> | <artifactId>sdk-client</artifactId> | ||||
<version>1.3.0.RELEASE</version> | |||||
<version>1.4.0.RELEASE</version> | |||||
</dependency> | </dependency> | ||||
<dependency> | <dependency> | ||||
<groupId>com.jd.blockchain</groupId> | <groupId>com.jd.blockchain</groupId> | ||||
<artifactId>contract-starter</artifactId> | <artifactId>contract-starter</artifactId> | ||||
<version>1.3.0.RELEASE</version> | |||||
<version>1.4.0.RELEASE</version> | |||||
</dependency> | </dependency> | ||||
<dependency> | <dependency> | ||||
<groupId>com.jd.blockchain</groupId> | <groupId>com.jd.blockchain</groupId> | ||||
<artifactId>crypto-classic</artifactId> | <artifactId>crypto-classic</artifactId> | ||||
<version>1.3.0.RELEASE</version> | |||||
<version>1.4.0.RELEASE</version> | |||||
</dependency> | </dependency> | ||||
<dependency> | <dependency> | ||||
<groupId>com.jd.blockchain</groupId> | <groupId>com.jd.blockchain</groupId> | ||||
<artifactId>crypto-sm</artifactId> | <artifactId>crypto-sm</artifactId> | ||||
<version>1.3.0.RELEASE</version> | |||||
<version>1.4.0.RELEASE</version> | |||||
</dependency> | </dependency> | ||||
``` | ``` | ||||
# 2. 数据快速上链 | # 2. 数据快速上链 | ||||
@@ -5,7 +5,7 @@ | |||||
<parent> | <parent> | ||||
<groupId>com.jd.blockchain</groupId> | <groupId>com.jd.blockchain</groupId> | ||||
<artifactId>deploy-root</artifactId> | <artifactId>deploy-root</artifactId> | ||||
<version>1.4.0-SNAPSHOT</version> | |||||
<version>1.4.0.RELEASE</version> | |||||
</parent> | </parent> | ||||
<artifactId>deploy-peer</artifactId> | <artifactId>deploy-peer</artifactId> | ||||
@@ -57,6 +57,12 @@ system.server.3.network.secure=false | |||||
#Specify if the communication system should use a thread to send data (true or false) | #Specify if the communication system should use a thread to send data (true or false) | ||||
system.communication.useSenderThread = false | system.communication.useSenderThread = false | ||||
#The time interval for retrying to send message after connection failure. In milliseconds; | |||||
system.communication.send.retryInterval=2000 | |||||
#The number of retries to send message after connection failure. | |||||
system.communication.send.retryCount=100 | |||||
#Force all processes to use the same public/private keys pair and secret key. This is useful when deploying experiments | #Force all processes to use the same public/private keys pair and secret key. This is useful when deploying experiments | ||||
#and benchmarks, but must not be used in production systems. | #and benchmarks, but must not be used in production systems. | ||||
system.communication.defaultkeys = true | system.communication.defaultkeys = true | ||||
@@ -1,6 +1,6 @@ | |||||
# JDChain安装部署指南 | # JDChain安装部署指南 | ||||
本部署指南基于JDChain1.3.0.RELEASE版本来构建。 | |||||
本部署指南基于JDChain1.4.0.RELEASE版本来构建。 | |||||
## 1. 部署环境 | ## 1. 部署环境 | ||||
### 1.1 系统部署结构 | ### 1.1 系统部署结构 | ||||
![部署结构](imgs/structure.png) | ![部署结构](imgs/structure.png) | ||||
@@ -1,6 +1,6 @@ | |||||
#!/bin/bash | #!/bin/bash | ||||
OME=$(cd `dirname $0`;cd ../; pwd) | |||||
HOME=$(cd `dirname $0`;cd ../; pwd) | |||||
boot_file=$(ls ../libs | grep tools-activeparti-booter-) | boot_file=$(ls ../libs | grep tools-activeparti-booter-) | ||||
if [ ! -n "$boot_file" ]; then | if [ ! -n "$boot_file" ]; then | ||||
echo "tools-activeparti-booter is null" | echo "tools-activeparti-booter is null" | ||||
@@ -1,6 +1,6 @@ | |||||
#!/bin/bash | #!/bin/bash | ||||
OME=$(cd `dirname $0`;cd ../; pwd) | |||||
HOME=$(cd `dirname $0`;cd ../; pwd) | |||||
boot_file=$(ls ../libs | grep tools-deactiveparti-booter-) | boot_file=$(ls ../libs | grep tools-deactiveparti-booter-) | ||||
if [ ! -n "$boot_file" ]; then | if [ ! -n "$boot_file" ]; then | ||||
echo "tools-deactiveparti-booter is null" | echo "tools-deactiveparti-booter is null" | ||||
@@ -9,11 +9,11 @@ | |||||
<relativePath>../project/parent</relativePath> | <relativePath>../project/parent</relativePath> | ||||
</parent> | </parent> | ||||
<artifactId>deploy-root</artifactId> | <artifactId>deploy-root</artifactId> | ||||
<version>1.4.0-SNAPSHOT</version> | |||||
<version>1.4.0.RELEASE</version> | |||||
<packaging>pom</packaging> | <packaging>pom</packaging> | ||||
<properties> | <properties> | ||||
<core.version>1.4.0-SNAPSHOT</core.version> | |||||
<core.version>1.4.0.RELEASE</core.version> | |||||
</properties> | </properties> | ||||
<modules> | <modules> | ||||
@@ -1 +1 @@ | |||||
Subproject commit caeda28790884979c2353d632b60de3c265a27be | |||||
Subproject commit 1c5019d56e538d1744f53d35593ed1d6a3a75dce |
@@ -5,7 +5,7 @@ | |||||
<groupId>com.jd.blockchain</groupId> | <groupId>com.jd.blockchain</groupId> | ||||
<artifactId>jdchain-root</artifactId> | <artifactId>jdchain-root</artifactId> | ||||
<version>1.2.1.RELEASE</version> | |||||
<version>1.4.0.RELEASE</version> | |||||
<packaging>pom</packaging> | <packaging>pom</packaging> | ||||
<description>jdchain root project</description> | <description>jdchain root project</description> | ||||
@@ -6,7 +6,7 @@ | |||||
<parent> | <parent> | ||||
<groupId>com.jd.blockchain</groupId> | <groupId>com.jd.blockchain</groupId> | ||||
<artifactId>jdchain-samples</artifactId> | <artifactId>jdchain-samples</artifactId> | ||||
<version>1.2.1.RELEASE</version> | |||||
<version>1.4.0.RELEASE</version> | |||||
</parent> | </parent> | ||||
<artifactId>contract-samples</artifactId> | <artifactId>contract-samples</artifactId> | ||||
@@ -11,11 +11,11 @@ | |||||
<groupId>com.jd.blockchain</groupId> | <groupId>com.jd.blockchain</groupId> | ||||
<artifactId>jdchain-samples</artifactId> | <artifactId>jdchain-samples</artifactId> | ||||
<version>1.2.1.RELEASE</version> | |||||
<version>1.4.0.RELEASE</version> | |||||
<packaging>pom</packaging> | <packaging>pom</packaging> | ||||
<properties> | <properties> | ||||
<framework.version>1.3.1-SNAPSHOT</framework.version> | |||||
<framework.version>1.4.0.RELEASE</framework.version> | |||||
</properties> | </properties> | ||||
<modules> | <modules> | ||||
@@ -52,6 +52,11 @@ | |||||
<artifactId>crypto-sm</artifactId> | <artifactId>crypto-sm</artifactId> | ||||
<version>${framework.version}</version> | <version>${framework.version}</version> | ||||
</dependency> | </dependency> | ||||
<dependency> | |||||
<groupId>com.jd.blockchain</groupId> | |||||
<artifactId>crypto-base</artifactId> | |||||
<version>${framework.version}</version> | |||||
</dependency> | |||||
</dependencies> | </dependencies> | ||||
</dependencyManagement> | </dependencyManagement> | ||||
@@ -5,7 +5,7 @@ | |||||
<parent> | <parent> | ||||
<groupId>com.jd.blockchain</groupId> | <groupId>com.jd.blockchain</groupId> | ||||
<artifactId>jdchain-samples</artifactId> | <artifactId>jdchain-samples</artifactId> | ||||
<version>1.2.1.RELEASE</version> | |||||
<version>1.4.0.RELEASE</version> | |||||
</parent> | </parent> | ||||
<artifactId>sdk-samples</artifactId> | <artifactId>sdk-samples</artifactId> | ||||
@@ -35,6 +35,31 @@ | |||||
<artifactId>contract-samples</artifactId> | <artifactId>contract-samples</artifactId> | ||||
<version>${project.version}</version> | <version>${project.version}</version> | ||||
</dependency> | </dependency> | ||||
<dependency> | |||||
<groupId>com.jd.blockchain</groupId> | |||||
<artifactId>crypto-base</artifactId> | |||||
<version>1.4.0.RELEASE</version> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>com.jd.blockchain</groupId> | |||||
<artifactId>crypto-framework</artifactId> | |||||
<version>${framework.version}</version> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>com.jd.blockchain</groupId> | |||||
<artifactId>crypto-classic</artifactId> | |||||
<version>${framework.version}</version> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>com.jd.blockchain</groupId> | |||||
<artifactId>crypto-sm</artifactId> | |||||
<version>${framework.version}</version> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>com.jd.blockchain</groupId> | |||||
<artifactId>crypto-utils-classic</artifactId> | |||||
<version>${framework.version}</version> | |||||
</dependency> | |||||
</dependencies> | </dependencies> | ||||
<build> | <build> | ||||
@@ -7,20 +7,20 @@ import java.io.File; | |||||
public class SDKDemo_Constant { | public class SDKDemo_Constant { | ||||
public static final String GW_IPADDR = "127.0.0.1"; | |||||
public static final String GW_IPADDR = "jdchain-cloud0-8080.jdfmgt.com"; | |||||
// public static final String GW_IPADDR = "192.168.151.41"; | // public static final String GW_IPADDR = "192.168.151.41"; | ||||
public static final int GW_PORT = 11000; | |||||
public static final int GW_PORT = 80; | |||||
// public static final int GW_PORT = 18081; | // public static final int GW_PORT = 18081; | ||||
public static final String[] PUB_KEYS = { | public static final String[] PUB_KEYS = { | ||||
"3snPdw7i7PjVKiTH2VnXZu5H8QmNaSXpnk4ei533jFpuifyjS5zzH9", | |||||
"3snPdw7i7Pf2u9KTNUhxrYxgEymH24zP3NNNauRVwX5yDD6rzu2uBY", | |||||
"3snPdw7i7PajLB35tEau1kmixc6ZrjLXgxwKbkv5bHhP7nT5dhD9eX", | "3snPdw7i7PajLB35tEau1kmixc6ZrjLXgxwKbkv5bHhP7nT5dhD9eX", | ||||
"3snPdw7i7PZi6TStiyc6mzjprnNhgs2atSGNS8wPYzhbKaUWGFJt7x", | "3snPdw7i7PZi6TStiyc6mzjprnNhgs2atSGNS8wPYzhbKaUWGFJt7x", | ||||
"3snPdw7i7PifPuRX7fu3jBjsb3rJRfDe9GtbDfvFJaJ4V4hHXQfhwk"}; | "3snPdw7i7PifPuRX7fu3jBjsb3rJRfDe9GtbDfvFJaJ4V4hHXQfhwk"}; | ||||
public static final String[] PRIV_KEYS = { | public static final String[] PRIV_KEYS = { | ||||
"177gjzHTznYdPgWqZrH43W3yp37onm74wYXT4v9FukpCHBrhRysBBZh7Pzdo5AMRyQGJD7x", | |||||
"177gjy71kcL5pU2YayqeZ44AfE87o8b5PfLeBER1rjsjViGux3TzdLcQs7QEznRMCw2sAHD", | |||||
"177gju9p5zrNdHJVEQnEEKF4ZjDDYmAXyfG84V5RPGVc5xFfmtwnHA7j51nyNLUFffzz5UT", | "177gju9p5zrNdHJVEQnEEKF4ZjDDYmAXyfG84V5RPGVc5xFfmtwnHA7j51nyNLUFffzz5UT", | ||||
"177gjtwLgmSx5v1hFb46ijh7L9kdbKUpJYqdKVf9afiEmAuLgo8Rck9yu5UuUcHknWJuWaF", | "177gjtwLgmSx5v1hFb46ijh7L9kdbKUpJYqdKVf9afiEmAuLgo8Rck9yu5UuUcHknWJuWaF", | ||||
"177gk1pudweTq5zgJTh8y3ENCTwtSFsKyX7YnpuKPo7rKgCkCBXVXh5z2syaTCPEMbuWRns"}; | "177gk1pudweTq5zgJTh8y3ENCTwtSFsKyX7YnpuKPo7rKgCkCBXVXh5z2syaTCPEMbuWRns"}; | ||||
@@ -84,7 +84,7 @@ public class SDKDemo_Tx_Persistance { | |||||
TransactionContent txContent = BinaryProtocol.decode(txContentBytes, TransactionContent.class); | TransactionContent txContent = BinaryProtocol.decode(txContentBytes, TransactionContent.class); | ||||
// 对交易内容签名; | // 对交易内容签名; | ||||
DigitalSignature signature1 = SignatureUtils.sign(keyPair1.getAlgorithm(),txContent, keyPair1); | |||||
DigitalSignature signature1 = SignatureUtils.sign(keyPair1.getAlgorithm(), txContent, keyPair1); | |||||
// 根据交易内容重新准备交易; | // 根据交易内容重新准备交易; | ||||
PreparedTransaction decodedPrepTx = blockchainService.prepareTransaction(txContent); | PreparedTransaction decodedPrepTx = blockchainService.prepareTransaction(txContent); | ||||
@@ -48,4 +48,9 @@ public abstract class SDK_Base_Demo { | |||||
ptx.sign(adminKey); | ptx.sign(adminKey); | ||||
return ptx.commit(); | return ptx.commit(); | ||||
} | } | ||||
protected void printTxResponse(TransactionResponse response) { | |||||
System.out.printf("TxResponse's state = [%s][%s], blockHeight = [%s] ! \r\n", | |||||
response.isSuccess(), response.getExecutionState(), response.getBlockHeight()); | |||||
} | |||||
} | } |
@@ -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_ConsensusSettings_Update_Demo extends SDK_Base_Demo { | |||||
public static void main(String[] args) { | |||||
new SDK_ConsensusSettings_Update_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()); | |||||
} | |||||
} |
@@ -101,7 +101,7 @@ public class SDK_InsertData_Demo extends SDK_Base_Demo { | |||||
} | } | ||||
//根据交易的 hash 获得交易;注:客户端生成 PrepareTransaction 时得到交易hash; | //根据交易的 hash 获得交易;注:客户端生成 PrepareTransaction 时得到交易hash; | ||||
HashDigest txHash = txList[0].getTransactionHash(); | |||||
HashDigest txHash = txList[0].getRequest().getTransactionHash(); | |||||
// Transaction tx = blockchainService.getTransactionByContentHash(ledgerHash, txHash); | // Transaction tx = blockchainService.getTransactionByContentHash(ledgerHash, txHash); | ||||
// String[] objKeys = new String[] { "x001", "x002" }; | // String[] objKeys = new String[] { "x001", "x002" }; | ||||
// KVDataEntry[] kvData = blockchainService.getDataEntries(ledgerHash, commerceAccount, objKeys); | // KVDataEntry[] kvData = blockchainService.getDataEntries(ledgerHash, commerceAccount, objKeys); | ||||
@@ -299,8 +299,7 @@ public class SDK_Contract_Test { | |||||
} | } | ||||
private static HashDigest getLedgerHash() { | private static HashDigest getLedgerHash() { | ||||
byte[] addressBytes = Base58Utils.decode(ledgerAddress); | |||||
return new HashDigestBytes(DefaultCryptoEncoding.decodeAlgorithm(addressBytes), addressBytes); | |||||
return new HashDigestBytes(DefaultCryptoEncoding.decodeAlgorithm(Base58Utils.decode(ledgerAddress)), Base58Utils.decode(ledgerAddress)); | |||||
} | } | ||||
/** | /** | ||||
@@ -114,8 +114,7 @@ public class SDK_GateWay_BatchInsertData_Test_ { | |||||
} | } | ||||
private HashDigest getLedgerHash() { | private HashDigest getLedgerHash() { | ||||
byte[] hashBytes = Base58Utils.decode(ledgerHash); | |||||
return new HashDigestBytes(DefaultCryptoEncoding.decodeAlgorithm(hashBytes), hashBytes); | |||||
return new HashDigestBytes(DefaultCryptoEncoding.decodeAlgorithm(Base58Utils.decode(ledgerHash)), Base58Utils.decode(ledgerHash)); | |||||
} | } | ||||