nagalabs
  • 💡intro
  • ✨naga
    • 🔶BTC_DATA
    • 💫{n} dimensions
  • 💎genesis
    • 🔒traits
    • 🔒block list
  • 🔐**********
    • 🕛0
  • 🔗links
Powered by GitBook
On this page
  • Understanding the dimensions of data representation
  • What is {n} dimensions
  • Block Header
  • Transactions
  • Accessing data
  • Additional Considerations
  1. naga

{n} dimensions

PreviousBTC_DATANextgenesis

Last updated 1 year ago

Understanding the dimensions of data representation

In the realm of data representation, dimensions play a critical role in how we structure, interpret, and utilize information. The concept of dimensionality is foundational, spanning from one-dimensional (1D) arrays, where data is linear and sequential, through two-dimensional (2D) matrices that offer a tabular view of information, to three-dimensional (3D) models that provide spatial representation.

1D (One-Dimensional)

In 1D data representation, data is organized linearly, akin to a list or array. Each element has a single value and is accessed by a single index, making it straightforward for operations like search and sort. This simplicity is foundational, serving as the building block for more complex structures.

2D (Two-Dimensional)

Expanding to 2D, data is arranged in rows and columns, much like a matrix or table. This facilitates more complex relationships, enabling operations that require context across two axes, such as in spreadsheet calculations or pixel-based image processing. It's a critical step up in representing relational and spatial data.

3D (Three-Dimensional)

With 3D data representation, we add depth to our spatial structuring, allowing for models and simulations that mirror real-world complexities. Each data point in this space is defined by three coordinates. This dimension is pivotal in fields requiring volumetric representations, from computer graphics to medical imaging, offering an immersive perspective on data.

Each step up in dimensionality enriches our ability to represent and interact with data, opening new avenues for analysis, visualization, and application across diverse computational fields.

What is {n} dimensions

Through the lens of the principles above we can visualise Bitcoin's blockchain in the same light. Consider the following:

  1. 1D | The block heights

  2. 2D | The block properties (header) and the transactions

  3. 3D | Header values and transaction values

  4. 4D | Specific input or output

  5. 5D | Output or input value

  6. 6D | Input or output array value

Let's look at an example with a simple block like Block 170. Below is the available data.

Block Header

The block header is the first element of data in every block and contains the properties of the block. It is the data displayed for individual blocks when viewing on blockchain explorers.

const header = [
    170, // height
    1960, // weight
    490, // size
    490, // strippedsize
    1889418792, // nonce
    2, // ntx
    "00000000d1145790a8694403d4063f323d499e655c83426834d4ce2f8dd4a2ee", // blockhash
    "0x1", // version
    "1", // versionhex
    "7dac2c5666815c17a3b36427de37bb9d2e2c5ccec3f8633eb91a4205cb4c10ff", // merkleroot
    "0x1d00ffff", // bits
    "000000000000000000000000000000000000000000000000000000ab00ab00ab", // chainwork
    "1.00", // difficulty
    "2009-01-12 03:30:25", // time
    "Jan 11, 2009 23:24:05 UTC" // mediantime
    ];

Transactions

Transaction data makes up the rest of the block. Here you will find all the information about individual transactions including inputs and outputs.

const tx0 = [
    134, // size
    134, // vzize
    536, // weight
    1, // version
    "b1fea52486ce0c62bb442b530a3f0132b826c74e473d1f2c220bfa78111c5082", // txid
    true, // coinbase
    000000000, // btcfee
    0, // locktime
    "12 Jan 2009 03:30:25", // blocktime
    [[ // inputs
        "0000000000000000000000000000000000000000000000000000000000000000", // txid
        4294967295, // output
        "04ffff001d0102", // sigscript
        4294967295, // sequence
        null, // pkscript
        null, // value
        null, // address
        [] // witness
    ]],
    [[ // outputs
        "1PSSGeFHDnKNxiEyFrD1wcEaHr9hrQDDWc", // address
        "4104d46c4968bde02899d2aa0963367c7a6ce34eec332b32e42e5f3407e052d64ac625da6f0718e7b302140434bd725706957c092db53805b821a85b23a7ac61725bac", // pkscript
        5000000000, // value
        false, // spent
        null // spender
    ]]
    ];
const tx1 = [
    275, // size
    275, // vzize
    1100, // weight
    1, // version
    "f4184fc596403b9d638783cf57adfe4c75c605f6356fbc91338530e9831e9e16", // txid
    false, // coinbase
    000000000, // btcfee
    0, // locktime
    "12 Jan 2009 03:30:25", // blocktime
    [[ // inputs
        "0437cd7f8525ceed2324359c2d0ba26006d92d856a9c20fa0241106ee5a597c9", // txid
        0, // output
        "47304402204e45e16932b8af514961a1d3a1a25fdf3f4f7732e9d624c6c61548ab5fb8cd410220181522ec8eca07de4860a4acdd12909d831cc56cbbac4622082221a8768d1d0901", // sigscript
        4294967295, // sequence
        "410411db93e1dcdb8a016b49840f8c53bc1eb68a382e97b1482ecad7b148a6909a5cb2e0eaddfb84ccf9744464f82e160bfa9b8b64f9d4c03f999b8643f656b412a3ac", // pkscript
        5000000000, // value
        "12cbQLTFMXRnSzktFkuoG3eHoMeFtpTu3S", // address
        [] // witness
    ],
    ]],
    [[ // outputs
        "1Q2TWHE3GMdB6BZKafqwxXtWAWgFt5Jvm3", // address
        "4104ae1a62fe09c5f51b13905f07f06b99a2f7159b2225f374cd378d71302fa28414e7aab37397f554a7df5f142c21c1b7303b8a0626f1baded5c72a704f7e6cd84cac", // pkscript
        1000000000, // value
        true, // spent
        [ // spender
            "ea44e97271691990157559d0bdd9959e02790c34db6c006d779e82fa5aee708e", // txid
            0 // input
        ]
    ],
    [
        "12cbQLTFMXRnSzktFkuoG3eHoMeFtpTu3S", // address
        "410411db93e1dcdb8a016b49840f8c53bc1eb68a382e97b1482ecad7b148a6909a5cb2e0eaddfb84ccf9744464f82e160bfa9b8b64f9d4c03f999b8643f656b412a3ac", // pkscript
        4000000000, //value
        true, // spent
        [ // spender
            "a16f3ce4dd5deb92d98ef5cf8afeaf0775ebca408f708b2146c4fb42b41e14be", // txid
            0 // input
        ]
    ]]
    ];

Accessing data

Given the following data structure:

blockArray = [169, [header, tx0, tx1], 171];

Here is how you could access the the following values of Block 170:

  • The value of the second output of tx1

const tx1Val = blockArray[1][2][10][1][2];
  • The hash of the block

const blockHash = blockArray[1][0][4];
  • All the input values of tx0

const tx0Input = blockArray[1][1][9];

Additional Considerations

The organisation of the data, proposed above, is simply an example of how this information could be structured. In this example blockArray is a 6-dimensional array however the data could also be organized into a dict. This structure will depend on the intrinsic and visual intentions of the project. To see how the data for the 'genesis' collection will be structured please see the page.

✨
💫
genesis
Three dimensions visualised