Quickstart
1. Anatomy of a Bitcoin Transaction
BitDB's main job is to:
- Transform a raw bitcoin transaction into a structured format
- Store it in MongoDB
- Make it available for powerful queries
Here's an example of what BitDB saves into the database (It's a single bitcoin transaction):
{
"tx": {
"h": "92b87fc7390dff0ccfc43469ce90a8d3dbc20e752fdd5cbde55a6d89e230cdf5"
},
"blk": {
"i": 546492,
"h": "000000000000000000d3ad1ddba37d2d82cd50246e8ed20ee4bbea235d066e25",
"t": 1536117057
},
"in": [
{
"i": 0,
"b0": "MEQCIBxgOSQVQJRcjGXz07oRbde3fqLKia+sM+9JqL+mba/vAiA1+Qb/waEmE8q37h7JRDZ09ZQDnAn85uWbTxeB4YCG+EE=",
"b1": "A9bTZNMWZoIVSARHI/aosV9D5sfcXtzC/Dz3gxs+gQlc",
"str": "<Script: 71 0x304402201c6039241540945c8c65f3d3ba116dd7b77ea2ca89afac33ef49a8bfa66dafef022035f906ffc1a12613cab7ee1ec9443674f594039c09fce6e59b4f1781e18086f841 33 0x03d6d364d31666821548044723f6a8b15f43e6c7dc5edcc2fc3cf7831b3e81095c>",
"e": {
"h": "269345a2bc54b716316b9e0b22b19b1ebdbf9467ee3cc87066ad97adbdcd8ab0",
"i": 1,
"a": "qqvmy646hp77rfws0562zter9adht3727yu7kf3sls"
}
}
],
"out": [
{
"i": 0,
"b0": {
"op": 106
},
"b1": "bQI=",
"s1": "m\u0002",
"b2": "cG9zdCB0byBtZW1vLmNhc2gh",
"s2": "post to memo.cash!",
"str": "<Script: OP_RETURN 2 0x6d02 18 0x706f737420746f206d656d6f2e6361736821>",
"e": {
"v": 0,
"i": 0
}
},
{
"i": 1,
"b0": {
"op": 118
},
"b1": {
"op": 169
},
"b2": "GbJqurh94aXQfTShLyMvW3XHyvE=",
"s2": "\u0019�j��}��}4�/#/[u���",
"b3": {
"op": 136
},
"b4": {
"op": 172
},
"str": "<Script: OP_DUP OP_HASH160 20 0x19b26abab87de1a5d07d34a12f232f5b75c7caf1 OP_EQUALVERIFY OP_CHECKSIG>",
"e": {
"v": 16904,
"i": 1,
"a": "qqvmy646hp77rfws0562zter9adht3727yu7kf3sls"
}
}
]
}
To learn more about how BitDB creates this structure, see BitDB 101
2. Try Queries Online
To get familiar with how bitdb queries work, go to the Intro documentation and try out some example queries online:
To make sense of what the results mean, see BitDB 101
3. Try Queries Programmatically
BitDB can be queried in two ways:
- Direct: If you're running your own BitDB node, you can query your own database instance directly, through
mongodb://
url. - Via HTTP: But most people don't need to run their own BitDB node, especially if you just want to try building things quickly.
Here we will use the HTTP method to connect to a public bitdb node at https://bitdb.fountainhead.cash for making requests.
4. Learn More
To learn more about how all this works in detail, start by reading the introduction: