大螃嗨

好记性不如烂笔头

用户工具

站点工具


ripple瑞波

基本信息收集

真实的测试账户私钥:~/Workdir/privatekey/mykey/xrp.wallet rLAEU5v76HPqy8RCzozP4b12ahnmEKNYah

代码仓库:https://github.com/ripple/rippled

API列表:https://developers.ripple.com/account-methods.html

API列表中文:https://blog.csdn.net/sinat_34070003/article/details/79630300

Javascript版本的API封装文档:https://developers.ripple.com/rippleapi-reference.html

JS版本签名交易流程:https://blog.csdn.net/u011374344/article/details/79314454

代码编译和配置运行:https://developers.ripple.com/build-run-rippled-ubuntu.html

服务器架设说明文档:https://developers.ripple.com/manage-the-rippled-server.html

测试链的文档:https://developers.ripple.com/start-a-new-genesis-ledger-in-stand-alone-mode.html

地址格式和账户相关说明:https://developers.ripple.com/basic-data-types.html

账户和地址编码流程:https://developers.ripple.com/accounts.html

中文扫盲:https://wiki.chainnova.com/pages/viewpage.action?pageId=3997790

交易所可以借助原生Ripple的多个应用程序编程接口(API),直接接入XRP Ledger:https://developers.ripple.com/list-xrp-in-your-exchange.html

瑞波扫块

感觉瑞波好像不用扫块,原因如下:

https://developers.ripple.com/intro-to-consensus.html

Each ledger version is numbered with a ledger index and builds on a previous ledger version whose index is one less, going all the way back to a starting point called the genesis ledger with ledger index 1.¹ Like Bitcoin and other blockchain technologies, this forms a public history of all transactions and their results. Unlike many blockchain technologies, each new “block” in the XRP Ledger contains the entirety of the current state, so you don't need to collect the entire history to know what's happening now.²

通过yum在centos上安装:

  1.数字列表项目Install the Ripple RPM repository:
    $ sudo rpm -Uvh https://mirrors.ripple.com/ripple-repo-el7.rpm
  2.Install the rippled software package:
    $ sudo yum install --enablerepo=ripple-stable rippled
  3.Configure the rippled service to start on system boot:
    $ sudo systemctl enable rippled.service
  4.Start the rippled service
    $ sudo systemctl start rippled.service

关键参数设置:

  • node_size
  • node_db
  • online_delete 这两个参数和精简模式有关系
  • advisory_delete 这两个参数和精简模式有关系
  • log_level 日志级别
  • database_path
  • node_db

以下3个参数和集群配置相关摘自:https://developers.ripple.com/cluster-rippled-servers.html

对亚马逊服务器磁盘的要求,不能使用EBS,原因是读写IOPS跟不上:

Amazon Web Services (AWS) is a popular virtualized hosting environment. You can run rippled in AWS, but Ripple does not recommend using Elastic Block Storage (EBS). Elastic Block Storage's maximum number of IOPS (5,000) is insufficient for rippled's heaviest loads, despite being very expensive.

Node Size The node_size parameter determines the size of database caches. Larger database caches decrease disk I/O requirements at a cost of higher memory requirements. Ripple recommends you always use the largest database cache your available memory can support. See the following table for recommended settings.

Recommendation Available RAM for rippled node_size value Notes < 8GB tiny Not recommended 8GB low 16GB medium 32GB huge Recommended for production servers

编译节点

依赖项目安装: $ sudo yum install -y gcc gcc-c++ gcc-g++ wget git cmake protobuf-compiler openssl-devel

安装python3: $ sudo yum install centos-release-scl $ sudo yum install rh-python36 设置环境变量

安装BOOST $ sudo wget https://dl.bintray.com/boostorg/release/1.67.0/source/boost_1_67_0.tar.gz $ sudo tar -xzf boost_1_67_0.tar.gz $ cd boost_1_67_0 $ sudo ./bootstrap.sh –prefix=/usr/local/include/boost $ sudo ./b2 –build-type=complete –layout=tagged install

编译boost报错:

找到如下文件:
/app/boost_1_67_0/tools/build/src/tools/python.jam

修改如下:
includes ?= $(prefix)/include/python$(version) ;  错误

includes ?= $(prefix)/include/python$(version)m ;  正确

打开:
./bootstrap.sh

修改:PYTHON=python 为 PYTHON=python3.6

$ export BOOST_ROOT=/app/boost_1_67_0 $ sudo mkdir /app/ripples/my_build $ cd my_build

安装cmake3 $ sudo git clone https://gitlab.kitware.com/cmake/cmake.git $ cd cmake $ sudo ./bootstrap $ sudo make $ sudo make install

