Search code examples
wavesplatformride

How Can i Know the current blockchain height from RIDE?


I need to know the current height of the blockchain from a RIDE script and add to the current height more or less the height of one week. I tried this:

let currentHeight = transactionHeightById(i.transactionId) 
let finishHeight = currentHeight + (7*1440)

Is this the correct/best way? Also when trying to get finishHeight I am getting this error:

Compilation failed: Can't find a function overload '+'(Int|Unit, Int) in 952-974


Solution

  • The current WAVES blockchain height in RIDE is contained in the variable height. So for knowing the current height and add about a week time (in height) to it:

    [...]
    else if (contestStartHeight <= height) then throw("Start Height must be greater than current Blockchain height: " + toString(height))
    else {
        let contestFinishHeight = contestStartHeight + (7*1440)
    }
    [...]