// Copyright 2017-2021 DERO Project. All rights reserved.
// Use of this source code in any form is governed by RESEARCH license.
// license can be found in the LICENSE file.
// GPG: 0F39 E425 8C65 3947 702A 8234 08B2 0360 A03A 9DE8
//
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
// EXPRESS 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 COPYRIGHT HOLDER OR 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 main
// this files defines all the templates
var header_template string = `
{{define "header"}}
{{ .title }}
{{if .Network_Difficulty}}
Server time: {{ .servertime }} | Transaction pool
Network difficulty: {{ .Network_Difficulty }}
| Hash rate: {{ .hash_rate }} KH/s
| Average Block Time(50) {{.averageblocktime50}} sec
| Total supply : {{ .total_supply }}
| Mempool size : {{ .txpool_size }}
| Fee per kb: {{.fee_per_kb}}
| Median block size limit: {{.median_block_size}} kB
{{end}}
{{end}}
`
var block_template string = `{{define "block"}}
{{ template "header" . }}
Block Topo height (unique): {{.block.TopoHeight}} Block height: ({{.block.Height}})
Block hash: {{.block.Hash}}
{{range $i, $a := .block.Tips}}
Previous blocks: {{$a}}
{{end}}
Timestamp [UCT] (epoch): | {{.block.Block_time}} ({{.block.Epoch}}) |
Age [h:m:s]: | {{.block.Age}} |
Δ [h:m:s]: | |
Major.minor version: | {{.block.Major_Version}}.{{.block.Minor_Version}} |
Block reward: | {{.block.Reward}} |
Block size [kB]: | {{.block.Size}} |
nonce: | {{.block.Nonce}} |
Total fees: | {{.block.Fees}} |
No of txs: | {{.block.Tx_Count}} |
Miner reward for this block
Miner Address |
outputs |
size [kB] |
version |
{{index .block.Mtx.OutAddress 0}}
| {{.block.Mtx.Amount}} |
{{.block.Mtx.Size}} |
{{.block.Mtx.Version}} |
Transactions ({{.block.Tx_Count}})
hash |
type |
fee |
ring size |
version |
size [kB] |
{{range .block.Txs}}
{{if .Skipped }}{{.Hash}} |
{{else}}
{{.Hash}} |
{{end}}
{{.TransactionType}} |
{{.Fee}} |
{{.Ring_size}} |
{{.Version}} |
{{.Size}} |
{{end}}
{{ template "footer" . }}
{{end}}
`
var tx_template string = `{{define "tx"}}
{{ template "header" . }}
Tx hash: {{.info.Hash}} Type {{.info.TransactionType }}
{{if eq .info.TransactionType "BURN" }}
Burns: {{.info.Burn_Value }} DERO
{{end}}
{{range $i, $e := .info.InvalidBlock}}
{{end}}
{{if eq .info.TransactionType "PREMINE"}}
{{index .info.OutAddress 0}} Registered with funds {{.info.Amount}} |
{{end}}
{{if eq .info.TransactionType "REGISTRATION"}}
{{index .info.OutAddress 0}} Registered |
{{end}}
{{if or (eq .info.TransactionType "NORMAL") (eq .info.TransactionType "BURN") (eq .info.TransactionType "SC") }}
Tx RootHash: {{.info.RootHash}} built height : {{.info.HeightBuilt}}
{{if .info.PayID32}}
PaymentID: {{.info.PayID32}}
{{end}}
{{if .info.PayID8}}
Encrypted PaymentID: {{.info.PayID8}}
{{end}}
Timestamp: {{.info.Timestamp}} |
Timestamp [UTC]: {{.info.Block_time}} |
Age [y:d:h:m:s]: {{.info.Age}} |
Block: {{.info.Height}} |
Fee: {{.info.Fee}} |
Tx size: {{.info.Size}} kB |
Tx version: {{.info.Version}} |
No of confirmations: {{.info.Depth}} |
Signature type: {{.info.Type}} |
Extra: {{.info.Extra}} |
{{range $ii, $ee := .info.Assets}}
{{if eq $ee.SCID "0000000000000000000000000000000000000000000000000000000000000000" }}
DERO : {{$ee.Ring_size}} inputs/outputs (RING size) Fees {{$ee.Fees}}
{{if eq $.info.TransactionType "SC"}}
Deposited to SC {{$ee.Burn}}
{{else}}
Burned {{$ee.Burn}}
{{end}}
{{else}}
SCID: {{$ee.SCID}} {{$ee.Ring_size}} inputs/outputs (RING size) Fees {{$ee.Fees}} {{if eq $.info.TransactionType "SC"}}
Deposited Tokens to SC {{$ee.Burn}}
{{else}}
Burned {{$ee.Burn}}
{{end}}
{{end}}
address |
{{range $i, $e := $ee.Ring}}
{{ $e }} |
{{end}}
{{end}}
{{if eq .info.TransactionType "SC"}}
SC Balance: {{ .info.SC_Balance_string }} DERO |
SC CODE: {{ .info.SC_Code }} |
SC Arguments: {{ .info.SC_Args }} |
{{end}}
Prove to someone that you have sent them DERO in this transaction |
proof can be obtained using get_tx_key
command in dero-wallet-cli or from the statement
Note: proof is sent to the server, as the calculations are done on the server side
|
|
{{if .info.Proof_amount }}
{{.info.Proof_address}} Received {{.info.Proof_amount}} DERO
{{if .info.Proof_Payload}}
Decoded Data {{ .info.Proof_Payload}}
Raw Data
{{ .info.Proof_Payload_raw}}
{{end}}
|
{{end}}
{{if .info.Proof_error }}
{{.info.Proof_error}}
|
{{end}}
{{end}}
{{if eq .info.CoinBase false}}
{{end}}
{{ template "footer" . }}
{{end}}`
var txpool_template string = `{{define "txpool"}}
Transaction pool
(no of txs: {{ .txpool_size }}, size: 0.00 kB, updated every 5 seconds)
height built |
transaction hash |
fee |
ring size |
tx size [kB] |
{{range .mempool}}
{{.HeightBuilt}} |
{{.Hash}} |
{{.Fee}} |
{{.Ring_size}} |
{{.Size}} |
{{end}}
{{end}}`
// full page txpool_template
var txpool_page_template string = `{{define "txpool_page"}}
{{ template "header" . }}
{{ template "txpool" . }}
{{ template "footer" . }}
{{end}}`
// not found page txpool_template
var notfound_page_template string = `{{define "notfound_page"}}
{{ template "header" . }}
No details found in database
{{ template "footer" . }}
{{end}}`
var main_template string = `
{{define "main"}}
{{ template "header" . }}
{{ template "txpool" . }}
Transactions in the last 11 blocks
(Median size of these blocks: 0.09 kB)
{{ template "paging" . }}
height |
topo height |
age [h:m:s] |
size [kB] |
tx hash |
type |
fees |
ring size |
tx size [kB] |
{{range .block_array}}
{{if .SyncBlock }} {{.Height}} {{else}} {{.Height}} {{end}} |
{{.TopoHeight}} |
{{.Age}} |
{{.Size}} |
block {{.Hash}} |
N/A |
{{.Mtx.Amount}} |
0 |
{{.Mtx.Size}} |
{{range .Txs}}
|
|
|
|
{{if .Skipped }}{{.Hash}} |
{{else}}
{{.Hash}} |
{{end}}
{{.TransactionType}} |
{{.Fee}} |
{{.Ring_size}} |
{{.Size}} |
{{end}}
{{end}}
{{ template "paging" . }}
{{ template "footer" . }}
{{end}}`
var paging_template string = `{{ define "paging"}}
{{end}}`
var footer_template string = ` {{define "footer"}}
DERO explorer source code
| explorer version (api): under development (1.0)
| dero version: golang pre-alpha
| Copyright 2017-2021 Dero Project
{{end}}
`