超级节点又称为”区块生产者”,指的是那些收集、打包、验证交易信息到区块中的节点,是EOS网络稳定运行的基础。

EOS 主网络运行需要21个节点,整个网络理论上有101个节点,实际运行的时候只需要21个(设置为奇数主要是为了防止硬分叉)

EOS采用的是BFT-DPoS共识机制

超级节点的好处:

  1. 挖矿奖励
  2. EOS的每年会增发代币的5%给维持节点的人

要求:

  1. 足够多的EOS
  2. 良好的信誉保证
  3. 硬件设备,足够的带宽

任务:
提供服务器节点,保证节点的正常运行;
收集网络中的交易;
验证交易并把交易打包到区块;
广播区块给其他区块,在通过验证后将区块添加到自己本地区块链上;
保障并促进区块链项目的发展;

gen patch

  1. use git log --pretty=oneline -3 list commit
    gen patch after e7819 commit not include e7819, this may be gen several files.
  2. gen patch git format-patch e7819
    if you want gen only one file use following command
    git format-patch master --stdout > fix_empty_poster.patch

between two commits patch:
git format-patch 365a..4e16

apply patch

  1. copy .patch files to a folder

  2. take a look at what changes are in the patch
    git apply --stat patch/*.patch

  3. test before actually apply
    git apply --check patch/*.patch

  4. git am --abort abort earlier am process

  5. git am patch/*.patch

git am --signoff < fix_empty_poster.patch

Delegated Proof of Stake
Daniel Larimer
Under the hood, DPoS uses a reputation system and real-time voting to achieve consensus

ref1

Current cryptocurrency projects that use Delegated Proof of Stake:
BitShares
Steem
EOS
Lisk
Ark

To help explain this algorithm I want to assume 3 block producers, A, B, and C. Because consensus requires 2⁄3 + 1 to resolve all cases, this simplified model will assume that producer C is deemed the tie breaker. In the real world there would be 21 or more block producers.

阅读全文 »

qm 是 qt 的语言文件。用 qt 的 languist 先制作好 ts 文件,再生成 qm 文件,再在 qt 程序里面加载 qm 文件即可实现国际化
在代码中,我们使用tr()将需要翻译的字符串标记出来。lupdate工具就是提取出tr()函数中的相关字符串
如果你想要翻译函数外部的字符串,你需要使用两个宏QT_TR_NOOP()和QT_TRANSLATE_NOOP()。前者是用来翻译一个字符串,后者可以翻译多个字符串。

Proof of stake (PoS)
is a type of algorithm by which a cryptocurrency blockchain network aims to achieve distributed consensus.

GitHub

石墨烯生态的代表有 BTS,Steem 和 EOS。石墨烯采用的是 DPOS 的共识机制,出快速度大约为 1.5s,
石墨烯技术使得区块链应用更高的交易吞吐量,BTS 可以处理十万级别的 TPS,而 EOS 则是宣称百万级别的 TPS。
同时石墨烯技术高并发处理能力也是比特币和 ETH 无法做到的。

有三个项目需要克隆:graphene,graphene-ui和fc
FC库用于管理传输细节,允许节点接受各种传输协议。

Graphene has been designed especially for transactions (token transfer) and high-throughput in order to compete with Visa and Mastercard. This results in a lack of versatility

The real bottleneck is not the memory requirements, but the bandwidth requirements. At 1 million transactions per second and 256 bytes per transaction, the network would require 256 megabytes per second (1 Gbit/sec).

industrial-performance-and-scalability

  • Keep everything in memory.
  • Keep the core business logic in a single thread.
  • Keep cryptographic operations (hashes and signatures) out of the core business logic.
  • Divide validation into state-dependent and state-independent checks.
  • Use an object oriented data model.
  • Avoid synchronization primitives (locks, atomic operations).
  • Minimize unnecessary computation in the business logic processor.

https://medium.com/karmared/core-graphene-issues-uncovered-by-the-karma-team-a6c3445a114a
However, the more we’ve drilled down the Graphene core source code, the more we’ve understood why Dan Larimer left the project and completely switched to EOS. Here are some main issues we’ve found:

what-is-graphene-blockchain-and-why-should-develop-a-graphene-based-project

  1. 第一是 转账速度特别快。现在的平均确认时间是 1.5 秒,出块时间是 3 秒
    比特币是 10 分钟出块,以太坊大约是 1 分钟;确认时间上比特币是 1 小时,以太坊是十几分钟,石墨烯只需要秒级的时间。
    在石墨烯进一步进化的 EOS 上可能到了零点几秒
  2. 吞吐量比较高
    石墨烯的吞吐量现在实测大约是 3300 笔每秒,理论上可以到 10 万次
    比特币大约每秒七笔,以太坊每秒三四十笔
  3. 石墨烯极其稳定
    石墨烯技术开发运行了这么久,从来没有出过明显的 BUG,也没有资产被盗的情况。
  4. 功能非常强大、完备、容易操作
    如果我们用过一些桌面端的钱包就会发现,比特股钱包的应用性是最强的
    以多重签名来举例:比特币也有多重签名,但是比较复杂,而且功能特别简单,只有 M/N 这种模式,就是说如果是 5 个人做多重签名,3 个人同意就可以通过,这是一个很简单的多重签名。石墨烯上的多重签名功能是可以用作公司治理的,它可以设定两个参数:首先它可以设置百分比,每个人占多少百分比,无论多少人都可以随便设。第二个是阈值,就是超过多少个签名就可以生效。假设说现在想做一个 7 个人的理事会管理,有这样一些要求:任何 2 个人出事都不能影响资金的使用;至少 3 个人同意才可以动用资金;非核心成员至少 4 个人同意才能动用资金。这些条件设置好之后,可以很快的算出每个人的占比,这个多签就设置完成了,而且这是在 UI 上直接实现,在操作界面上的,而不是用命令行来实现的。
  5. 支持免费转账
  6. 使用 DPOS 共识算法
  7. The possibility of receiving a reward not only by the miners but also by other active members of the system. Creators, remitters, curators, shoppers, market makers, entrepreneurs, merchants, bloggers, referrers, community leaders, and internet leaders amongst many others.
  8. The possibility of working with several tokens in one system at once.
  9. The possibility of binding the value of the token to another currency, precious metals, etc. If there are several tokens and one tied, for instance, to USD, the internal exchange will always be at the rate of USD. It gives a sense of stability to the token holders.

代表项目

BTS

BTS。 比特股(BitShares,简称 BTS)是一个建立在区块链技术上的开源商业系统

Steem

Steem 是一个基于区块链技术的去中心化社交网络平台。

EOS

EOS.IO 软件引入了一种区块链架构。 它为满足去中心应用纵向,横向扩展需求而设计。它通过一个可以在上面构建应用程序,类似操作系统的方式来实现。 该软件提供了账号,身份认证,数据库,异步通信,以及跨多核 CPU 或集群调度应用程序等功能。 由此而形成一种区块链架构, 它能达到每秒百万交易量的处理,用户可免费使用,且很容易快速部署去中心化应用。EOS 采用 DPOS 算法,在该共识算法下,在采用 EOS.IO 软件的区块链上,那些持有代币的人可以通过了一个连续的赞成投票系统来选择矿工。任何人可以选择参与挖矿,并有机会获得其相应比例的区块奖励,而这是跟其获得票数与其他所有矿工所获得票数成比例。如果读者对 EOS 感兴趣,可以去 GitHub 阅读下它的相关文档。

ZeroMQ high-water mark (HWM) queues

These are the socket combinations that are valid for a connect-bind pair (either side can bind):
PUB and SUB
REQ and REP
REQ and ROUTER (take care, REQ inserts an extra null frame)
DEALER and REP (take care, REP assumes a null frame)
DEALER and ROUTER
DEALER and DEALER
ROUTER and ROUTER
PUSH and PULL
PAIR and PAIR

ZMQ_POLLIN

对于ZMQ socket来说,至少有一个消息在这个socket上被非阻塞的接收到了。对于标准socket来说,此标志和系统调用的poll()函数的POLLIN标志等价,而且通常意味着,fd文件描述符上至少非阻塞的接收到了1B的数据。

zmq_inproc – ØMQ 本地进程内(线程间)传输方式

zmq_proxy

Socket types

Thread safety: ZeroMQ的socket是非线程安全的,并且ZeroMQ本身不建议在多个线程中传递同一个Socket,即使保证了线程同步。
Socket types: ZeroMQ一共具有12种类型的socket,5种消息模式。

  • 请求/应答模式:ZMQ_REQ、ZMQ_REP、ZMQ_DEALER、ZMQ_ROUTER
  • 发布/订阅模式: ZMQ_PUB, ZMQ_SUB、ZMQ_XPUB、ZMQ_XSUB
  • 管道模式:ZMQ_PUSH、ZMQ_PULL
  • 配对模式:ZMQ_PAIR
  • 本地模式:ZMQ_STREAM

Request-Reply 请求/应答模式

fc0c497b.png

Here are some tips for remembering the semantics. DEALER is like an asynchronous REQ socket, and ROUTER is like an asynchronous REP socket. Where we use a REQ socket, we can use a DEALER; we just have to read and write the envelope ourselves. Where we use a REP socket, we can stick a ROUTER; we just need to manage the identities ourselves.

Think of REQ and DEALER sockets as “clients” and REP and ROUTER sockets as “servers”. Mostly, you’ll want to bind REP and ROUTER sockets, and connect REQ and DEALER sockets to them. It’s not always going to be this simple, but it is a clean and memorable place to start.

ZMQ_ROUTER

A socket of type ZMQ_ROUTER is an advanced pattern used for extending request/reply sockets.

ZMQ_DEALER

DEALER是一种用于请求/答应模式的更高级的扩展Socket,它可以自由的收发消息,没有ZMQ_REP/ZMQ_REQ那样的限制。
对于每一个连接,接收消息也是使用了公平队列,发送使用了循环队列(RR)。
ZMQ_DEALER受ZMQ_RCVHW和ZMQ_SNDHW两个阀值影响(可通过zmq_setsockopt函数设置),一旦发送或接收队列达到阀值,Socket就会进入mute状态,
此时对DEALER的任何zmq_send操作都会阻塞,直到mute状态结束。
如果当前没有有效的连接,zmq_send操作也会阻塞,直到有新的连接到来为止。
DEALER发生阻塞并不会丢弃消息。

注意:如果ZMQ_DEALER连接到ZMQ_REP,每一个消息包必须包含一个空帧,然后再紧跟着数据包体。
特点总结:
可兼容的Socket types: ZMQ_ROUTER, ZMQ_REP, ZMQ_DEALER
数据传输: 双向
发送/接收模式: 无限制
发送路由策略: Round-robin(循环队列)
接收路由策略: Fair-queued(公平队列)
进入mute状态后: 阻塞

PUB/SUB 发布/订阅模式

6b377fd8.png
  • ZMQ_PUB

ZMQ_PUB类型的Socket以发布者的身份向订阅者分发消息,消息以扇出的形式发送给所有订阅者连接。

ZMQ_PUB类型的Socket没有实现zmq_recv函数,所以不能对其调用zmq_recv函数!
当ZMQ_PUB Socket达到阀值时进入mute状态,此时后续发送的消息会被丢弃,直到mute状态结束。
对ZMQ_PUB Socket调用zmq_send永远不会发生阻塞。

特点总结:

  • 可兼容的Socket types: ZMQ_SUB, ZMQ_XSUB

  • 数据传输: 单向

  • 发送/接收模式: 只能发送

  • 接收路由策略: Fan out(扇出)

  • 进入mute状态后: 丢弃消息

  • ZMQ_SUB

ZMQ_SUB类型的Socket以订阅者的身份接收消息。初始的ZMQ_SUB Socket没有订阅任何消息,可以通过设置ZMQ_SUBSRIBE选项来指定需要订阅的消息。

ZMQ_SUB Socket没有实现zmq_send函数,所以不能对其调用zmq_send函数!

特点总结:

  • 可兼容的Socket types: ZMQ_PUB, ZMQ_XPUB
  • 数据传输: 单向
  • 发送/接收模式: 只能接收
  • 接收路由策略: Fair-queued(公平队列)

管道模式 ZMQ_PUSH ZMQ_PULL

be9e302e.png

Fair Queuing
3cecf366.png

是单向的,即PUSH端发送消息,PULL端接收消息

this is official way to compile primecoin-core/bitcoin

ubuntu 16.04 compile primecoin-core 0.16.1 statically

error: unknown type name '__locale_t' __locale_t __loc)
sudo apt-get install libcurl4-gnutls-dev

tested in ubuntu 14.04,16.04,18.04 first system install

sudo apt update
sudo apt upgrade
sudo apt install -y build-essential autoconf libtool pkg-config libboost-all-dev libssl-dev libevent-dev libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools libprotobuf-dev protobuf-compiler libqrencode-dev libminiupnpc-dev curl

cd depends
make
cd ..
./autogen.sh
./configure --enable-glibc-back-compat --prefix=`pwd`/depends/x86_64-pc-linux-gnu --disable-shared LDFLAGS="-static-libstdc++"
make STATIC=all

mkdir ./dist
cp ./src/primecoind ./src/primecoin-* ./src/qt/primecoin-qt ./dist
strip ./dist/*

//following config as backup, don't see other errors now.
if has following problem, not encountered so far:
./bitcoind: /lib64/libc.so.6: version `GLIBC_2.15' not found (required by ./bitcoind)
./bitcoind: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by ./bitcoind)
Answer:
./configure --enable-glibc-back-compat --prefix=`pwd`/depends/x86_64-pc-linux-gnu LDFLAGS="-static-libstdc++"

cross compile for win64/32

if want to compile win32 version just need change x86_64-w64-mingw32

sudo apt-get update
sudo apt-get install -y build-essential autoconf libtool pkg-config libboost-all-dev libssl-dev libevent-dev libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools libprotobuf-dev protobuf-compiler libqrencode-dev libminiupnpc-dev curl

// cross compile specific depends
sudo apt install -y autotools-dev automake pkg-config bsdmainutils curl git g++-mingw-w64-x86-64 nsis

sudo apt install -y software-properties-common
sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu zesty universe"
sudo apt update
sudo apt upgrade
# Set the default mingw32 g++ compiler option to posix.
sudo update-alternatives --config x86_64-w64-mingw32-g++

# strip out problematic Windows %PATH% imported var
PATH=$(echo "$PATH" | sed -e 's/:\/mnt.*//g')

