Initial support to blockchain clients
cover Initial support to blockchain clients
This set of patches is the first one of a serie that will provide buildroot with several blockchain clients. The first ones that will be added are three bitcoin clients:
- Bitcoin Core (C++ based client)
- BTCD (Goland based client)
- Neutrino (Goland based lightweight client)
In order to build the Golang clients, a dependency resolving tool needed to be added (Glide), and Go host building support needed to be implemented.
Next patches of the serie shall add suport to lighting network and Etherium clients.
Fabio Urquiza (4):
host-go-glide: new package
bitcoin: new package
btcd: new package
neutrino: new package
package/Config.in | 6 ++++++ package/Config.in.host | 1 + package/bitcoin/Config.in | 26 ++++++++++++++++++++++++++ package/bitcoin/bitcoin.hash | 3 +++ package/bitcoin/bitcoin.mk | 17 +++++++++++++++++ package/btcd/Config.in | 10 ++++++++++ package/btcd/btcd.hash | 3 +++ package/btcd/btcd.mk | 15 +++++++++++++++ package/go-glide/Config.in.host | 12 ++++++++++++ package/go-glide/go-glide.hash | 3 +++ package/go-glide/go-glide.mk | 14 ++++++++++++++ package/neutrino/Config.in | 13 +++++++++++++ package/neutrino/neutrino.hash | 3 +++ package/neutrino/neutrino.mk | 14 ++++++++++++++ package/pkg-golang.mk | 36 ++++++++++++++++++++++++++++++++---- 15 files changed, 172 insertions(+), 4 deletions(-) create mode 100644 package/bitcoin/Config.in create mode 100644 package/bitcoin/bitcoin.hash create mode 100644 package/bitcoin/bitcoin.mk create mode 100644 package/btcd/Config.in create mode 100644 package/btcd/btcd.hash create mode 100644 package/btcd/btcd.mk create mode 100644 package/go-glide/Config.in.host create mode 100644 package/go-glide/go-glide.hash create mode 100644 package/go-glide/go-glide.mk create mode 100644 package/neutrino/Config.in create mode 100644 package/neutrino/neutrino.hash create mode 100644 package/neutrino/neutrino.mk
Signature · 1 line
2.7.4
PATCH 1/4 host-go-glide: new package
From: Fabio Urquiza <[email protected]>
A package management for Golang.
--- package/Config.in.host | 1 + package/go-glide/Config.in.host | 12 ++++++++++++ package/go-glide/go-glide.hash | 3 +++ package/go-glide/go-glide.mk | 14 ++++++++++++++ package/pkg-golang.mk | 36 ++++++++++++++++++++++++++++++++---- 5 files changed, 62 insertions(+), 4 deletions(-) create mode 100644 package/go-glide/Config.in.host create mode 100644 package/go-glide/go-glide.hash create mode 100644 package/go-glide/go-glide.mk
package/Config.in.host +1 -0
@@ -24,6 +24,7 @@ menu "Host utilities" source "package/gnupg/Config.in.host" source "package/go/Config.in.host" source "package/go-bootstrap/Config.in.host" + source "package/go-glide/Config.in.host" source "package/google-breakpad/Config.in.host" source "package/gptfdisk/Config.in.host" source "package/imx-mkimage/Config.in.host"
package/go-glide/Config.in.host new file +12 -0
@@ -0,0 +1,12 @@ +config BR2_PACKAGE_HOST_GO_GLIDE + bool "host glide" + depends on BR2_PACKAGE_HOST_GO_ARCH_SUPPORTS + help + Glide is a tool for managing the _vendor_ directory within a Go + package. This feature, first introduced in Go 1.5, allows each + package to have a _vendor_ directory containing dependent + packages for the project. These vendor packages can be + installed by a tool (e.g. glide), similar to go get or they + can be vendored and distributed with the package. + + https://github.com/Masterminds/glide
package/go-glide/go-glide.hash new file +3 -0
@@ -0,0 +1,3 @@ +# Locally calculated +sha256 0886851af2437b161d47b279a32bef426577e7bec3f5acdadebe34549aae8270 go-glide-v0.13.2.tar.gz +sha256 ff505b08691ce248f27dfe94d605419e6514c8b60912c7f4188a3e3168ad338f LICENSE
package/go-glide/go-glide.mk new file +14 -0
@@ -0,0 +1,14 @@ +################################################################################ +# +# glide +# +################################################################################ + +GO_GLIDE_VERSION = v0.13.2 +GO_GLIDE_SITE = $(call github,Masterminds,glide,$(GO_GLIDE_VERSION)) +GO_GLIDE_LICENSE = Glide +GO_GLIDE_LICENSE_FILES = LICENSE +HOST_GO_GLIDE_BIN_NAME = glide +HOST_GO_GLIDE_INSTALL_BINS = glide + +$(eval $(host-golang-package))
package/pkg-golang.mk +32 -4
@@ -22,6 +22,7 @@ ################################################################################ GO_BIN = $(HOST_DIR)/bin/go +GLIDE_BIN = $(HOST_DIR)/bin/glide # We pass an empty GOBIN, otherwise "go install: cannot install # cross-compiled binaries when GOBIN is set"
@@ -31,6 +32,15 @@ GO_TARGET_ENV = \ GOBIN= \ CGO_ENABLED=$(HOST_GO_CGO_ENABLED) +GO_HOST_ENV = \ + GOROOT="$(HOST_GO_ROOT)" \ + CC="$(HOSTCC_NOCCACHE)" \ + CXX="$(HOSTCXX_NOCCACHE)" \ + GOTOOLDIR="$(HOST_GO_TOOLDIR)" \ + PATH=$(BR_PATH) \ + GOBIN= \ + CGO_ENABLED=$(HOST_GO_CGO_ENABLED) + ################################################################################ # inner-golang-package -- defines how the configuration, compilation and # installation of a Go package should be done, implements a few hooks to tune
@@ -43,8 +53,6 @@ GO_TARGET_ENV = \ # argument 3 is the uppercase package name, without the HOST_ prefix for host # packages # argument 4 is the type (target or host) -# -# NOTE Only type target is supported at the moment ################################################################################ define inner-golang-package
@@ -61,6 +69,14 @@ $(2)_BUILD_OPTS += -tags "$$($(2)_TAGS)" # Target packages need the Go compiler on the host. $(2)_DEPENDENCIES += host-go +$(2)_GO_GET ?= NO +$(2)_GO_GLIDE ?= NO + +ifeq ($($(2)_GO_GLIDE),YES) +$(2)_DEPENDENCIES += host-go-glide +endif + + $(2)_BUILD_TARGETS ?= . # If the build target is just ".", then we assume the binary to be
@@ -97,11 +113,14 @@ endif # file. ifndef $(2)_BUILD_CMDS define $(2)_BUILD_CMDS + echo $$($(2)_DEPENDENCIES) $$(foreach d,$$($(2)_BUILD_TARGETS),\ cd $$($(2)_SRC_PATH); \ - $$(GO_TARGET_ENV) \ + export $(if $(findstring $(4),target),$$(GO_TARGET_ENV),$$(GO_HOST_ENV)) \ GOPATH="$$(@D)/$$($(2)_WORKSPACE)" \ - $$($(2)_GO_ENV) \ + $$($(2)_GO_ENV) && \ + $(if $(findstring $($(2)_GO_GLIDE),YES),$$(GLIDE_BIN) install &&) \ + $(if $(findstring $($(2)_GO_GET),YES),$$(GO_BIN) get -d &&) \ $$(GO_BIN) build -v $$($(2)_BUILD_OPTS) \ -o $$(@D)/bin/$$(or $$($(2)_BIN_NAME),$$(notdir $$(d))) \ ./$$(d)
@@ -119,6 +138,14 @@ define $(2)_INSTALL_TARGET_CMDS endef endif +ifndef $(2)_INSTALL_CMDS +define $(2)_INSTALL_CMDS + $$(foreach d,$$($(2)_INSTALL_BINS),\ + $(INSTALL) -D -m 0755 $$(@D)/bin/$$(d) $(HOST_DIR)/usr/bin/$$(d) + ) +endef +endif + # Call the generic package infrastructure to generate the necessary make # targets $(call inner-generic-package,$(1),$(2),$(3),$(4))
@@ -130,3 +157,4 @@ endef # inner-golang-package ################################################################################ golang-package = $(call inner-golang-package,$(pkgname),$(call UPPERCASE,$(pkgname)),$(call UPPERCASE,$(pkgname)),target) +host-golang-package = $(call inner-golang-package,host-$(pkgname),$(call UPPERCASE,host-$(pkgname)),$(call UPPERCASE,$(pkgname)),host)
Signature · 1 line
2.7.4
PATCH 1/4 host-go-glide: new package
Fabio, All,
Sorry for the long delay before replying to your patch...
On 2018-09-28 10:59 -0300, Fabio Urquiza spake thusly:
Quoted 2 lines
From: Fabio Urquiza <[email protected]>
A package management for Golang.
We've discussed this patch during the developpers meeting today, and we've decided to not apply this patch, because go-glide is now deprecated, and replaced by "go modules", as discussed in that thread from last April:
http://lists.busybox.net/pipermail/buildroot/2019-April/247191.html
And since the two go-based packages in your series (btcd and neutrino) already appear to support go modules, we don't see the point in having go-glide.
Regards,
Yann E. MORIN.
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH 2/4 bitcoin: new package
In reply to Fabio UrquizaBitcoin Core is an open source project which maintains and releases Bitcoin client software called ?Bitcoin Core?.
--- package/Config.in | 4 ++++ package/bitcoin/Config.in | 26 ++++++++++++++++++++++++++ package/bitcoin/bitcoin.hash | 3 +++ package/bitcoin/bitcoin.mk | 17 +++++++++++++++++ 4 files changed, 50 insertions(+) create mode 100644 package/bitcoin/Config.in create mode 100644 package/bitcoin/bitcoin.hash create mode 100644 package/bitcoin/bitcoin.mk
package/Config.in +4 -0
@@ -1971,6 +1971,10 @@ endif source "package/xtables-addons/Config.in" source "package/znc/Config.in" +menu "Blockchain Applications" + source "package/bitcoin/Config.in" +endmenu + endmenu menu "Package managers"
package/bitcoin/Config.in new file +26 -0
@@ -0,0 +1,26 @@ +config BR2_PACKAGE_BITCOIN + bool "bitcoin" + select BR2_TOOLCHAIN_BUILDROOT_USE_SSP + select BR2_INSTALL_LIBSTDCPP + select BR2_PACKAGE_BOOST + select BR2_PACKAGE_BOOST_SYSTEM + select BR2_PACKAGE_BOOST_FILESYSTEM + select BR2_PACKAGE_BOOST_THREAD + select BR2_PACKAGE_BOOST_CHRONO + select BR2_PACKAGE_BOOST_PROGRAM_OPTIONS + select BR2_PACKAGE_OPENSSL + select BR2_PACKAGE_LIBEVENT + help + Bitcoin Core is an open source project which maintains and + releases Bitcoin client software called ?Bitcoin Core?. + + It is a direct descendant of the original Bitcoin software + client released by Satoshi Nakamoto after he published the + famous Bitcoin whitepaper. + + Bitcoin Core consists of both ?full-node? software for fully + validating the blockchain as well as a bitcoin wallet. The + project also currently maintains related software such as the + cryptography library libsecp256k1 and others located at GitHub. + + https://bitcoincore.org
package/bitcoin/bitcoin.hash new file +3 -0
@@ -0,0 +1,3 @@ +# Locally calculated +sha256 c8557b6df5f5cdf67b3ddf6fe501cfc6e0be698f175f16927dd08d6040df7d9f bitcoin-v0.16.3.tar.gz +sha256 70223369f70e8cb550e75aa74eb86bfa5220fb09c0ba0549d91c36587d15d1a0 COPYING
package/bitcoin/bitcoin.mk new file +17 -0
@@ -0,0 +1,17 @@ +################################################################################ +# +# bitcoin +# +################################################################################ + +BITCOIN_VERSION = v0.16.3 +BITCOIN_SITE = $(call github,bitcoin,bitcoin,$(BITCOIN_VERSION)) +BITCOIN_AUTORECONF = YES +BITCOIN_LICENSE = MIT +BITCOIN_LICENSE_FILES = COPYING +BITCOIN_CONF_OPTS = --disable-wallet --disable-tests +BITCOIN_CONF_OPTS += --with-sysroot=$(STAGING_DIR) +BITCOIN_CONF_OPTS += --with-boost-libdir=$(STAGING_DIR)/usr/lib/ +BITCOIN_DEPENDENCIES = boost openssl libevent + +$(eval $(autotools-package))
Signature · 1 line
2.7.4
PATCH 2/4 bitcoin: new package
Hello,
Thanks for your contribution! I have applied your patch, but after making a significant number of changes. See below.
First, all new packages need an entry in DEVELOPERS file, so that the original submitter (you!) can receive notifications about build issues with this package.
package/Config.in endif · line 1976
Quoted 11 lines · On Fri, 28 Sep 2018 10:59:21 -0300 Fabio Urquiza <[email protected]> wrote:
package/Config.in +3
-0@@ -1971,6 +1971,10 @@ endif source "package/xtables-addons/Config.in" source "package/znc/Config.in" +menu "Blockchain Applications" + source "package/bitcoin/Config.in" +endmenu
Since we're for now only applying this package, having a new category for blockchain applications was not really useful, so I moved it to Miscellaneous applications.
package/bitcoin/Config.in line 3
Quoted 9 lines
package/bitcoin/Config.in new file +3
-0@@ -0,0 +1,26 @@ +config BR2_PACKAGE_BITCOIN + bool "bitcoin" + select BR2_TOOLCHAIN_BUILDROOT_USE_SSP
You can't select this option, as it is only valid for internal toolchain with the uClibc C library. The proper solution here was to pass --disable-hardening, so that the bitcoin configure script doesn't add any hardening-related CFLAGS. Buildroot has system-wide support for hardening features, and if such features are enabled, it will pass the appropriate CFLAGS.
package/bitcoin/Config.in line 4
Quoted 1 line
package/bitcoin/Config.in new file +1
-0+ select BR2_INSTALL_LIBSTDCPP
You cannot select this, you can only depend on it, and it needs a Config.in comment. See other packages.
Also, other dependencies were missing:
- BR2_TOOLCHAIN_HAS_GCC_BUG_64735 due to the use of std::future
- BR2_TOOLCHAIN_HAS_ATOMIC due to the use of std::atomic
- A weird dependency was also needed because 8-byte atomics are not provided on ARM Cortex-M.
All these issues were found by using ./utils/testpkg on your package.
Quoted 7 lines
package/bitcoin/Config.in new file +7
-0+ select BR2_PACKAGE_BOOST + select BR2_PACKAGE_BOOST_SYSTEM + select BR2_PACKAGE_BOOST_FILESYSTEM + select BR2_PACKAGE_BOOST_THREAD + select BR2_PACKAGE_BOOST_CHRONO + select BR2_PACKAGE_BOOST_PROGRAM_OPTIONS + select BR2_PACKAGE_OPENSSL
package/bitcoin/Config.in line 21
Quoted 10 lines
package/bitcoin/Config.in new file +10
-0+ select BR2_PACKAGE_LIBEVENT + help + Bitcoin Core is an open source project which maintains and + releases Bitcoin client software called ?Bitcoin Core?. + + It is a direct descendant of the original Bitcoin software + client released by Satoshi Nakamoto after he published the + famous Bitcoin whitepaper. + + Bitcoin Core consists of both ?full-node? software for fully
We try to use only ASCII characters, and to cut the lines at 72 characters. This is something that "make check-package" tells you.
package/bitcoin/Config.in
Quoted 7 lines
package/bitcoin/Config.in new file +7
-0+BITCOIN_VERSION = v0.16.3 +BITCOIN_SITE = $(call github,bitcoin,bitcoin,$(BITCOIN_VERSION)) +BITCOIN_AUTORECONF = YES +BITCOIN_LICENSE = MIT +BITCOIN_LICENSE_FILES = COPYING +BITCOIN_CONF_OPTS = --disable-wallet --disable-tests +BITCOIN_CONF_OPTS += --with-sysroot=$(STAGING_DIR)
The --with-sysroot option is not necessary.
Quoted 1 line
+BITCOIN_CONF_OPTS += --with-boost-libdir=$(STAGING_DIR)/usr/lib/
I grouped all those CONF_OPTS statements in just one statement.
See the final commit at:
https://git.buildroot.org/buildroot/commit/?id=656fc50b51c03891d34471fd39003355678f7fde
Best regards,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH 3/4 btcd: new package
In reply to Fabio UrquizaAn alternative full node bitcoin implementation written in Go (golang).
--- package/Config.in | 1 + package/btcd/Config.in | 10 ++++++++++ package/btcd/btcd.hash | 3 +++ package/btcd/btcd.mk | 15 +++++++++++++++ 4 files changed, 29 insertions(+) create mode 100644 package/btcd/Config.in create mode 100644 package/btcd/btcd.hash create mode 100644 package/btcd/btcd.mk
package/Config.in +1 -0
@@ -1973,6 +1973,7 @@ endif menu "Blockchain Applications" source "package/bitcoin/Config.in" + source "package/btcd/Config.in" endmenu endmenu
package/btcd/Config.in new file +10 -0
@@ -0,0 +1,10 @@ +config BR2_PACKAGE_BTCD + bool "btcd" + depends on BR2_PACKAGE_HOST_GO_ARCH_SUPPORTS + select BR2_PACKAGE_HOST_GO_GLIDE + help + btcd is an alternative full node bitcoin implementation + written in Go (golang). + + https://github.com/btcsuite/btcd +
package/btcd/btcd.hash new file +3 -0
@@ -0,0 +1,3 @@ +# Locally calculated +sha256 4afd800125ecd9ff22c63dfc00c512ae5892f98b0415ecc1a19cd64afdf86bbb btcd-2a560b2036bee5e3679ec2133eb6520b2f195213.tar.gz +sha256 46021938caf87eeb92c841fd48777a3a7bf218341386611c4d080aa45812d1d2 LICENSE
package/btcd/btcd.mk new file +15 -0
@@ -0,0 +1,15 @@ +################################################################################ +# +# btcd +# +################################################################################ + +BTCD_VERSION = 2a560b2036bee5e3679ec2133eb6520b2f195213 +BTCD_SITE = $(call github,btcsuite,btcd,$(BTCD_VERSION)) +BTCD_LICENSE = ISC +BTCD_LICENSE_FILES = LICENSE +BTCD_GO_GLIDE = YES +BTCD_GO_GET = YES + +$(eval $(golang-package)) +
Signature · 1 line
2.7.4
PATCH 3/4 btcd: new package
Hi;
Quoted 57 lines · Fabio Urquiza
An alternative full node bitcoin implementation written in Go (golang).
Signed-off-by Fabio Urquiza <[email protected]>--- package/Config.in | 1 + package/btcd/Config.in | 10 ++++++++++ package/btcd/btcd.hash | 3 +++ package/btcd/btcd.mk | 15 +++++++++++++++ 4 files changed, 29 insertions(+) create mode 100644 package/btcd/Config.in create mode 100644 package/btcd/btcd.hash create mode 100644 package/btcd/btcd.mkpackage/Config.in +1
-0@@ -1973,6 +1973,7 @@ endif menu "Blockchain Applications" source "package/bitcoin/Config.in" + source "package/btcd/Config.in" endmenu endmenupackage/btcd/Config.in new file +10
-0@@ -0,0 +1,10 @@ +config BR2_PACKAGE_BTCD + bool "btcd" + depends on BR2_PACKAGE_HOST_GO_ARCH_SUPPORTS + select BR2_PACKAGE_HOST_GO_GLIDE + help + btcd is an alternative full node bitcoin implementation + written in Go (golang). + + https://github.com/btcsuite/btcd +package/btcd/btcd.hash new file +3
-0@@ -0,0 +1,3 @@ +# Locally calculated +sha256 4afd800125ecd9ff22c63dfc00c512ae5892f98b0415ecc1a19cd64afdf86bbb btcd-2a560b2036bee5e3679ec2133eb6520b2f195213.tar.gz +sha256 46021938caf87eeb92c841fd48777a3a7bf218341386611c4d080aa45812d1d2 LICENSEpackage/btcd/btcd.mk new file +0
-0
package/btcd/btcd.mk line 7
Quoted 7 lines
package/btcd/btcd.mk new file +7
-0@@ -0,0 +1,15 @@ +################################################################################ +# +# btcd +# +################################################################################ + +BTCD_VERSION = 2a560b2036bee5e3679ec2133eb6520b2f195213
Is there a reason v0.12.0-beta isn't being used? Normally I wouldn't suggest a beta release,
but every release is marked with "beta."
Quoted 11 lines
package/btcd/btcd.mk new file +8
-1+BTCD_SITE = $(call github,btcsuite,btcd,$(BTCD_VERSION)) +BTCD_LICENSE = ISC +BTCD_LICENSE_FILES = LICENSE +BTCD_GO_GLIDE = YES +BTCD_GO_GET = YES + +$(eval $(golang-package)) + --2.7.4
Quoted 4 lines
_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Thanks!
Adam
PATCH 4/4 neutrino: new package
In reply to Fabio UrquizaA privacy-preserving Bitcoin light client
--- package/Config.in | 1 + package/neutrino/Config.in | 13 +++++++++++++ package/neutrino/neutrino.hash | 3 +++ package/neutrino/neutrino.mk | 14 ++++++++++++++ 4 files changed, 31 insertions(+) create mode 100644 package/neutrino/Config.in create mode 100644 package/neutrino/neutrino.hash create mode 100644 package/neutrino/neutrino.mk
package/Config.in +1 -0
@@ -1974,6 +1974,7 @@ endif menu "Blockchain Applications" source "package/bitcoin/Config.in" source "package/btcd/Config.in" + source "package/neutrino/Config.in" endmenu endmenu
package/neutrino/Config.in new file +13 -0
@@ -0,0 +1,13 @@ +config BR2_PACKAGE_NEUTRINO + bool "neutrino" + depends on BR2_PACKAGE_HOST_GO_ARCH_SUPPORTS + select BR2_PACKAGE_HOST_GO_GLIDE + help + Neutrino is an experimental Bitcoin light client written in Go + and designed with mobile Lightning Network clients in mind. It + uses a new proposal for compact block filters to minimize + bandwidth and storage use on the client side, while attempting + to preserve privacy and minimize processor load on full nodes + serving light clients. + + https://github.com/lightninglabs/neutrino
package/neutrino/neutrino.hash new file +3 -0
@@ -0,0 +1,3 @@ +# Locally calculated +sha256 581bb625173252d006d6a1cb7962578829f0d7d26605cdcb2ac4e6191a294d8f neutrino-bee0ed11601a4ad0c3b23d462cd71089fc11f2cd.tar.gz +sha256 86d02f0ba9cb90c5da357c931eec3d3d69667ea1cf83804f07cc1ed69494cf46 LICENSE
package/neutrino/neutrino.mk new file +14 -0
@@ -0,0 +1,14 @@ +################################################################################ +# +# neutrino +# +################################################################################ + +NEUTRINO_VERSION = bee0ed11601a4ad0c3b23d462cd71089fc11f2cd +NEUTRINO_SITE = $(call github,lightninglabs,neutrino,$(NEUTRINO_VERSION)) +NEUTRINO_LICENSE = MIT +NEUTRINO_LICENSE_FILES = LICENSE +NEUTRINO_GO_GLIDE = YES + +$(eval $(golang-package)) +
Signature · 1 line
2.7.4