blockchain , sdchain cpp sdk and demo
Dependencies: EthernetInterface mbed-rtos mbed uniqueCPUID
Fork of bcsdk by
Revision 18:ec6cd7cfe3f8, committed 2018-08-08
- Comitter:
- webmaster
- Date:
- Wed Aug 08 09:51:32 2018 +0800
- Parent:
- 17:58847aecad54
- Commit message:
- rm demo files
Changed in this revision
--- a/demo/Account_test.cpp Wed Aug 08 09:48:46 2018 +0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-/*
-帐户是恒为区块链核心平台中的一个对象,通过创建和跟踪控制程序来跟踪区块链上的资产的所有权。
-创建帐户时,您提供一个或多个“root”密钥和仲裁。
-
-创建帐户
-1
-输入帐户别名的名称(例如'alice','bob')
-
-帐户别名是用于区分帐户的标签。
-2
-键入名称以生成新的HSM密钥(例如'alice key','bob key')
-
-此密钥将用于此帐户中资产单位的发放和转移。
-3
-点击“提交”按钮
-*/
-
-#include "mbed.h"
-#include "EthernetInterface.h"
-//#include "SDFileSystem.h"
-#include <stdio.h>
-#include "uniqueCPUID.h"
-
-#include <iostream>
-#include <string>
-#include "UnitTest.h"
-//#include "BlockChain.h"
-#include "MockHsm.h"
-#include "Asset.h"
-#include "Transaction.h"
-#include "Account.h"
-#include "Key.h"
-
-
-void Account_test()
-{
- Key key;
- key.setAlias("t_key");
- key.listKeys();
-
- Account act(key);
- act.setAlias("t_acc_8");
- act.createAccount();
- act.listAccounts();
-
-}
\ No newline at end of file
--- a/demo/Asset_test.cpp Wed Aug 08 09:48:46 2018 +0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-/*
-资产是一种可以在区块链上发布的值类型。
-资产的所有单位均可互换,可以在各方之间直接交易,无需发行人参与。
-
-创建资产
-1
-键入资产别名的名称(例如'gold','silver','bronze')
-
-资产别名是用于区分资产的标签。
-2
-选择“ReKey”键以使用现有的HSM密键
-
-此密钥将用于此帐户中资产单位的发放和转移。
-3
-点击“提交”按钮
-*/
-#include "mbed.h"
-#include "EthernetInterface.h"
-//#include "SDFileSystem.h"
-#include <stdio.h>
-#include "uniqueCPUID.h"
-
-#include <iostream>
-#include <string>
-#include "UnitTest.h"
-//#include "BlockChain.h"
-#include "MockHsm.h"
-#include "Asset.h"
-#include "Transaction.h"
-#include "Account.h"
-#include "Key.h"
-
-
-void Asset_test()
-{
- Asset asset;
- asset.setAlias("t_asset_6");
-
- cout<< asset.createAsset() << endl;
- cout<< asset.listAssets() << endl;
-}
\ No newline at end of file
--- a/demo/Key_test.cpp Wed Aug 08 09:48:46 2018 +0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
-加密私钥是区块链上的主要授权机制。
-他们控制资产单位的发行和转让。 资产或帐户将定义发行或转移所需的单个密钥。
-
-创建HSM密钥
-1
-键入密钥别名的名称(例如'gold','silver','bronze')
-
-密钥别名是用于区分密钥的标签。
-*/
-#include "mbed.h"
-#include "EthernetInterface.h"
-//#include "SDFileSystem.h"
-#include <stdio.h>
-#include "uniqueCPUID.h"
-
-#include <iostream>
-#include <string>
-#include "UnitTest.h"
-//#include "BlockChain.h"
-#include "MockHsm.h"
-#include "Asset.h"
-#include "Transaction.h"
-#include "Account.h"
-#include "Key.h"
-
-
-void Key_test()
-{
- MockHsm mh;
- mh.setAlias("t_key_6");
- cout<<mh.getAlias()<<endl;
- cout<<mh.createKey()<<endl;
- cout<< mh.listKeys() <<endl;
-}
\ No newline at end of file
--- a/demo/Transaction_test.cpp Wed Aug 08 09:48:46 2018 +0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-/*
-交易包含一个或多个输入,以及一个或多个输出。
-恒为区块链核心平台的API允许您使用操作(包括发出,支出和返还)构建交易。
-发布资产单位
-1
-添加“发出”操作
-2
-为资产别名选择“ReAsset”
-3
-输入“100”作为金额
-4
-添加“使用帐户控制”操作
-5
-为帐户别名选择“ReAccount”
-6
-为资产别名选择“ReAsset”
-7
-输入“100”作为金额
-8
-点击“提交”按钮
-*/
-
-#include "mbed.h"
-#include "EthernetInterface.h"
-//#include "SDFileSystem.h"
-#include <stdio.h>
-#include "uniqueCPUID.h"
-
-#include <iostream>
-#include <string>
-#include "UnitTest.h"
-//#include "BlockChain.h"
-#include "MockHsm.h"
-#include "Asset.h"
-#include "Transaction.h"
-#include "Account.h"
-#include "Key.h"
-
-
-void Transaction_test()
-{
- vector<Actions> vActions;
- Actions act;
- MbedJSONValue reference_data;
-
- act.accounts_alias = "t_acc_1";
- act.amount = 51;
- act.asset_alias = "t_asset";
- act.reference_data = reference_data;
- act.type = "spend_account";
- vActions.push_back(act);
-
- Actions act1 = {"t_acc_2", "t_asset", 49, reference_data, "spend_account" };
- Actions act2 = {"tom", "t_asset", 80, reference_data, "control_account"};
- Actions act3 = {"Jerry", "t_asset", 20, reference_data, "control_account"};
-
- vActions.push_back(act1);
- vActions.push_back(act2);
- vActions.push_back(act3);
-
- Transaction ts;
- ts.buildTransaction(vActions);
- ts.signTransaction();
- ts.submitTransaction();
- ts.listTransactions();
-}
\ No newline at end of file
