Skip to content

Latest commit

 

History

History
275 lines (125 loc) · 7.35 KB

bitcoin.md

File metadata and controls

275 lines (125 loc) · 7.35 KB

Module 0x4::bitcoin

Struct UTXONotExistsEvent

struct UTXONotExistsEvent has copy, drop

Struct RepeatCoinbaseTxEvent

struct RepeatCoinbaseTxEvent has copy, drop

Resource BitcoinBlockStore

struct BitcoinBlockStore has key

Constants

const ORDINAL_GENESIS_HEIGHT: u64 = 767430;

https://github.com/bitcoin/bips/blob/master/bip-0034.mediawiki

const BIP_34_HEIGHT: u64 = 227835;

If the process block failed, we need to stop the system and fix the issue

const ErrorBlockProcessError: u64 = 1;

The reorg is too deep, we need to stop the system and fix the issue

const ErrorReorgTooDeep: u64 = 3;

const ErrorUTXONotExists: u64 = 4;

const ORDINALS_PAUSE_HEIGHT: u64 = 859001;

Function genesis_init

public(friend) fun genesis_init(_genesis_account: &signer, genesis_block_height: u64, genesis_block_hash: address)

Function get_tx

public fun get_tx(txid: address): option::Option<types::Transaction>

Function get_tx_height

public fun get_tx_height(txid: address): option::Option<u64>

Function get_block

Get block via block_hash

public fun get_block(block_hash: address): option::Option<types::Header>

Function get_block_height

public fun get_block_height(block_hash: address): option::Option<u64>

Function get_block_hash_by_height

Get block hash via block_height

public fun get_block_hash_by_height(block_height: u64): option::Option<address>

Function get_block_by_height

Get block via block_height

public fun get_block_by_height(block_height: u64): option::Option<types::Header>

Function get_genesis_block

Function get_latest_block

Get latest block height

Function get_bitcoin_time

Get the bitcoin time in seconds

public fun get_bitcoin_time(): u32

Function contains_header

public fun contains_header(block_header: &types::Header): bool