Browse Source

new package

master
parent
commit
841ef635e9
  1. 21
      quorum/quorum-genesis.json
  2. 60
      quorum/quorum-geth.conf
  3. 27
      quorum/quorum.patch
  4. 193
      quorum/quorum.spec
  5. 64
      quorum/rc.quorum

21
quorum/quorum-genesis.json

@ -0,0 +1,21 @@
{
"config": {
"chainId": 42,
"homesteadBlock": 0,
"eip155Block": 0,
"eip158Block": 0
},
"alloc": {
"0x@account@": {
"balance": "100000000000000000000000"
}
},
"coinbase": "0x0000000000000000000000000000000000000000",
"difficulty": "0x400",
"gasLimit": "0x8000000",
"nonce": "0x0000000000000042",
"mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"timestamp": "0x00",
"extraData": ""
}

60
quorum/quorum-geth.conf

@ -0,0 +1,60 @@
##
## quorum-geth.conf -- Quorum Geth Server Configuration
##
[Eth]
NetworkId = 4242
SyncMode = "fast"
LightPeers = 20
DatabaseCache = 128
GasPrice = 18000000000
EthashCacheDir = "ethash"
EthashCachesInMem = 2
EthashCachesOnDisk = 3
EthashDatasetDir = "@l_prefix@/var/quorum/data/ethash"
EthashDatasetsInMem = 1
EthashDatasetsOnDisk = 2
EnablePreimageRecording = false
MinerThreads = 8
[Eth.TxPool]
NoLocals = false
Journal = "transactions.rlp"
Rejournal = 3600000000000
PriceLimit = 1
PriceBump = 10
AccountSlots = 16
GlobalSlots = 4096
AccountQueue = 64
GlobalQueue = 1024
Lifetime = 10800000000000
[Eth.GPO]
Blocks = 10
Percentile = 50
[Shh]
MaxMessageSize = 1048576
MinimumAcceptedPOW = 2e-01
[Node]
DataDir = "@l_prefix@/var/quorum/data"
IPCPath = "geth.ipc"
HTTPHost = "127.0.0.1"
HTTPPort = 8545
HTTPModules = [ "net", "web3", "eth", "shh" ]
WSHost = "127.0.0.1"
WSPort = 8546
WSModules = [ "net", "web3", "eth", "shh" ]
[Node.P2P]
MaxPeers = 25
NoDiscovery = true
DiscoveryV5Addr = "127.0.0.1:30304"
BootstrapNodes = [ @bootnodes@ ]
BootstrapNodesV5 = []
StaticNodes = []
TrustedNodes = []
ListenAddr = "127.0.0.1:30303"
EnableMsgEvents = false

27
quorum/quorum.patch

