EVMBtcRelay<B>
Defined in: atomiq-chain-evm/src/evm/btcrelay/EVMBtcRelay.ts:34
EVM BTC Relay bitcoin light client contract representation.
Extends
EVMContractBase<BtcRelayTypechain>
Type Parameters
| Type Parameter |
|---|
B extends BtcBlock |
Implements
Constructors
Constructor
new EVMBtcRelay<B>(
chainInterface,
bitcoinRpc,
bitcoinNetwork,
contractAddress,
contractDeploymentHeight?): EVMBtcRelay<B>;
Defined in: atomiq-chain-evm/src/evm/btcrelay/EVMBtcRelay.ts:112
Parameters
| Parameter | Type |
|---|---|
chainInterface | EVMChainInterface<any> |
bitcoinRpc | BitcoinRpc<B> |
bitcoinNetwork | BitcoinNetwork |
contractAddress | string |
contractDeploymentHeight? | number |
Returns
EVMBtcRelay<B>
Overrides
EVMContractBase<BtcRelayTypechain>.constructor
Properties
_bitcoinRpc
readonly _bitcoinRpc: BitcoinRpc<B>;
Defined in: atomiq-chain-evm/src/evm/btcrelay/EVMBtcRelay.ts:106
contract
readonly contract: BtcRelay;
Defined in: atomiq-chain-evm/src/evm/contract/EVMContractBase.ts:33
Inherited from
EVMContractBase.contract
maxForkHeadersPerTx
readonly maxForkHeadersPerTx: number = 50;
Defined in: atomiq-chain-evm/src/evm/btcrelay/EVMBtcRelay.ts:109
Maximum amount of fork headers that fit in a single transactions
Implementation of
maxHeadersPerTx
readonly maxHeadersPerTx: number = 100;
Defined in: atomiq-chain-evm/src/evm/btcrelay/EVMBtcRelay.ts:108
Maximum blockheaders that fit in a single transaction
Implementation of
maxShortForkHeadersPerTx
readonly maxShortForkHeadersPerTx: number = 100;
Defined in: atomiq-chain-evm/src/evm/btcrelay/EVMBtcRelay.ts:110
Maximum amount of fork headers that can be submitted at once using the short fork method
Implementation of
BtcRelay.maxShortForkHeadersPerTx
Chain
protected readonly Chain: EVMChainInterface<any>;
Defined in: atomiq-chain-evm/src/evm/contract/EVMContractBase.ts:39
Inherited from
EVMContractBase.Chain
Methods
estimateSynchronizeFee()
estimateSynchronizeFee(requiredBlockheight, feeRate?): Promise<bigint>;
Defined in: atomiq-chain-evm/src/evm/btcrelay/EVMBtcRelay.ts:431
Estimate required synchronization fee (worst case) to synchronize btc relay to the required blockheight
Parameters
| Parameter | Type | Description |
|---|---|---|
requiredBlockheight | number | Blockheight to which to synchronize |
feeRate? | string | Optional fee rate to use for the estimation |
Returns
Promise<bigint>
Implementation of
BtcRelay.estimateSynchronizeFee
getFeePerBlock()
getFeePerBlock(feeRate?): Promise<bigint>;
Defined in: atomiq-chain-evm/src/evm/btcrelay/EVMBtcRelay.ts:453
Returns required fee in native token to synchronize a single block to btc relay
Parameters
| Parameter | Type | Description |
|---|---|---|
feeRate? | string | Optional fee rate to use for the estimation |
Returns
Promise<bigint>
Implementation of
getForkFeeRate()
getForkFeeRate(signer, forkId): Promise<string>;
Defined in: atomiq-chain-evm/src/evm/btcrelay/EVMBtcRelay.ts:468
Gets fee rate required for submitting blockheaders to the specific fork
Parameters
| Parameter | Type | Description |
|---|---|---|
signer | string | A signer's address to use for the estimation |
forkId | number | A fork ID to use for estimation |
Returns
Promise<string>
Implementation of
getMainFeeRate()
getMainFeeRate(signer): Promise<string>;
Defined in: atomiq-chain-evm/src/evm/btcrelay/EVMBtcRelay.ts:461
Gets fee rate required for submitting blockheaders to the main chain
Parameters
| Parameter | Type | Description |
|---|---|---|
signer | string | A signer's address to use for the estimation |
Returns
Promise<string>
Implementation of
getTipData()
getTipData(): Promise<{
blockhash: string;
blockheight: number;
chainWork: Buffer;
commitHash: string;
}>;
Defined in: atomiq-chain-evm/src/evm/btcrelay/EVMBtcRelay.ts:263
Returns data about current main chain tip stored in the btc relay
Returns
Promise<{
blockhash: string;
blockheight: number;
chainWork: Buffer;
commitHash: string;
}>
Implementation of
retrieveLatestKnownBlockLog()
retrieveLatestKnownBlockLog(): Promise<{
resultBitcoinHeader: B;
resultStoredHeader: EVMBtcStoredHeader;
}>;
Defined in: atomiq-chain-evm/src/evm/btcrelay/EVMBtcRelay.ts:329
Retrieves latest known bitcoin blockheader stored in the BTC Relay and also known to the bitcoin RPC
Returns
Promise<{
resultBitcoinHeader: B;
resultStoredHeader: EVMBtcStoredHeader;
}>
Implementation of
BtcRelay.retrieveLatestKnownBlockLog
retrieveLogAndBlockheight()
retrieveLogAndBlockheight(blockData, requiredBlockheight?): Promise<{
header: EVMBtcStoredHeader;
height: number;
}>;
Defined in: atomiq-chain-evm/src/evm/btcrelay/EVMBtcRelay.ts:283
Retrieves blockheader with a specific blockhash, returns null if requiredBlockheight is provided and
btc relay contract is not synced up to the desired blockheight
Parameters
| Parameter | Type | Description |
|---|---|---|
blockData | { blockhash: string; } | |
blockData.blockhash | string | - |
requiredBlockheight? | number |
Returns
Promise<{
header: EVMBtcStoredHeader;
height: number;
}>
Implementation of
BtcRelay.retrieveLogAndBlockheight
retrieveLogByCommitHash()
retrieveLogByCommitHash(commitmentHashStr, blockData): Promise<EVMBtcStoredHeader>;
Defined in: atomiq-chain-evm/src/evm/btcrelay/EVMBtcRelay.ts:310
Retrieves stored bitcoin blockheader data by blockheader's commit hash and provided
blockhash from blockData
Parameters
| Parameter | Type | Description |
|---|---|---|
commitmentHashStr | string | |
blockData | { blockhash: string; } | |
blockData.blockhash | string | - |
Returns
Promise<EVMBtcStoredHeader>
Implementation of
BtcRelay.retrieveLogByCommitHash
saveForkHeaders()
saveForkHeaders(
signer,
forkHeaders,
storedHeader,
forkId,
tipWork,
feeRate?): Promise<{
computedCommitedHeaders: EVMBtcStoredHeader[];
forkId: number;
lastStoredHeader: EVMBtcStoredHeader;
tx: TransactionRequest;
}>;
Defined in: atomiq-chain-evm/src/evm/btcrelay/EVMBtcRelay.ts:397
Returns a transaction that continues submitting blockheaders to an existing long fork
Parameters
| Parameter | Type | Description |
|---|---|---|
signer | string | A signer's address for the transaction |
forkHeaders | BtcBlock[] | New fork bitcoin blockheaders to submit |
storedHeader | EVMBtcStoredHeader | Committed and stored bitcoin blockheader in the BTC relay from which to fork |
forkId | number | Fork ID to submit the blockheaders to |
tipWork | Buffer | Chainwork of the current BTC Relay main chain tip |
feeRate? | string | Optional fee rate for the transaction |
Returns
Promise<{
computedCommitedHeaders: EVMBtcStoredHeader[];
forkId: number;
lastStoredHeader: EVMBtcStoredHeader;
tx: TransactionRequest;
}>
Implementation of
saveInitialHeader()
saveInitialHeader(
signer,
header,
epochStart,
pastBlocksTimestamps,
feeRate?): Promise<TransactionRequest>;
Defined in: atomiq-chain-evm/src/evm/btcrelay/EVMBtcRelay.ts:475
Initializes the underlying BTC Relay contract
Parameters
| Parameter | Type | Description |
|---|---|---|
signer | string | A signer's address to use for the transaction |
header | B | Main chain blockheader to use as a genesis |
epochStart | number | Timestamp of the first block in this difficulty epoch |
pastBlocksTimestamps | number[] | Timestamps of the last 11 blockheaders, for median block time rule |
feeRate? | string | Optional fee rate for the transaction |
Returns
Promise<TransactionRequest>
Implementation of
saveMainHeaders()
saveMainHeaders(
signer,
mainHeaders,
storedHeader,
feeRate?): Promise<{
computedCommitedHeaders: EVMBtcStoredHeader[];
forkId: number;
lastStoredHeader: EVMBtcStoredHeader;
tx: TransactionRequest;
}>;
Defined in: atomiq-chain-evm/src/evm/btcrelay/EVMBtcRelay.ts:370
Returns a transaction that submits bitcoin blockheaders as a bitcoin main chain to the btc relay
Parameters
| Parameter | Type | Description |
|---|---|---|
signer | string | A signer's address for the transaction |
mainHeaders | BtcBlock[] | New bitcoin blockheaders to submit |
storedHeader | EVMBtcStoredHeader | Latest committed and stored bitcoin blockheader in the BTC relay |
feeRate? | string | Optional fee rate for the transaction |
Returns
Promise<{
computedCommitedHeaders: EVMBtcStoredHeader[];
forkId: number;
lastStoredHeader: EVMBtcStoredHeader;
tx: TransactionRequest;
}>
Implementation of
saveNewForkHeaders()
saveNewForkHeaders(
signer,
forkHeaders,
storedHeader,
tipWork,
feeRate?): Promise<{
computedCommitedHeaders: EVMBtcStoredHeader[];
forkId: number;
lastStoredHeader: EVMBtcStoredHeader;
tx: TransactionRequest;
}>;
Defined in: atomiq-chain-evm/src/evm/btcrelay/EVMBtcRelay.ts:379
Returns a transaction that submits a new long fork and submits the first headers to it
Parameters
| Parameter | Type | Description |
|---|---|---|
signer | string | A signer's address for the transaction |
forkHeaders | BtcBlock[] | New fork bitcoin blockheaders to submit |
storedHeader | EVMBtcStoredHeader | Committed and stored bitcoin blockheader in the BTC relay from which to fork |
tipWork | Buffer | Chainwork of the current BTC Relay main chain tip |
feeRate? | string | Optional fee rate for the transaction |
Returns
Promise<{
computedCommitedHeaders: EVMBtcStoredHeader[];
forkId: number;
lastStoredHeader: EVMBtcStoredHeader;
tx: TransactionRequest;
}>
Implementation of
saveShortForkHeaders()
saveShortForkHeaders(
signer,
forkHeaders,
storedHeader,
tipWork,
feeRate?): Promise<{
computedCommitedHeaders: EVMBtcStoredHeader[];
forkId: number;
lastStoredHeader: EVMBtcStoredHeader;
tx: TransactionRequest;
}>;
Defined in: atomiq-chain-evm/src/evm/btcrelay/EVMBtcRelay.ts:414
Returns a transaction that submits a short fork with the provided blockheaders
Parameters
| Parameter | Type | Description |
|---|---|---|
signer | string | A signer's address for the transaction |
forkHeaders | BtcBlock[] | New fork bitcoin blockheaders to submit |
storedHeader | EVMBtcStoredHeader | Committed and stored bitcoin blockheader in the BTC relay from which to fork |
tipWork | Buffer | Chainwork of the current BTC Relay main chain tip |
feeRate? | string | Optional fee rate for the transaction |
Returns
Promise<{
computedCommitedHeaders: EVMBtcStoredHeader[];
forkId: number;
lastStoredHeader: EVMBtcStoredHeader;
tx: TransactionRequest;
}>