$ sudo /usr/local/bin/cmake -DCMAKE_BUILD_TYPE=Release .. 先不用这条$ sudo /usr/local/bin/cmake -DCMAKE_CXX_COMPILER=/opt/rh/devtoolset-4/root/usr/bin/g++ .. $ scl enable devtoolset-4 bash

节点搭建步骤(系统centos7.4): $ wget http://cbs.centos.org/kojifiles/packages/protobuf/2.5.0/10.el7.centos/x86_64/protobuf-2.5.0-10.el7.centos.x86_64.rpm $ wget http://cbs.centos.org/kojifiles/packages/protobuf/2.5.0/10.el7.centos/x86_64/protobuf-devel-2.5.0-10.el7.centos.x86_64.rpm $ wget http://cbs.centos.org/kojifiles/packages/protobuf/2.5.0/10.el7.centos/x86_64/protobuf-compiler-2.5.0-10.el7.centos.x86_64.rpm $ sudo yum -y install protobuf-2.5.0-10.el7.centos.x86_64.rpm \ protobuf-compiler-2.5.0-10.el7.centos.x86_64.rpm \ protobuf-devel-2.5.0-10.el7.centos.x86_64.rpm

编译g++ 5.3 $ sudo yum install libmpc-devel mpfr-devel gmp-devel $ yum install zlib-devel* $ curl ftp://ftp.gnu.org/pub/gnu/gcc/gcc-5.3.0/gcc-5.3.0.tar.bz2 -O $ tar xvfj gcc-5.3.0.tar.bz2 $ cd tcc-5.3.0 $ ./configure –with-system-zlib –disable-multilib –enable-languages=c,c++ $ make -j 4 $ make install

编译节点: $ sudo git clone https://github.com/ripple/rippled.git $ cd rippled $ sudo git checkout master $ sudo mkdir my_build $ cd my_build $ sudo /usr/local/bin/cmake -DCMAKE_BUILD_TYPE=Release .. 报boost版本错误时的备用命令:sudo /usr/local/bin/cmake -DBOOST_INCLUDEDIR=/usr/local/include/boost/include -DCMAKE_CXX_COMPILER=/usr/local/bin/g++ -DCMAKE_BUILD_TYPE=Release .. $ sudo /usr/local/bin/cmake –build . – -j 2

下面编译依赖工具库 $ sudo git clone –recursive https://github.com/ripple/validator-keys-tool.git $ cd ${YOUR_VALIDATOR_KEYS_TOOL_DIRECTORY} $ sudo mkdir -p build/gcc.debug $ cd build/gcc.debug $ sudo /usr/local/bin/cmake ../.. 先不用这条$ sudo /usr/local/bin/cmake -DCMAKE_CXX_COMPILER=/opt/rh/devtoolset-4/root/usr/bin/g++ ../.. $ sudo /usr/local/bin/cmake –build .

启动节点

$ ./validator-keys create_keys

 输出:Validator keys stored in /home/centos/.ripple/validator-keys.json
 

$ ./validator-keys create_token –keyfile /home/centos/.ripple/validator-keys.json

$ mkdir -p ~/.config/ripple $ cp cfg/rippled-example.cfg /etc/opt/ripple/rippled.cfg $ cp cfg/validators-example.txt /etc/opt/ripple/validators.txt $ ./rippled –conf=/etc/opt/ripple/rippled.cfg

编译安装ripple-lib

安装Node.js

$ curl –silent –location https://rpm.nodesource.com/setup_10.x | sudo bash - $ sudo yum -y install nodejs

创建封装工程

$ mkdir my_ripple_experiment && cd my_ripple_experiment $ git init https://developers.ripple.com/get-started-with-rippleapi-for-javascript.html $

三大接口

Javascript版本的API封装文档:https://developers.ripple.com/rippleapi-reference.html

安装express封装REST接口: $ sudo npm install express

地址创建

直接封装接口:generateAddress

官方说明文档:https://developers.ripple.com/rippleapi-reference.html#generateaddress

官方推荐调用时不添加参数,这样可以生成比较随机的种子。

Specifying a Seed https://developers.ripple.com/wallet_propose.html For most cases, you should use a seed value generated from a strong source of randomness. Anyone who knows the seed value for an address has full power to send transactions signed by that address. Generally, running this command with no parameters is a good way to generate a random seed.

查询余额

封装接口:getBalances

官方说明文档:https://developers.ripple.com/rippleapi-reference.html#getbalances

发起交易

https://developers.ripple.com/rippleapi-reference.html

  1. 创建原始交易(接口:preparepayment)
  2. 原始交易签名(接口:sign)
  3. 签名交易广播(接口:submit)
ripple瑞波.txt · 最后更改: 2018/09/12 04:27 由 螃蟹