-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
1,393 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[package] | ||
name = "raw_blocks_bitcoin" | ||
edition = { workspace = true } | ||
version = { workspace = true } | ||
|
||
[lib] | ||
crate-type = ["cdylib"] | ||
|
||
[dependencies] | ||
common = { path = "../../common" } | ||
substreams-bitcoin = { workspace = true } | ||
substreams = { workspace = true } | ||
prost = { workspace = true } | ||
prost-types = { workspace = true } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
.PHONY: all | ||
all: | ||
make build | ||
make pack | ||
make graph | ||
make info | ||
|
||
.PHONY: build | ||
build: | ||
cargo build --target wasm32-unknown-unknown --release | ||
|
||
.PHONY: pack | ||
pack: | ||
substreams pack | ||
|
||
.PHONY: graph | ||
graph: | ||
substreams graph | ||
|
||
.PHONY: info | ||
info: | ||
substreams info | ||
|
||
.PHONY: protogen | ||
protogen: | ||
substreams protogen --exclude-paths google | ||
|
||
.PHONY: parquet | ||
parquet: | ||
substreams-sink-files run bitcoin.substreams.pinax.network:443 substreams.yaml map_events './out' 800000:800500 --encoder parquet --file-block-count 100 --development-mode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
use substreams::{errors::Error, pb::substreams::Clock}; | ||
use substreams_bitcoin::pb::btc::v1::Block; | ||
|
||
use crate::pb::bitcoin::Events; | ||
|
||
#[substreams::handlers::map] | ||
pub fn map_events(block: Block, clock: Clock) -> Result<Events, Error> { | ||
Ok(Events::default()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
mod events; | ||
mod pb; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,169 @@ | ||
// @generated | ||
// This file is @generated by prost-build. | ||
#[allow(clippy::derive_partial_eq_without_eq)] | ||
#[derive(Clone, PartialEq, ::prost::Message)] | ||
pub struct Events { | ||
#[prost(message, repeated, tag="1")] | ||
pub blocks: ::prost::alloc::vec::Vec<Block>, | ||
#[prost(message, repeated, tag="2")] | ||
pub transactions: ::prost::alloc::vec::Vec<Transaction>, | ||
#[prost(message, repeated, tag="3")] | ||
pub inputs: ::prost::alloc::vec::Vec<Input>, | ||
#[prost(message, repeated, tag="4")] | ||
pub outputs: ::prost::alloc::vec::Vec<Output>, | ||
} | ||
#[allow(clippy::derive_partial_eq_without_eq)] | ||
#[derive(Clone, PartialEq, ::prost::Message)] | ||
pub struct Block { | ||
#[prost(message, optional, tag="1")] | ||
pub time: ::core::option::Option<::prost_types::Timestamp>, | ||
#[prost(int64, tag="2")] | ||
pub height: i64, | ||
#[prost(string, tag="3")] | ||
pub date: ::prost::alloc::string::String, | ||
#[prost(string, tag="4")] | ||
pub hash: ::prost::alloc::string::String, | ||
#[prost(string, tag="5")] | ||
pub bits: ::prost::alloc::string::String, | ||
#[prost(string, tag="6")] | ||
pub chainwork: ::prost::alloc::string::String, | ||
#[prost(double, tag="7")] | ||
pub difficulty: f64, | ||
#[prost(double, tag="8")] | ||
pub total_fees: f64, | ||
#[prost(double, tag="9")] | ||
pub total_reward: f64, | ||
#[prost(double, tag="10")] | ||
pub mint_reward: f64, | ||
#[prost(string, tag="11")] | ||
pub merkle_root: ::prost::alloc::string::String, | ||
#[prost(int64, tag="12")] | ||
pub transaction_count: i64, | ||
#[prost(int64, tag="13")] | ||
pub nonce: i64, | ||
#[prost(string, tag="14")] | ||
pub coinbase: ::prost::alloc::string::String, | ||
#[prost(string, tag="15")] | ||
pub previous_block_hash: ::prost::alloc::string::String, | ||
#[prost(int64, tag="16")] | ||
pub size: i64, | ||
#[prost(int64, tag="17")] | ||
pub stripped_size: i64, | ||
#[prost(int64, tag="18")] | ||
pub version: i64, | ||
#[prost(int64, tag="19")] | ||
pub weight: i64, | ||
} | ||
#[allow(clippy::derive_partial_eq_without_eq)] | ||
#[derive(Clone, PartialEq, ::prost::Message)] | ||
pub struct Transaction { | ||
#[prost(message, optional, tag="1")] | ||
pub block_time: ::core::option::Option<::prost_types::Timestamp>, | ||
#[prost(string, tag="2")] | ||
pub block_date: ::prost::alloc::string::String, | ||
#[prost(int64, tag="3")] | ||
pub block_height: i64, | ||
#[prost(int32, tag="4")] | ||
pub index: i32, | ||
#[prost(string, tag="5")] | ||
pub block_hash: ::prost::alloc::string::String, | ||
#[prost(string, tag="6")] | ||
pub id: ::prost::alloc::string::String, | ||
#[prost(int64, tag="7")] | ||
pub lock_time: i64, | ||
#[prost(int64, tag="8")] | ||
pub size: i64, | ||
#[prost(int64, tag="9")] | ||
pub virtual_size: i64, | ||
#[prost(string, tag="10")] | ||
pub coinbase: ::prost::alloc::string::String, | ||
#[prost(bool, tag="11")] | ||
pub is_coinbase: bool, | ||
#[prost(int64, tag="12")] | ||
pub version: i64, | ||
#[prost(int32, tag="13")] | ||
pub input_count: i32, | ||
#[prost(int32, tag="14")] | ||
pub output_count: i32, | ||
#[prost(double, tag="15")] | ||
pub input_value: f64, | ||
#[prost(double, tag="16")] | ||
pub output_value: f64, | ||
#[prost(double, tag="17")] | ||
pub fee: f64, | ||
#[prost(string, tag="18")] | ||
pub hex: ::prost::alloc::string::String, | ||
} | ||
#[allow(clippy::derive_partial_eq_without_eq)] | ||
#[derive(Clone, PartialEq, ::prost::Message)] | ||
pub struct Input { | ||
#[prost(message, optional, tag="1")] | ||
pub block_time: ::core::option::Option<::prost_types::Timestamp>, | ||
#[prost(string, tag="2")] | ||
pub block_date: ::prost::alloc::string::String, | ||
#[prost(int64, tag="3")] | ||
pub block_height: i64, | ||
#[prost(string, tag="4")] | ||
pub block_hash: ::prost::alloc::string::String, | ||
#[prost(string, tag="5")] | ||
pub tx_id: ::prost::alloc::string::String, | ||
#[prost(int32, tag="6")] | ||
pub index: i32, | ||
#[prost(int64, tag="7")] | ||
pub spent_block_height: i64, | ||
#[prost(string, tag="8")] | ||
pub spent_tx_id: ::prost::alloc::string::String, | ||
#[prost(int64, tag="9")] | ||
pub spent_output_number: i64, | ||
#[prost(double, tag="10")] | ||
pub value: f64, | ||
#[prost(string, tag="11")] | ||
pub address: ::prost::alloc::string::String, | ||
#[prost(string, tag="12")] | ||
pub r#type: ::prost::alloc::string::String, | ||
#[prost(string, tag="13")] | ||
pub coinbase: ::prost::alloc::string::String, | ||
#[prost(bool, tag="14")] | ||
pub is_coinbase: bool, | ||
#[prost(string, tag="15")] | ||
pub script_asm: ::prost::alloc::string::String, | ||
#[prost(string, tag="16")] | ||
pub script_hex: ::prost::alloc::string::String, | ||
#[prost(string, tag="17")] | ||
pub script_desc: ::prost::alloc::string::String, | ||
#[prost(string, tag="18")] | ||
pub script_signature_asm: ::prost::alloc::string::String, | ||
#[prost(string, tag="19")] | ||
pub script_signature_hex: ::prost::alloc::string::String, | ||
#[prost(int64, tag="20")] | ||
pub sequence: i64, | ||
#[prost(string, repeated, tag="21")] | ||
pub witness_data: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, | ||
} | ||
#[allow(clippy::derive_partial_eq_without_eq)] | ||
#[derive(Clone, PartialEq, ::prost::Message)] | ||
pub struct Output { | ||
#[prost(message, optional, tag="1")] | ||
pub block_time: ::core::option::Option<::prost_types::Timestamp>, | ||
#[prost(string, tag="2")] | ||
pub block_date: ::prost::alloc::string::String, | ||
#[prost(int64, tag="3")] | ||
pub block_height: i64, | ||
#[prost(string, tag="4")] | ||
pub block_hash: ::prost::alloc::string::String, | ||
#[prost(string, tag="5")] | ||
pub tx_id: ::prost::alloc::string::String, | ||
#[prost(int64, tag="6")] | ||
pub index: i64, | ||
#[prost(double, tag="7")] | ||
pub value: f64, | ||
#[prost(string, tag="8")] | ||
pub address: ::prost::alloc::string::String, | ||
#[prost(string, tag="9")] | ||
pub r#type: ::prost::alloc::string::String, | ||
#[prost(string, tag="10")] | ||
pub script_asm: ::prost::alloc::string::String, | ||
#[prost(string, tag="11")] | ||
pub script_hex: ::prost::alloc::string::String, | ||
} | ||
// @@protoc_insertion_point(module) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// @generated | ||
// @@protoc_insertion_point(attribute:bitcoin) | ||
pub mod bitcoin { | ||
include!("bitcoin.rs"); | ||
// @@protoc_insertion_point(bitcoin) | ||
} | ||
// @@protoc_insertion_point(attribute:parquet) | ||
pub mod parquet { | ||
include!("parquet.rs"); | ||
// @@protoc_insertion_point(parquet) | ||
} | ||
pub mod sf { | ||
// @@protoc_insertion_point(attribute:sf.substreams) | ||
pub mod substreams { | ||
include!("sf.substreams.rs"); | ||
// @@protoc_insertion_point(sf.substreams) | ||
pub mod index { | ||
// @@protoc_insertion_point(attribute:sf.substreams.index.v1) | ||
pub mod v1 { | ||
include!("sf.substreams.index.v1.rs"); | ||
// @@protoc_insertion_point(sf.substreams.index.v1) | ||
} | ||
} | ||
pub mod rpc { | ||
// @@protoc_insertion_point(attribute:sf.substreams.rpc.v2) | ||
pub mod v2 { | ||
include!("sf.substreams.rpc.v2.rs"); | ||
// @@protoc_insertion_point(sf.substreams.rpc.v2) | ||
} | ||
} | ||
pub mod sink { | ||
pub mod service { | ||
// @@protoc_insertion_point(attribute:sf.substreams.sink.service.v1) | ||
pub mod v1 { | ||
include!("sf.substreams.sink.service.v1.rs"); | ||
// @@protoc_insertion_point(sf.substreams.sink.service.v1) | ||
} | ||
} | ||
} | ||
// @@protoc_insertion_point(attribute:sf.substreams.v1) | ||
pub mod v1 { | ||
include!("sf.substreams.v1.rs"); | ||
// @@protoc_insertion_point(sf.substreams.v1) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
// @generated | ||
// This file is @generated by prost-build. | ||
#[allow(clippy::derive_partial_eq_without_eq)] | ||
#[derive(Clone, Copy, PartialEq, ::prost::Message)] | ||
pub struct Column { | ||
/// Not implemented yet but planned so we reserved the field id now | ||
/// optional string name = 1; | ||
#[prost(enumeration="ColumnType", optional, tag="2")] | ||
pub r#type: ::core::option::Option<i32>, | ||
#[prost(enumeration="Compression", optional, tag="3")] | ||
pub compression: ::core::option::Option<i32>, | ||
} | ||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] | ||
#[repr(i32)] | ||
pub enum ColumnType { | ||
UnspecifiedColumnType = 0, | ||
Uint256 = 1, | ||
Int256 = 2, | ||
} | ||
impl ColumnType { | ||
/// String value of the enum field names used in the ProtoBuf definition. | ||
/// | ||
/// The values are not transformed in any way and thus are considered stable | ||
/// (if the ProtoBuf definition does not change) and safe for programmatic use. | ||
pub fn as_str_name(&self) -> &'static str { | ||
match self { | ||
ColumnType::UnspecifiedColumnType => "UNSPECIFIED_COLUMN_TYPE", | ||
ColumnType::Uint256 => "UINT256", | ||
ColumnType::Int256 => "INT256", | ||
} | ||
} | ||
/// Creates an enum from field names used in the ProtoBuf definition. | ||
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> { | ||
match value { | ||
"UNSPECIFIED_COLUMN_TYPE" => Some(Self::UnspecifiedColumnType), | ||
"UINT256" => Some(Self::Uint256), | ||
"INT256" => Some(Self::Int256), | ||
_ => None, | ||
} | ||
} | ||
} | ||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] | ||
#[repr(i32)] | ||
pub enum Compression { | ||
Uncompressed = 0, | ||
Snappy = 1, | ||
Gzip = 2, | ||
Lz4Raw = 3, | ||
Brotli = 4, | ||
Zstd = 5, | ||
} | ||
impl Compression { | ||
/// String value of the enum field names used in the ProtoBuf definition. | ||
/// | ||
/// The values are not transformed in any way and thus are considered stable | ||
/// (if the ProtoBuf definition does not change) and safe for programmatic use. | ||
pub fn as_str_name(&self) -> &'static str { | ||
match self { | ||
Compression::Uncompressed => "UNCOMPRESSED", | ||
Compression::Snappy => "SNAPPY", | ||
Compression::Gzip => "GZIP", | ||
Compression::Lz4Raw => "LZ4_RAW", | ||
Compression::Brotli => "BROTLI", | ||
Compression::Zstd => "ZSTD", | ||
} | ||
} | ||
/// Creates an enum from field names used in the ProtoBuf definition. | ||
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> { | ||
match value { | ||
"UNCOMPRESSED" => Some(Self::Uncompressed), | ||
"SNAPPY" => Some(Self::Snappy), | ||
"GZIP" => Some(Self::Gzip), | ||
"LZ4_RAW" => Some(Self::Lz4Raw), | ||
"BROTLI" => Some(Self::Brotli), | ||
"ZSTD" => Some(Self::Zstd), | ||
_ => None, | ||
} | ||
} | ||
} | ||
// @@protoc_insertion_point(module) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// @generated | ||
// This file is @generated by prost-build. | ||
#[allow(clippy::derive_partial_eq_without_eq)] | ||
#[derive(Clone, PartialEq, ::prost::Message)] | ||
pub struct Keys { | ||
#[prost(string, repeated, tag="1")] | ||
pub keys: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, | ||
} | ||
// @@protoc_insertion_point(module) |
Oops, something went wrong.