@ -0,0 +1,27 @@
Index: build/ci.go
--- build/ci.go.orig 2018-03-01 16:23:30.000000000 +0100
+++ build/ci.go 2018-04-04 20:36:40.542159000 +0200
@@ -197,6 +197,7 @@
if *arch == "" || *arch == runtime.GOARCH {
goinstall := goTool("install", buildFlags(env)...)
+ goinstall.Args = append(goinstall.Args, "-x")
goinstall.Args = append(goinstall.Args, "-v")
goinstall.Args = append(goinstall.Args, packages...)
build.MustRun(goinstall)
@@ -211,6 +212,7 @@
}
// Seems we are cross compiling, work around forbidden GOBIN
goinstall := goToolArch(*arch, "install", buildFlags(env)...)
+ goinstall.Args = append(goinstall.Args, "-x")
goinstall.Args = append(goinstall.Args, "-v")
goinstall.Args = append(goinstall.Args, []string{"-buildmode", "archive"}...)
goinstall.Args = append(goinstall.Args, packages...)
@@ -225,6 +227,7 @@
for name := range pkgs {
if name == "main" {
gobuild := goToolArch(*arch, "build", buildFlags(env)...)
+ gobuild.Args = append(gobuild.Args, "-x")
gobuild.Args = append(gobuild.Args, "-v")
gobuild.Args = append(gobuild.Args, []string{"-o", executablePath(cmd.Name())}...)
gobuild.Args = append(gobuild.Args, "."+string(filepath.Separator)+filepath.Join("cmd", cmd.Name()))

193
quorum/quorum.spec

@ -0,0 +1,193 @@
##
## quorum.spec -- OpenPKG RPM Package Specification
## Copyright (c) 2000-2018 OpenPKG Project <http://openpkg.org/>
##
## Permission to use, copy, modify, and distribute this software for
## any purpose with or without fee is hereby granted, provided that
## the above copyright notice and this permission notice appear in all
## copies.
##
## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
## SUCH DAMAGE.
##
# package information
Name: quorum
Summary: Quorum Blockchain Service
URL: https://www.jpmorgan.com/quorum
Vendor: JP Morgan Chase
Packager: OpenPKG Project
Distribution: OpenPKG Community
Class: EVAL
Group: P2P
License: LGPL
Version: 2.0.2
Release: 20180404
# package options
%option with_private yes
%option with_bootnode yes
# list of sources
Source0: https://github.com/jpmorganchase/quorum/archive/v%{version}.tar.gz
Source1: quorum-genesis.json
Source2: quorum-geth.conf
Source3: rc.quorum
Patch0: quorum.patch
# build information
BuildPreReq: OpenPKG, openpkg >= 20160101, go
PreReq: OpenPKG, openpkg >= 20160101, apg
%if "%{with_private}" == "yes" && "%{with_bootnode}" == "yes"
PreReq: quorum-bootnode
%endif
%description
Quorum is a decentralized platform that runs smart contracts,
applications that run exactly as programmed without possibility of
downtime, censorship, fraud or third party interference. Quorum is
a fork of the Ethereum code-base and adds: Privacy: Quorum supports
private transactions and private contracts through public/private
state separation and utilising Constellation, a peer-to-peer
encrypted message exchange for directed transfer of private data
to network participants; Alternative Consensus Mechanisms: with
no need for POW/POS in a permissioned network, Quorum instead
offers multiple consensus mechanisms that are more appropriate
for consortium chains: Raft-based Consensus, a consensus model
for faster blocktimes, transaction finality, and on-demand block
creation and Istanbul BFT, a PBFT-inspired consensus algorithm with
transaction finality; Peer Permissioning: node/peer permissioning
using smart contracts, ensuring only known parties can join the
network; and Higher Performance: Quorum offers significantly higher
performance than public Ethereum.
%track
prog quorum = {
version = %{version}
url = https://github.com/jpmorganchase/quorum/releases
regex = v(__VER__)\.tar\.gz
}
%prep
%setup -q
%patch -p0
%build
# build program
%{l_make} %{l_mflags} all
%install
# create installation hierarchy
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/bin \
$RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
$RPM_BUILD_ROOT%{l_prefix}/etc/quorum \
$RPM_BUILD_ROOT%{l_prefix}/var/quorum/log \
$RPM_BUILD_ROOT%{l_prefix}/var/quorum/run \
$RPM_BUILD_ROOT%{l_prefix}/var/quorum/data/ethash
# install program
for prog in build/bin/*; do
name=`echo $prog | sed -e 's;build/bin/;quorum-;'`
%{l_shtool} install -c -s -m 775 \
$prog $RPM_BUILD_ROOT%{l_prefix}/bin/$name
done
rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/quorum-bootnode
# install default configuration files
%{l_shtool} install -c -m 644 %{l_value -s -a} \
%{SOURCE quorum-geth.conf} $RPM_BUILD_ROOT%{l_prefix}/etc/quorum/
%{l_shtool} install -c -m 644 %{l_value -s -a} \
%{SOURCE quorum-genesis.json} $RPM_BUILD_ROOT%{l_prefix}/etc/quorum/
# install run-command script
flags=""
%if "%{with_private}" == "yes"
flags="--mine --etherbase=0x0000000000000000000000000000000000000000"
%endif
%{l_shtool} install -c -m 755 %{l_value -s -a} \
-e "s;@flags@;$flags;" \
%{SOURCE rc.quorum} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
# determine installation files
%{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
%{l_files_std} \
'%config %attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/etc/quorum' \
'%config %attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/etc/quorum/*' \
'%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/quorum/*' \
'%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/quorum/*/*'
%files -f files
%clean
%post
if [ $1 -eq 1 ]; then
# determine bootnodes
%if "%{with_private}" == "yes"
%if "%{with_bootnode}" != "yes"
bootnodes=""
%else
bootnodes=`$RPM_INSTALL_PREFIX/bin/quorum-bootnode \
-nodekey $RPM_INSTALL_PREFIX/etc/quorum-bootnode/quorum-bootnode.key -writeaddress`
bootnodes="\"enode://$bootnodes@127.0.0.1:30301\""
%endif
%else
bootnodes=`$RPM_INSTALL_PREFIX/bin/quorum-geth dumpconfig | \
grep '^BootstrapNodes' | sed -e 's;^.*\\[;;' -e 's;\\].*;;'`
%endif
%{l_shtool} subst -e "s;@bootnodes@;$bootnodes;" \
$RPM_INSTALL_PREFIX/etc/quorum/quorum-geth.conf
%if "%{with_private}" == "yes"
# generate local account
echo "Generating Private Ethereum Blockchain Local Account" | \
%{l_rpmtool} msg -b -t notice
su - %{l_rusr} -c \
"umask 0077; $RPM_INSTALL_PREFIX/bin/apg -n1 -a1 -m32 -x32 -M NCL \
>$RPM_INSTALL_PREFIX/etc/quorum/quorum-account.passwd"
account=`su - %{l_rusr} -c \
"$RPM_INSTALL_PREFIX/bin/quorum-geth \
--config $RPM_INSTALL_PREFIX/etc/quorum/quorum-geth.conf \
account new \
--password $RPM_INSTALL_PREFIX/etc/quorum/quorum-account.passwd" 2>&1 | \
egrep "^Address:" | sed -e 's;^Address: {\(.*\)}.*;\1;'`
# generate genesis block
echo "Generating Private Ethereum Blockchain Genesis Block" | \
%{l_rpmtool} msg -b -t notice
%{l_shtool} subst -e "s;@account@;$account;" \
$RPM_INSTALL_PREFIX/etc/quorum/quorum-genesis.json
su - %{l_rusr} -c \
"$RPM_INSTALL_PREFIX/bin/quorum-geth \
--config $RPM_INSTALL_PREFIX/etc/quorum/quorum-geth.conf \
init $RPM_INSTALL_PREFIX/etc/quorum/quorum-genesis.json \
>>$RPM_INSTALL_PREFIX/var/quorum/log/quorum-geth.log 2>&1"
%endif
elif [ $1 -eq 2 ]; then
# after upgrade, restart service
eval `%{l_rc} quorum status 2>/dev/null`
[ ".$quorum_active" = .yes ] && %{l_rc} quorum restart
fi
exit 0
%preun
if [ $1 -eq 0 ]; then
# before erase, stop service and remove log files
%{l_rc} quorum stop 2>/dev/null
rm -rf $RPM_INSTALL_PREFIX/var/quorum/log/* >/dev/null 2>&1 || true
rm -rf $RPM_INSTALL_PREFIX/var/quorum/run/* >/dev/null 2>&1 || true
rm -rf $RPM_INSTALL_PREFIX/var/quorum/data/* >/dev/null 2>&1 || true
fi
exit 0

64
quorum/rc.quorum

@ -0,0 +1,64 @@
#!@l_prefix@/bin/openpkg rc
##
## rc.quorum -- Run-Commands
##
%config
quorum_enable="$openpkg_rc_def"
quorum_flags="@flags@"
quorum_log_prolog="true"
quorum_log_epilog="true"
quorum_log_numfiles="10"
quorum_log_minsize="1M"
quorum_log_complevel="9"
%common
quorum_cfgfile="@l_prefix@/etc/quorum/quorum-geth.conf"
quorum_pidfile="@l_prefix@/var/quorum/run/quorum-geth.pid"
quorum_logfile="@l_prefix@/var/quorum/log/quorum-geth.log"
quorum_signal () {
[ -f $quorum_pidfile ] && kill -$1 `cat $quorum_pidfile`
}
%status -u @l_rusr@ -o
quorum_usable="unknown"
quorum_active="no"
rcService quorum enable yes && \
quorum_signal 0 && quorum_active="yes"
echo "quorum_enable=\"$quorum_enable\""
echo "quorum_usable=\"$quorum_usable\""
echo "quorum_active=\"$quorum_active\""
%start -u @l_rusr@
rcService quorum enable yes || exit 0
rcService quorum active yes && exit 0
( GOMAXPROCS=32
export GOMAXPROCS
nohup @l_prefix@/bin/quorum-geth \
--config "$quorum_cfgfile" \
$quorum_flags \
</dev/null >>$quorum_logfile 2>&1 &
echo $! >$quorum_pidfile
) >/dev/null 2>&1
%stop -u @l_rusr@
rcService quorum enable yes || exit 0
rcService quorum active no && exit 0
quorum_signal TERM
sleep 2
rm -f $quorum_pidfile >/dev/null 2>&1 || true
%restart -u @l_rusr@
rcService quorum enable yes || exit 0
rcService quorum active no && exit 0
rc quorum stop start
%daily -u @l_susr@
rcService quorum enable yes || exit 0
shtool rotate -f \
-n ${quorum_log_numfiles} -s ${quorum_log_minsize} -d \
-z ${quorum_log_complevel} -m 664 -o @l_rusr@ -g @l_rgrp@ \
-P "${quorum_log_prolog}" \
-E "${quorum_log_epilog}; rc quorum restart" \
$quorum_logfile
Loading…
Cancel
Save