Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Current »

This guide describes how to update the block height numbers on the REV issuance timer to be published on https://developer.rchain.coop/token-swap. Once the timer launches, the block height numbers will be updated on a weekly cadence.

Step-by-step guide

  1. Use the bash script shown below. Save as a text file to your local environment (for example, with the filename "blocks").
  2. In the terminal make the file executable

    chmod 755 blocks
  3. Execute the script with the specification of how many days before 2018-12-05 and how many days after.  In this example, it computes the expected block numbers for a window 30 days before and 90 days after:

    ./blocks 30 90

    These numbers should both be decreased every time the website timer is updated.

  4. After the script runs, find the new numbers in the log

  5. Use these numbers to update the numbers on the timer.

Example

 

Timer bash script

#!/bin/bash
block=$((curl etherscan.io 2> /dev/null) | tr '<' '\n' | tr '>' '\n' | grep -e ^[0-9][0-9]*$)
# echo block=$block

rate=$((curl etherscan.io 2> /dev/null) | tr '<' '\n' | tr '(' '\n' | grep [0-9]s\) | sed -n "s/^\([0-9][0-9].[0-9]\).*$/\1/p")
# echo rate=$rate s/blk

now=$(date +%s)
let seconds=1543968000-now
# echo seconds till 2018-12-05=$seconds

openWindow=$1
let afterSec=seconds-\(openWindow*86400\)
closeWindow=$2
let beforeSec=seconds+\(closeWindow*86400\)

after=$(echo $block+\($afterSec/$rate\) | bc -l | sed -n "s/^\([0-9]*\).*$/\1/p")
echo $after

before=$(echo $block+\($beforeSec/$rate\) | bc -l | sed -n "s/^\([0-9]*\).*$/\1/p")
echo $before



  • No labels