diff --git a/.circleci/config.yml b/.circleci/config.yml index 44db59e69..31c3c7dab 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,7 +2,7 @@ version: 2 jobs: orangepi-plus2: docker: - - image: docker:18.06.0-ce-git + - image: circleci/golang:1.12 working_directory: $GOPATH/src/github.com/skycoin/libskycoin environment: QEMU_PLATFORM: orangepi-plus2 @@ -12,11 +12,12 @@ jobs: - checkout - setup_remote_docker: version: 18.06.0-ce + docker_layer_caching: true - run: docker build --build-arg QEMU_PLATFORM --build-arg QEMU_OS=debian --file $GOPATH/src/github.com/skycoin/libskycoin/docker/images/test-arm/Dockerfile $GOPATH/src/github.com/skycoin/libskycoin -t skydev-test raspberrypi3: docker: - - image: docker:18.06.0-ce-git + - image: circleci/golang:1.12 working_directory: $GOPATH/src/github.com/skycoin/libskycoin environment: QEMU_PLATFORM: raspberrypi3 @@ -26,11 +27,12 @@ jobs: - checkout - setup_remote_docker: version: 18.06.0-ce + docker_layer_caching: true - run: docker build --build-arg QEMU_PLATFORM --build-arg QEMU_OS=debian --file $GOPATH/src/github.com/skycoin/libskycoin/docker/images/test-arm/Dockerfile $GOPATH/src/github.com/skycoin/libskycoin -t skydev-test raspberrypi2: docker: - - image: docker:18.06.0-ce-git + - image: circleci/golang:1.12 working_directory: $GOPATH/src/github.com/skycoin/libskycoin environment: QEMU_PLATFORM: raspberry-pi2 @@ -40,11 +42,12 @@ jobs: - checkout - setup_remote_docker: version: 18.06.0-ce + docker_layer_caching: true - run: docker build --build-arg QEMU_PLATFORM --build-arg QEMU_OS=debian --file $GOPATH/src/github.com/skycoin/libskycoin/docker/images/test-arm/Dockerfile $GOPATH/src/github.com/skycoin/libskycoin -t skydev-test bananapi_m1_plus: docker: - - image: docker:18.06.0-ce-git + - image: circleci/golang:1.12 working_directory: $GOPATH/src/github.com/skycoin/libskycoin environment: QEMU_PLATFORM: bananapi-m1-plus @@ -54,18 +57,20 @@ jobs: - checkout - setup_remote_docker: version: 18.06.0-ce + docker_layer_caching: true - run: docker build --build-arg QEMU_PLATFORM --build-arg QEMU_OS=debian --file $GOPATH/src/github.com/skycoin/libskycoin/docker/images/test-arm/Dockerfile $GOPATH/src/github.com/skycoin/libskycoin -t skydev-test publish-github-release_32: docker: - - image: docker:18.06.0-ce-git + - image: circleci/golang:1.12 + working_directory: $GOPATH/src/github.com/skycoin/libskycoin steps: - run: mkdir -p $GOPATH/src/github.com/ $GOPATH/src/github.com/skycoin - checkout - setup_remote_docker: version: 18.06.0-ce - - run: if [[ $CIRCLE_TAG ]]; then docker build --build-arg SHA1=$CIRCLE_SHA1 --build-arg GITHUB_OAUTH_TOKEN --build-arg PROJECT_USERNAME=$CIRCLE_PROJECT_USERNAME --build-arg PROJECT_REPONAME=$CIRCLE_PROJECT_REPONAME --build-arg QEMU_PLATFORM=raspberrypi3 --build-arg VERSION --file $GOPATH/src/github.com/skycoin/libskycoin/docker/images/deploy-arm/Dockerfile $GOPATH/src/github.com/skycoin/libskycoin -t skydev-deploy ; fi - + docker_layer_caching: true + - run: cd $GOPATH/src/github.com/skycoin/libskycoin/ci-scripts && bash deploy-arm.sh workflows: version: 2 diff --git a/.travis.yml b/.travis.yml index db4b522e2..b623fab46 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,11 +31,10 @@ install: - make install-deps-libc - make install-deps-skyapi script: - - make build-skyapi + - make build - make lint - - make test-libc + - make test - make lint-libc - - make test-skyapi before_deploy: - export VERSION="$(git describe --tags --exact-match HEAD 2> /dev/null)" diff --git a/CHANGELOG.md b/CHANGELOG.md index 8224130cf..b7a67d091 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,20 +4,65 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). -## [Unreleased] +## Unreleased ### Added +- Added swagger specification for `Skycoin REST API` to v0.27.0 -### Fixed +### Changed +- Update `lib/curl` to v0.27.0 + +## [0.26.0] - 2019-07-12 + +### Added +- Added datatype `api__TransactionInput` +- Added datatype `transaction__UxBalance` +- Added function `SKY_transaction_NewUxBalances`, +- Added function `SKY_transaction_DistributeCoinHoursProportional`, `SKY_transaction_DistributeSpendHours` +- Added funcion `SKY_coin_VerifyInputSignatures` +- Added funcion `SKY_coin_BlockHeader_SetTime` +- Added funcion `SKY_coin_BlockHeader_SetBkSeq` +- Added funcion `SKY_coin_BlockHeader_SetFee` +- Added funcion `SKY_coin_BlockHeader_SetVersion` +- Added funcion `SKY_coin_BlockHeader_Version` +- Added funcion `SKY_coin_BlockHeader_PrevHash` +- Support for this new functions in `skyapi`: + - Add POST /api/v2/wallet/transaction/sign to sign an unsigned transaction with a wallet + - Add POST /api/v2/transaction to create an unsigned transaction from addresses or unspent outputs without a wallet + - Add /api/v2/data APIs for transaction notes and generic key-value storage. + - Update /metrics endpoint to add metrics from /health: unspent_outputs, unconfirmed_txns, time_since_last_block_seconds, open_connections, outgoing_connections, incoming_connections, start_at, uptime_seconds, last_block_seq. ### Changed +- Support for this changed functions in `skyapi`: + - Add /api/v1/resendUnconfirmedTxns to the WALLET API set + - In POST /api/v1/wallet/transaction, moved wallet parameters to the top level of the object + - POST /api/v2/wallet/seed/verify returns an error if the seed's checksum is invalid + - Increase the detail of error messages for invalid seeds sent to POST /api/v2/wallet/seed/verify ### Removed - -## [0.25.1] - 2019-05-24 +- Removed symbolic links from vendor +- Removed function `SKY_webrpc_NewClient`, `SKY_webrpc_Client_CSRF`, `SKY_webrpc_Client_InjectTransaction`, `SKY_webrpc_Client_GetStatus`,`SKY_webrpc_Client_GetTransactionByID`, `SKY_webrpc_Client_GetAddressUxOuts`, `SKY_webrpc_Client_GetBlocksInRange`, `SKY_webrpc_Client_GetBlocksBySeq` and `SKY_webrpc_Client_GetLastBlocks`. +- Removed datatype `wallet__UxBalance` +- Removed fuction `SKY_cipher_VerifySignedHash` +- Removed fuction `SKY_bip39_MnemonicToByteArray` +- Removed fuction `SKY_api_Client_Spend`, `SKY_api_Client_AddressTransactions` +- Removed fuction `SKY_coin_Block_PreHashHeader`, `SKY_coin_Block_String` and `SKY_coin_BlockHeader_String`. +- Removed functions exported for `coin.math` +- Removed function `SKY_coin_Transaction_TxID` +- Removed function `SKY_wallet_DistributeSpendHours` +- Removed function `SKY_wallet_DistributeCoinHoursProportional` +- Removed function `SKY_wallet_NewUxBalances` +- Removed support for next functions in `skyapi`: + - /api/v1/explorer/address endpoint (use GET /api/v1/transactions?verbose=1 instead). See https://github.com/skycoin/skycoin/blob/develop/src/api/README.md#migrating-from--api-v1-explorer-address + - The unversioned REST API (the -enable-unversioned-api is removed, prefix your API requests with /api/v1 if they don't have an /api/vx prefix already). See https://github.com/skycoin/skycoin/blob/develop/src/api/README.md#migrating-from-the-unversioned-api + - /api/v1/wallet/spend endpoint (use POST /api/v1/wallet/transaction followed by POST /api/v1/injectTransaction instead). See https://github.com/skycoin/skycoin/blob/develop/src/api/README.md#migrating-from--api-v1-spend + + +## [0.25.1] - 2019-06-30 ### Added +- Be able to set a build type for lib curl. - Export functions in Skycoin 0.25.1 core API's - `skyapi` C client for Skycoin node REST at `lib/curl`. - Support for building `libskycoin` on ARM and 32 / 64 bits. diff --git a/Makefile b/Makefile index 962ac1f12..0369b9c26 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ .DEFAULT_GOAL := help .PHONY: test-libc test-lint build-libc check build build-skyapi test-skyapi .PHONY: install-linters format clean-libc format-libc lint-libc docs +.PHONY: build-skyhwd test-skyhwd COIN ?= skycoin @@ -24,8 +25,13 @@ SKYVENDOR_REL_PATH = $(SKYSRC_REL_PATH)/vendor BUILD_DIR = build BUILDLIB_DIR = $(BUILD_DIR)/libskycoin BUILDLIBSKYAPI_DIR = $(BUILD_DIR)/libskyapi +BUILDLIBSKYHWD_DIR = $(BUILD_DIR)/libskyhwd LIBNAME_Linux = libskyapi.so +LIBHWDNAME_Linux = libskyhwd.so LIBNAME_Darwin = libskyapi.dylib +LIBHWDNAME_Darwin = libskyhwd.dylib +LIBNAME_Static = libskyapiStatic.a +LIBHWDNAME_Static = libskyhwdStatic.a LIB_DIR = lib BIN_DIR = bin DOC_DIR = docs @@ -33,6 +39,7 @@ INCLUDE_DIR = include LIBSRC_DIR = lib/cgo LIBSKYDOC_DIR = $(DOC_DIR)/libc LIBCURLDOC_DIR = $(DOC_DIR)/curl +LIBSKYHWDDOC_DIR = $(DOC_DIR)/skyhwd SWAGGER_SPEC_DIR = lib/swagger SWAGGER_CLIENT_DIR = lib/curl @@ -82,9 +89,6 @@ configure-build: ## Update links to dependency packages dep: git submodule update --init --recursive - ln -nsf ../$(LIBSRC_VENDORREL_PATH)/$(SKYVENDOR_REL_PATH)/golang.org $(LIBVENDOR_REL_PATH)/golang.org - ln -nsf ../$(LIBSRC_VENDORREL_PATH)/$(SKYVENDOR_REL_PATH)/gopkg.in $(LIBVENDOR_REL_PATH)/gopkg.in - ls -1 $(SKYVENDOR_REL_PATH)/github.com | grep -v '^skycoin$$' | xargs -I NAME ln -nsf ../$(LIBSRC_VENDORREL_PATH)/$(SKYVENDOR_REL_PATH)/github.com/NAME $(LIBVENDOR_REL_PATH)/github.com/NAME $(BUILDLIB_DIR)/libskycoin.so: $(LIB_FILES) $(SRC_FILES) $(HEADER_FILES) rm -Rf $(BUILDLIB_DIR)/libskycoin.so @@ -106,8 +110,15 @@ build-skyapi: ## Build skyapi(libcurl based) library (cd lib/curl && bash ./install_lib_curl.sh) mkdir -p ./build/libskyapi cp lib/curl/build/$(LIBNAME_$(UNAME_S)) ./build/libskyapi + cp lib/curl/build/$(LIBNAME_Static) ./build/libskyapi -build: build-libc build-skyapi ## Build libraries +build-skyhwd: ## Build skyhwd(libcurl based) library + (cd lib/skyhwd && bash ./install_lib_curl.sh) + mkdir -p ./build/libskyhwd + cp lib/skyhwd/build/$(LIBHWDNAME_$(UNAME_S)) ./build/libskyhwd + cp lib/skyhwd/build/$(LIBHWDNAME_Static) ./build/libskyhwd + +build: build-libc build-skyapi build-skyhwd ## Build libraries ## Build libskycoin C client library and executable C test suites ## with debug symbols. Use this target to debug the source code @@ -126,16 +137,21 @@ test-libc: build-libc ## Run tests for libskycoin C client library test-skyapi: build-skyapi ## Run test for skyapi(libcurl based) library -test: test-libc test-skyapi ## Run all test for libskycoin +test-skyhwd: build-skyhwd ## Run test for Hardware Wallet Daemon(libcurl based) library + +test: test-libc test-skyapi test-skyhwd ## Run all test for libskycoin docs-skyapi: ## Generate SkyApi (libcurl) documentation openapi-generator generate -g html2 -i lib/swagger/skycoin.v0.25.1.openapi.v2.yml -o $(LIBCURLDOC_DIR) +docs-skyhwd: ## Generate SkyHWD (libcurl) documentation + openapi-generator generate -g html2 -i lib/swagger/hardware-wallet-daemon.v0.1.0.yaml -o $(LIBSKYHWDDOC_DIR) + docs-libc: ## Generate libskycoin documentation doxygen ./.Doxyfile moxygen -o $(LIBSKYDOC_DIR)/API.md $(LIBSKYDOC_DIR)/xml/ -docs: docs-libc docs-skyapi ## Generate documentation for all libraries +docs: docs-libc docs-skyapi docs-skyhwd ## Generate documentation for all libraries lint: ## Run linters. Use make install-linters first. vendorcheck ./... @@ -218,7 +234,10 @@ clean-libc: ## Clean files generated by libc clean-skyapi: ## Clean files generated by skyapi rm -rfv $(BUILDLIBSKYAPI_DIR) -clean: clean-libc clean-skyapi ## Clean all files generated by libraries +clean-skyhwd: ## Clean files generated by skyhwd + rm -rfv $(BUILDLIBSKYHWD_DIR) + +clean: clean-libc clean-skyapi clean-skyhwd ## Clean all files generated by libraries format-libc: $(PKG_CLANG_FORMAT) -sort-includes -i -assume-filename=.clang-format lib/cgo/tests/*.c diff --git a/README.md b/README.md index cbef32f16..4e72c9291 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ # Skycoin C library -[![Build Status](https://travis-ci.org/skycoin/libskycoin.svg)](https://travis-ci.org/skycoin/libskycoin) +[![Build Status](https://travis-ci.com/skycoin/libskycoin.svg)](https://travis-ci.com/skycoin/libskycoin) Skycoin C library (a.k.a `libskycoin`) exports the Skycoin API to DApps using the C programming language. It is also the foundation to build client libraries for other programming languages. @@ -88,7 +88,7 @@ $ make test-libc 0. Make a PR merging the release branch into `master` 0. Review the PR and merge it 0. Tag the `master` branch with the version number. Version tags start with `v`, e.g. `v0.20.0`. Sign the tag. If you have your GPG key in github, creating a release on the Github website will automatically tag the release. It can be tagged from the command line with `git tag -as v0.20.0 $COMMIT_ID`, but Github will not recognize it as a "release". -0. Release builds are created and uploaded by travis. To do it manually, checkout the master branch and follow the [create release builds instructions](#creating-release-builds). +0. Release builds are created and uploaded by travis. To do it manually, checkout the master branch and make release. 0. Merge changes in `master` back into `develop` branch to start working towards next stable version. #### Pre-release testing @@ -98,6 +98,43 @@ Perform these actions before releasing: ```sh make check ``` +#### Release signing + +Releases are signed with this PGP key: + +`0x5801631BD27C7874` + +The fingerprint for this key is: + +``` +pub ed25519 2017-09-01 [SC] [expires: 2023-03-18] + 10A7 22B7 6F2F FE7B D238 0222 5801 631B D27C 7874 +uid GZ-C SKYCOIN +sub cv25519 2017-09-01 [E] [expires: 2023-03-18] +``` + +Keybase.io account: https://keybase.io/gzc + +##### Alternative signing keys: + +Keybase.io account: https://keybase.io/olemis + +The fingerprint for this key is: + +``` +pub rsa4096 2019-01-17 [SC] [expires: 2024-01-16] +uid Olemis Lang +sub rsa4096 2019-01-17 [E] [expires: 2024-01-16] +``` + +Follow the [Tor Project's instructions for verifying signatures](https://www.torproject.org/docs/verifying-signatures.html.en). + +If you can't or don't want to import the keys from a keyserver, the signing key is available in the repo: [gz-c.asc](gz-c.asc). + +Releases and their signatures can be found on the [releases page](https://github.com/skycoin/skycoin/releases). + +Instructions for generating a PGP key, publishing it, signing the tags and binaries: +https://gist.github.com/gz-c/de3f9c43343b2f1a27c640fe529b067c ## Development diff --git a/ci-scripts/deploy-arm.sh b/ci-scripts/deploy-arm.sh new file mode 100644 index 000000000..40d9e74a3 --- /dev/null +++ b/ci-scripts/deploy-arm.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +set -x + +git --version + +export VERSION="$(git describe --tags --exact-match HEAD)" + +if [[ "$VERSION" ]]; then + docker build --build-arg SHA1=$CIRCLE_SHA1 --build-arg GITHUB_OAUTH_TOKEN --build-arg PROJECT_USERNAME=$CIRCLE_PROJECT_USERNAME --build-arg PROJECT_REPONAME=$CIRCLE_PROJECT_REPONAME --build-arg QEMU_PLATFORM=armv7hf --build-arg VERSION --file $GOPATH/src/github.com/skycoin/libskycoin/docker/images/deploy-arm/Dockerfile $GOPATH/src/github.com/skycoin/libskycoin -t skydev-deploy + docker build --build-arg SHA1=$CIRCLE_SHA1 --build-arg GITHUB_OAUTH_TOKEN --build-arg PROJECT_USERNAME=$CIRCLE_PROJECT_USERNAME --build-arg PROJECT_REPONAME=$CIRCLE_PROJECT_REPONAME --build-arg QEMU_PLATFORM=aarch64 --build-arg VERSION --file $GOPATH/src/github.com/skycoin/libskycoin/docker/images/deploy-arm/Dockerfile $GOPATH/src/github.com/skycoin/libskycoin -t skydev-deploy +fi \ No newline at end of file diff --git a/ci-scripts/docker_install_debian.sh b/ci-scripts/docker_install_debian.sh index 5d0a3d8d1..d4377bc43 100644 --- a/ci-scripts/docker_install_debian.sh +++ b/ci-scripts/docker_install_debian.sh @@ -1,8 +1,12 @@ #!/usr/bin/env bash apt-get update -apt-get install gcc-6 g++-6 curl wget -y +apt-get install gcc g++ wget cmake libcurl3-gnutls -y wget -c https://github.com/libcheck/check/releases/download/0.12.0/check-0.12.0.tar.gz tar -xzf check-0.12.0.tar.gz -cd check-0.12.0 && ./configure --prefix=/usr --disable-static && make && sudo make install \ No newline at end of file +cd check-0.12.0 && ./configure --prefix=/usr --disable-static && make && sudo make install + +wget -c http://curl.haxx.se/download/curl-7.58.0.tar.gz +tar -xvf curl-7.58.0.tar.gz +cd curl-7.58.0/ && make && sudo make install \ No newline at end of file diff --git a/ci-scripts/docker_install_ubuntu.sh b/ci-scripts/docker_install_ubuntu.sh index 5d0a3d8d1..7cb7dcc59 100644 --- a/ci-scripts/docker_install_ubuntu.sh +++ b/ci-scripts/docker_install_ubuntu.sh @@ -1,7 +1,11 @@ #!/usr/bin/env bash apt-get update -apt-get install gcc-6 g++-6 curl wget -y +apt-get install gcc-6 g++-6 curl wget cmake libcurl3-gnutls -y + +sudo apt-get remove curl -y +(cd deps && wget http://curl.haxx.se/download/curl-7.58.0.tar.gz && tar -xvf curl-7.58.0.tar.gz && cd curl-7.58.0/ && ./configure && make && sudo make install) +(cd deps && git clone https://github.com/uncrustify/uncrustify.git && cd uncrustify && mkdir build && cd build && cmake .. && make && sudo make install) wget -c https://github.com/libcheck/check/releases/download/0.12.0/check-0.12.0.tar.gz tar -xzf check-0.12.0.tar.gz diff --git a/docker/images/deploy-arm/Dockerfile b/docker/images/deploy-arm/Dockerfile index 3c446de9c..2749a118e 100644 --- a/docker/images/deploy-arm/Dockerfile +++ b/docker/images/deploy-arm/Dockerfile @@ -1,10 +1,11 @@ ARG QEMU_PLATFORM FROM balenalib/${QEMU_PLATFORM}-debian-golang - +ARG QEMU_PLATFORM ARG GITHUB_OAUTH_TOKEN ARG PROJECT_USERNAME ARG PROJECT_REPONAME ARG SHA1 +ARG VERSION ADD . $GOPATH/src/github.com/skycoin/libskycoin/ RUN [ "cross-build-start" ] @@ -15,12 +16,11 @@ RUN make -C $GOPATH/src/github.com/skycoin/libskycoin dep RUN go get github.com/gz-c/gox RUN go get -t ./... ENV CGO_ENABLED=1 -RUN export VERSION="$(git describe --tags --exact-match HEAD 2> /dev/null)" -RUN export ARCH="$(uname -m)" -RUN export OS="$(uname -s)" +ENV ARCH=${QEMU_PLATFORM} +ENV OS="Linux" RUN make -C $GOPATH/src/github.com/skycoin/libskycoin build -RUN tar -c -z -f libskycoin-${VERSION}-${OS}-${ARCH}.tar.gz -C $GOPATH/src/github.com/skycoin/libskycoin/build $GOPATH/src/github.com/skycoin/libskycoin/build/* +RUN tar -czf libskycoin-${VERSION}-${OS}-${ARCH}.tar.gz -C $GOPATH/src/github.com/skycoin/libskycoin/build $GOPATH/src/github.com/skycoin/libskycoin/build/* RUN go get github.com/tcnksm/ghr -RUN ghr -t ${GITHUB_OAUTH_TOKEN} -u ${PROJECT_USERNAME} -r ${PROJECT_REPONAME} -c ${SHA1} -delete ${VERSION} libskycoin-${VERSION}-${OS}-${ARCH}.tar.gz +RUN ghr -t ${GITHUB_OAUTH_TOKEN} -u ${PROJECT_USERNAME} -r ${PROJECT_REPONAME} -c ${SHA1} -replace -draft ${VERSION} libskycoin-${VERSION}-${OS}-${ARCH}.tar.gz -RUN [ "cross-build-end" ] +RUN [ "cross-build-end" ] \ No newline at end of file diff --git a/docker/images/test-arm/Dockerfile b/docker/images/test-arm/Dockerfile index d9bfa0690..804a63730 100644 --- a/docker/images/test-arm/Dockerfile +++ b/docker/images/test-arm/Dockerfile @@ -21,4 +21,4 @@ RUN make -C $GOPATH/src/github.com/skycoin/libskycoin test-libc RUN [ "cross-build-end" ] WORKDIR $GOPATH/src/github.com/skycoin -VOLUME $GOPATH/src/ +VOLUME $GOPATH/src/ \ No newline at end of file diff --git a/docs/curl/.openapi-generator/VERSION b/docs/curl/.openapi-generator/VERSION index 2c6109e5b..c4e41f945 100644 --- a/docs/curl/.openapi-generator/VERSION +++ b/docs/curl/.openapi-generator/VERSION @@ -1 +1 @@ -3.3.4 \ No newline at end of file +4.0.3 diff --git a/docs/curl/index.html b/docs/curl/index.html index afb740a44..cc945376f 100644 --- a/docs/curl/index.html +++ b/docs/curl/index.html @@ -2,7 +2,7 @@ - Skycoin REST API. + Hardware Wallet Daemon API @@ -816,440 +816,362 @@ +
+ + + +

Responses

-

-

+

+

-