Skip to content

Commit

Permalink
Merge pull request #56 from aitos-io/boatiotsdk_2_0-dev
Browse files Browse the repository at this point in the history
Candidate for BoAT-X-Framework V2.0.1
  • Loading branch information
flyfft authored May 14, 2021
2 parents 0c5c0f1 + f38d968 commit 1e4fb7c
Show file tree
Hide file tree
Showing 90 changed files with 1,609 additions and 1,443 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/autotest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ jobs:
- name: prepare curl
run: sudo apt-get install libcurl4-openssl-dev
shell: bash

- name: prepare libcheck
run: sudo apt-get install check
shell: bash

- name: prepare openssl
run: sudo apt-get install openssl libssl-dev
shell: bash

- name: make
run: make
- name: make tests
run: make tests

- name: run
run: ./build/tests/boattest
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ package-lock.json
.vscode/settings.json
html/
latex/
vendor/platform/include/boatConfig.h
vendor/platform/include/boatconfig.h
22 changes: 8 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -171,15 +171,15 @@ export BOAT_CFLAGS
export BOAT_LFLAGS
export LINK_LIBS

.PHONY: all boatlibs createdir boatwalletlib vendorlib contractlib demo tests clean cleanboatwallet cleanvendor cleancontract cleantests
.PHONY: all boatlibs createdir boatwalletlib vendorlib demo tests clean cleanboatwallet cleanvendor cleantests

#all: boatlibs demo tests
all: boatlibs

boatlibs: createdir boatwalletlib vendorlib

createdir:
@echo generate header file boatConfig.h...
@echo generate header file boatconfig.h...
$(shell python ./vendor/platform/$(PLATFORM_TARGET)/scripts/gen.py $(PLATFORM_TARGET) $(SCRIPTS_PARAM) )
@echo generate done.

Expand All @@ -196,18 +196,15 @@ vendorlib:
make -C $(BOAT_BASE_DIR)/vendor all; \
fi

contractlib:
make -C $(BOAT_BASE_DIR)/contract all

demo: boatlibs contractlib
demo: boatlibs
make -C $(BOAT_BASE_DIR)/demo all

#tests: boatlibs contractlib
# if [ -d "$(BOAT_BASE_DIR)/tests" ]; then \
# make -C $(BOAT_BASE_DIR)/tests all; \
# fi
tests: boatlibs
if [ -d "$(BOAT_BASE_DIR)/tests" ]; then \
make -C $(BOAT_BASE_DIR)/tests all; \
fi

clean: cleanboatwallet cleanvendor cleancontract cleandemo cleantests
clean: cleanboatwallet cleanvendor cleandemo cleantests
-$(BOAT_RM) $(BOAT_BUILD_DIR)

cleanboatwallet:
Expand All @@ -220,9 +217,6 @@ cleanvendor:
make -C $(BOAT_BASE_DIR)/vendor clean; \
fi

cleancontract:
make -C $(BOAT_BASE_DIR)/contract clean

cleandemo:
make -C $(BOAT_BASE_DIR)/demo clean