cd depends
make HOST=x86_64-w64-mingw32
cd ..
./autogen.sh
./configure --prefix=`pwd`/depends/x86_64-w64-mingw32 --disable-shared
make STATIC=all

mkdir release
cp ./src/primecoind.* ./src/primecoin-* ./src/qt/primecoin-qt.* ./release

// package installer
makensis share/setup.nsi

cross compile for mac

sudo apt-get update
sudo apt-get install -y build-essential autoconf libtool pkg-config libboost-all-dev libssl-dev libevent-dev libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools libprotobuf-dev protobuf-compiler libqrencode-dev libminiupnpc-dev curl

for mac cross build
sudo apt-get install curl librsvg2-bin libtiff-tools bsdmainutils cmake imagemagick libcap-dev libz-dev libbz2-dev python-setuptools

need SDKs of Xcode_7.3.1.dmg
hdiutil attach Xcode_7.3.1.dmg
tar -C /Volumes/Xcode/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/ -czf MacOSX10.11.sdk.tar.gz MacOSX10.11.sdk
unpack to depends/SDKs/MacOSX10.11.sdk

cd depends
make HOST=x86_64-apple-darwin11
cd ..
./autogen.sh
./configure --prefix=`pwd`/depends/x86_64-apple-darwin11 --disable-shared
make STATIC=all
make deploy