Expand Down
18 changes: 12 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ More blockchains are to be supported.
For full list of new features, please read [aitos.io Release Notes](https://github.com/aitos-io/BoAT-X-Framework/releases).


### Project Status Report
For project status update, please visit [BoAT Project Status Update Reports](https://github.com/aitos-io/project-status-update).


## Quick Start

### Dependencies
Expand Down Expand Up @@ -104,7 +108,6 @@ Modify the demo code in ./demo:
<SDKRoot>
|
+---build | Directory to store object and executable files
+---contract | Demo smart contract ABI and generated C interface file
+---demo | Demo application
+---docs | API reference manual
+---vendor | Special vendor dependency
Expand All @@ -117,7 +120,6 @@ Modify the demo code in ./demo:
| +---include | Header files for SDK internal use
| +---protocol | Blockchain client protocol implementation
| +---rlp | RLP encoder
| +---rpc | Remote procedure call wrapper
| +---utilities | Utility APIs
| \---wallet | SDK entry API implementation
+---tests | Test cases
Expand All @@ -137,6 +139,10 @@ The built demo application locates at:

#### To build BoAT libraries only
```
$make
```
or
```
$make boatlibs
```
The built libraries locate at:
Expand All @@ -155,10 +161,10 @@ $make clean
If BoAT is built for Cygwin or linux-x86_64, run the demo application:
real node of an Ethereum compatible blockchain network must be available.
```
$chmod a+x ./build/demo/boatdemo
$./build/demo/boatdemo
$chmod a+x ./build/demo/demo_<protocol>/<demo_name>
$./build/demo/demo_<protocol>/<demo_name>
```

< protocol> can be `ethereum` `fiscobcos` `platone` `fabric`.
Make sure the network connection to the blockchain node (or blockchain simulator) is available.


Expand Down Expand Up @@ -212,7 +218,7 @@ Add to link options all library files in <SDKRoot>/lib in sequence:
+ libboatwallet.a
+ libboatvendor.a

Add to link options: -lcurl -lcrypto
Add to link options: -lcurl


#### Modify your C code
Expand Down
37 changes: 0 additions & 37 deletions contract/Makefile

This file was deleted.

23 changes: 0 additions & 23 deletions contract/generated/Makefile

This file was deleted.

129 changes: 19 additions & 110 deletions demo/Makefile
Original file line number Diff line number Diff line change
@@ -1,128 +1,37 @@
# Source and Objects

SOURCES = $(wildcard *.c)
# Generate sub-directory list
OBJECTS_DIR = $(BOAT_BUILD_DIR)/demo

DEPENDENCE_LIBS = $(BOAT_LIB_DIR)/libboatcontract.a \
$(BOAT_LIB_DIR)/libboatwallet.a \
$(BOAT_LIB_DIR)/libboatvendor.a \
$(LINK_LIBS)
.PHONY: all demo_ethereum demo_platone demo_fiscobcos demo_fabric
all: $(OBJECTS_DIR) demo_ethereum demo_platone demo_fiscobcos demo_fabric

.PHONY: all ethereum_demo platone_demo fiscbcos_demo fabric_demo
all:$(OBJECTS_DIR) ethereum_demo platone_demo fiscbcos_demo fabric_demo

#ETHEREUM transfer demo build
ethereum_demo: demo_ethereum_transfer.c demo_ethereum_storeread.c
demo_ethereum:
ifeq ($(BOAT_PROTOCOL_USE_ETHEREUM), 1)
$(CC) $(BOAT_CFLAGS) $(BOAT_LFLAGS) demo_ethereum_transfer.c \
-DUSE_ONETIME_WALLET -DUSE_PRIKEY_FORMAT_INTERNAL_GENERATION \
$(DEPENDENCE_LIBS) -o $(BOAT_BUILD_DIR)/demo/ethereum/demo_ethereum_transfer_onetime_internalGen
$(CC) $(BOAT_CFLAGS) $(BOAT_LFLAGS) demo_ethereum_transfer.c \
-DUSE_ONETIME_WALLET -DUSE_PRIKEY_FORMAT_EXTERNAL_INJECTION_PKCS \
$(DEPENDENCE_LIBS) -o $(BOAT_BUILD_DIR)/demo/ethereum/demo_ethereum_transfer_onetime_pkcs
$(CC) $(BOAT_CFLAGS) $(BOAT_LFLAGS) demo_ethereum_transfer.c \
-DUSE_ONETIME_WALLET -DUSE_PRIKEY_FORMAT_EXTERNAL_INJECTION_NATIVE \
$(DEPENDENCE_LIBS) -o $(BOAT_BUILD_DIR)/demo/ethereum/demo_ethereum_transfer_onetime_native
$(CC) $(BOAT_CFLAGS) $(BOAT_LFLAGS) demo_ethereum_transfer.c \
-DUSE_CREATE_PERSIST_WALLET -DUSE_PRIKEY_FORMAT_INTERNAL_GENERATION \
$(DEPENDENCE_LIBS) -o $(BOAT_BUILD_DIR)/demo/ethereum/demo_ethereum_transfer_create_internalGen
$(CC) $(BOAT_CFLAGS) $(BOAT_LFLAGS) demo_ethereum_transfer.c \
-DUSE_CREATE_PERSIST_WALLET -DUSE_PRIKEY_FORMAT_EXTERNAL_INJECTION_PKCS \
$(DEPENDENCE_LIBS) -o $(BOAT_BUILD_DIR)/demo/ethereum/demo_ethereum_transfer_create_pkcs
$(CC) $(BOAT_CFLAGS) $(BOAT_LFLAGS) demo_ethereum_transfer.c \
-DUSE_CREATE_PERSIST_WALLET -DUSE_PRIKEY_FORMAT_EXTERNAL_INJECTION_NATIVE \
$(DEPENDENCE_LIBS) -o $(BOAT_BUILD_DIR)/demo/ethereum/demo_ethereum_transfer_create_native
$(CC) $(BOAT_CFLAGS) $(BOAT_LFLAGS) demo_ethereum_transfer.c \
-DUSE_LOAD_PERSIST_WALLET \
$(DEPENDENCE_LIBS) -o $(BOAT_BUILD_DIR)/demo/ethereum/demo_ethereum_transfer_load

$(CC) $(BOAT_CFLAGS) $(BOAT_LFLAGS) demo_ethereum_storeread.c \
-DUSE_ONETIME_WALLET -DUSE_PRIKEY_FORMAT_INTERNAL_GENERATION \
$(DEPENDENCE_LIBS) -o $(BOAT_BUILD_DIR)/demo/ethereum/demo_ethereum_storeread_onetime_internalGen
$(CC) $(BOAT_CFLAGS) $(BOAT_LFLAGS) demo_ethereum_storeread.c \
-DUSE_ONETIME_WALLET -DUSE_PRIKEY_FORMAT_EXTERNAL_INJECTION_PKCS \
$(DEPENDENCE_LIBS) -o $(BOAT_BUILD_DIR)/demo/ethereum/demo_ethereum_storeread_onetime_pkcs
$(CC) $(BOAT_CFLAGS) $(BOAT_LFLAGS) demo_ethereum_storeread.c \
-DUSE_ONETIME_WALLET -DUSE_PRIKEY_FORMAT_EXTERNAL_INJECTION_NATIVE \
$(DEPENDENCE_LIBS) -o $(BOAT_BUILD_DIR)/demo/ethereum/demo_ethereum_storeread_onetime_native
$(CC) $(BOAT_CFLAGS) $(BOAT_LFLAGS) demo_ethereum_storeread.c \
-DUSE_CREATE_PERSIST_WALLET -DUSE_PRIKEY_FORMAT_INTERNAL_GENERATION \
$(DEPENDENCE_LIBS) -o $(BOAT_BUILD_DIR)/demo/ethereum/demo_ethereum_storeread_create_internalGen
$(CC) $(BOAT_CFLAGS) $(BOAT_LFLAGS) demo_ethereum_storeread.c \
-DUSE_CREATE_PERSIST_WALLET -DUSE_PRIKEY_FORMAT_EXTERNAL_INJECTION_PKCS \
$(DEPENDENCE_LIBS) -o $(BOAT_BUILD_DIR)/demo/ethereum/demo_ethereum_storeread_create_pkcs
$(CC) $(BOAT_CFLAGS) $(BOAT_LFLAGS) demo_ethereum_storeread.c \
-DUSE_CREATE_PERSIST_WALLET -DUSE_PRIKEY_FORMAT_EXTERNAL_INJECTION_NATIVE \
$(DEPENDENCE_LIBS) -o $(BOAT_BUILD_DIR)/demo/ethereum/demo_ethereum_storeread_create_native
$(CC) $(BOAT_CFLAGS) $(BOAT_LFLAGS) demo_ethereum_storeread.c \
-DUSE_LOAD_PERSIST_WALLET \
$(DEPENDENCE_LIBS) -o $(BOAT_BUILD_DIR)/demo/ethereum/demo_ethereum_storeread_load
make -C $(BOAT_BASE_DIR)/demo/demo_ethereum all
endif

#PLATONE transfer demo build
platone_demo: demo_platone_mycontract.c
demo_platone:
ifeq ($(BOAT_PROTOCOL_USE_PLATONE), 1)
$(CC) $(BOAT_CFLAGS) $(BOAT_LFLAGS) demo_platone_mycontract.c \
-DUSE_ONETIME_WALLET -DUSE_PRIKEY_FORMAT_INTERNAL_GENERATION \
$(DEPENDENCE_LIBS) -o $(BOAT_BUILD_DIR)/demo/platone/demo_platone_mycontract_onetime_internalGen
$(CC) $(BOAT_CFLAGS) $(BOAT_LFLAGS) demo_platone_mycontract.c \
-DUSE_ONETIME_WALLET -DUSE_PRIKEY_FORMAT_EXTERNAL_INJECTION_PKCS \
$(DEPENDENCE_LIBS) -o $(BOAT_BUILD_DIR)/demo/platone/demo_platone_mycontract_onetime_pkcs
$(CC) $(BOAT_CFLAGS) $(BOAT_LFLAGS) demo_platone_mycontract.c \
-DUSE_ONETIME_WALLET -DUSE_PRIKEY_FORMAT_EXTERNAL_INJECTION_NATIVE \
$(DEPENDENCE_LIBS) -o $(BOAT_BUILD_DIR)/demo/platone/demo_platone_mycontract_onetime_native
$(CC) $(BOAT_CFLAGS) $(BOAT_LFLAGS) demo_platone_mycontract.c \
-DUSE_CREATE_PERSIST_WALLET -DUSE_PRIKEY_FORMAT_INTERNAL_GENERATION \
$(DEPENDENCE_LIBS) -o $(BOAT_BUILD_DIR)/demo/platone/demo_platone_mycontract_create_internalGen
$(CC) $(BOAT_CFLAGS) $(BOAT_LFLAGS) demo_platone_mycontract.c \
-DUSE_CREATE_PERSIST_WALLET -DUSE_PRIKEY_FORMAT_EXTERNAL_INJECTION_PKCS \
$(DEPENDENCE_LIBS) -o $(BOAT_BUILD_DIR)/demo/platone/demo_platone_mycontract_create_pkcs
$(CC) $(BOAT_CFLAGS) $(BOAT_LFLAGS) demo_platone_mycontract.c \
-DUSE_CREATE_PERSIST_WALLET -DUSE_PRIKEY_FORMAT_EXTERNAL_INJECTION_NATIVE \
$(DEPENDENCE_LIBS) -o $(BOAT_BUILD_DIR)/demo/platone/demo_platone_mycontract_create_native
$(CC) $(BOAT_CFLAGS) $(BOAT_LFLAGS) demo_platone_mycontract.c \
-DUSE_LOAD_PERSIST_WALLET \
$(DEPENDENCE_LIBS) -o $(BOAT_BUILD_DIR)/demo/platone/demo_platone_mycontract_load
endif
make -C $(BOAT_BASE_DIR)/demo/demo_platone all
endif

#Fiscobcos transfer demo build
fiscbcos_demo: demo_fiscobcos_helloworld.c
demo_fiscobcos:
ifeq ($(BOAT_PROTOCOL_USE_FISCOBCOS), 1)
$(CC) $(BOAT_CFLAGS) $(BOAT_LFLAGS) demo_fiscobcos_helloworld.c \
-DUSE_ONETIME_WALLET -DUSE_PRIKEY_FORMAT_INTERNAL_GENERATION \
$(DEPENDENCE_LIBS) -o $(BOAT_BUILD_DIR)/demo/fiscobcos/demo_fiscobcos_helloworld_onetime_internalGen
$(CC) $(BOAT_CFLAGS) $(BOAT_LFLAGS) demo_fiscobcos_helloworld.c \
-DUSE_ONETIME_WALLET -DUSE_PRIKEY_FORMAT_EXTERNAL_INJECTION_PKCS \
$(DEPENDENCE_LIBS) -o $(BOAT_BUILD_DIR)/demo/fiscobcos/demo_fiscobcos_helloworld_onetime_pkcs
$(CC) $(BOAT_CFLAGS) $(BOAT_LFLAGS) demo_fiscobcos_helloworld.c \
-DUSE_ONETIME_WALLET -DUSE_PRIKEY_FORMAT_EXTERNAL_INJECTION_NATIVE \
$(DEPENDENCE_LIBS) -o $(BOAT_BUILD_DIR)/demo/fiscobcos/demo_fiscobcos_helloworld_onetime_native
$(CC) $(BOAT_CFLAGS) $(BOAT_LFLAGS) demo_fiscobcos_helloworld.c \
-DUSE_CREATE_PERSIST_WALLET -DUSE_PRIKEY_FORMAT_INTERNAL_GENERATION \
$(DEPENDENCE_LIBS) -o $(BOAT_BUILD_DIR)/demo/fiscobcos/demo_fiscobcos_helloworld_create_internalGen
$(CC) $(BOAT_CFLAGS) $(BOAT_LFLAGS) demo_fiscobcos_helloworld.c \
-DUSE_CREATE_PERSIST_WALLET -DUSE_PRIKEY_FORMAT_EXTERNAL_INJECTION_PKCS \
$(DEPENDENCE_LIBS) -o $(BOAT_BUILD_DIR)/demo/fiscobcos/demo_fiscobcos_helloworld_create_pkcs
$(CC) $(BOAT_CFLAGS) $(BOAT_LFLAGS) demo_fiscobcos_helloworld.c \
-DUSE_CREATE_PERSIST_WALLET -DUSE_PRIKEY_FORMAT_EXTERNAL_INJECTION_NATIVE \
$(DEPENDENCE_LIBS) -o $(BOAT_BUILD_DIR)/demo/fiscobcos/demo_fiscobcos_helloworld_create_native
$(CC) $(BOAT_CFLAGS) $(BOAT_LFLAGS) demo_fiscobcos_helloworld.c \
-DUSE_LOAD_PERSIST_WALLET \
$(DEPENDENCE_LIBS) -o $(BOAT_BUILD_DIR)/demo/fiscobcos/demo_fiscobcos_helloworld_load
make -C $(BOAT_BASE_DIR)/demo/demo_fiscobcos all
endif

#Fabric transfer demo build
fabric_demo: demo_fabric_invoke.c
demo_fabric:
ifeq ($(BOAT_PROTOCOL_USE_HLFABRIC), 1)
$(CC) $(BOAT_CFLAGS) $(BOAT_LFLAGS) demo_fabric_invoke.c \
$(DEPENDENCE_LIBS) -o $(BOAT_BUILD_DIR)/demo/fabric/demo_fabric_invoke
endif
make -C $(BOAT_BASE_DIR)/demo/demo_fabric all
endif

$(OBJECTS_DIR):
$(BOAT_MKDIR) -p $(OBJECTS_DIR)/ethereum
$(BOAT_MKDIR) -p $(OBJECTS_DIR)/platone
$(BOAT_MKDIR) -p $(OBJECTS_DIR)/fiscobcos
$(BOAT_MKDIR) -p $(OBJECTS_DIR)/fabric
$(BOAT_MKDIR) -p $(OBJECTS_DIR)

clean:
-$(BOAT_RM) $(BOAT_BUILD_DIR)/demo/*
make -C $(BOAT_BASE_DIR)/demo/demo_ethereum clean
make -C $(BOAT_BASE_DIR)/demo/demo_platone clean
make -C $(BOAT_BASE_DIR)/demo/demo_fiscobcos clean
make -C $(BOAT_BASE_DIR)/demo/demo_fabric clean
-$(BOAT_RM) $(BOAT_BUILD_DIR)/demo
Loading

0 comments on commit 1e4fb7c

Please sign in to comment.