BitShares Forum

Other => Graveyard => Marketplace => Topic started by: bytemaster on December 31, 2013, 06:01:06 pm

Title: 1000 PTS - BitShares Block/Market Explorer [TO BE DEFINED]
Post by: bytemaster on December 31, 2013, 06:01:06 pm
I just wanted to post a notice that we will be creating a bounty that allows people to view the markets in the BitShares blockchain with an advanced Block Explorer.  The requirements are still waiting to be defined, but if you would be interested in such a thing post here and start the discussion.
Title: Re: 1000 PTS - BitShares Block/Market Explorer [TO BE DEFINED]
Post by: toast on December 31, 2013, 08:30:33 pm
Following. This has a dependency on the blockchain spec, does it not?
https://bitsharestalk.org/index.php?topic=1738.0

I think I'll start by defining the data model based on the bitshares source. Gonna go with a simple flask/sqlite stack to start, any objections?

repo up
https://github.com/nmushegian/BTSExplorer
Title: Re: 1000 PTS - BitShares Block/Market Explorer [TO BE DEFINED]
Post by: arcke on December 31, 2013, 11:37:03 pm
Following. This has a dependency on the blockchain spec, does it not?
https://bitsharestalk.org/index.php?topic=1738.0

I think I'll start by defining the data model based on the bitshares source. Gonna go with a simple flask/sqlite stack to start, any objections?

repo up
https://github.com/nmushegian/BTSExplorer
I am tracking this repository. If you want to work in Python as the files in the repository suggest we can work  together. Python is a good choice.
Title: Re: 1000 PTS - BitShares Block/Market Explorer [TO BE DEFINED]
Post by: toast on January 01, 2014, 12:09:39 am
Gonna be writing the spec while I work
https://github.com/nmushegian/BitShares/blob/spec/doc/spec.md

Title: Re: 1000 PTS - BitShares Block/Market Explorer [TO BE DEFINED]
Post by: toast on January 01, 2014, 03:41:27 am
Do you have a sample blockchain .dat file?
Title: Re: 1000 PTS - BitShares Block/Market Explorer [TO BE DEFINED]
Post by: bytemaster on January 01, 2014, 03:47:34 am
Do you have a sample blockchain .dat file?

I will post an example JSON dump of a block with transactions in it of every type.

Title: Re: 1000 PTS - BitShares Block/Market Explorer [TO BE DEFINED]
Post by: bytemaster on January 01, 2014, 03:49:05 am
Do you have a sample blockchain .dat file?

I will post an example JSON dump of a block with transactions in it of every type.

I will also define a JSON RPC API to query blocks and transactions as well as market status.
Title: Re: 1000 PTS - BitShares Block/Market Explorer [TO BE DEFINED]
Post by: toast on January 01, 2014, 04:46:44 am
Any chance at even a partial json dump tonight?

Also, can you confirm that you will define this to be possible to finish before the official PTS->BTS launch block? (Is there a term for "block you use for determining balances"?)
Title: Re: 1000 PTS - BitShares Block/Market Explorer [TO BE DEFINED]
Post by: bytemaster on January 01, 2014, 04:48:10 am
Any chance at even a partial json dump tonight?

Also, can you confirm that you will define this to be possible to finish before the official PTS->BTS launch block? (Is there a term for "block you use for determining balances"?)

I will try to put something together in the next 30 minutes (what time is it where you are?)
Title: Re: 1000 PTS - BitShares Block/Market Explorer [TO BE DEFINED]
Post by: toast on January 01, 2014, 04:53:48 am
11:53pm. True believer here ;)

Happy New Year!
Title: Re: 1000 PTS - BitShares Block/Market Explorer [TO BE DEFINED]
Post by: bytemaster on January 01, 2014, 05:11:33 am
11:53pm. True believer here ;)

Happy New Year!

Happy New Year to you too... ok, working on this for you now.
Title: Re: 1000 PTS - BitShares Block/Market Explorer [TO BE DEFINED]
Post by: bytemaster on January 01, 2014, 05:14:35 am

Example Transaction:
Code: [Select]
{
  "version": 0,
  "stake": 159535476,
  "timestamp": "19700101T000000",
  "valid_after": 0,
  "valid_blocks": 0,
  "inputs": [
    {
      "output_ref": {
        "trx_hash": "226632dd45b4da5d1800c9e05497fd8a9a57a794",
        "output_idx": 0
      },
      "input_data": ""
    },
    {
      "output_ref": {
        "trx_hash": "226632dd45b4da5d1800c9e05497fd8a9a57a794",
        "output_idx": 1
      },
      "input_data": ""
    }
  ],
  "outputs": [
    {
      "amount": 200000000,
      "unit": "bts",
      "claim_func": "claim_by_signature",
      "claim_data": {
        "owner": "PqdiEfgjYw8remotv6Zp25UbupJ"
      }
    },
    {
      "amount": 199348000,
      "unit": "bts",
      "claim_func": "claim_by_signature",
      "claim_data": {
        "owner": "QFFXKxxfNyYvFyyCMpfMTPrYr88"
      }
    }
  ],
  "sigs": [
    "1fdbdd814380c41102444bb4959d976645d668c0dd34d41c1f38b8c666b114b0aa0ff02d70f5d1926209a5f6ef9950b5d97cb6a360912e9263b685b4276db3adc9",
    "20596d1a215427a0ce4d71a6ccd9a72b4c5d1577c058d362d62caec7add86dad8ef3571e20a903f5bbaa7744831cd7b458207f7465b65aa6113bfc422f8019edb7"
  ]
}
Title: Re: 1000 PTS - BitShares Block/Market Explorer [TO BE DEFINED]
Post by: bytemaster on January 01, 2014, 05:18:11 am
Example Block:
Quote
{
  "version": 0,
  "prev": "985359c27bfb0ee5d57dffe91af56d1eafffe723",
  "block_num": 1,
  "timestamp": "20140101T051724",
  "total_shares": 9999837000,
  "total_coindays_destroyed": 0,
  "trx_mroot": "54c52f03c52e5f670d0721aad8cf57ccfbb28e51",
  "trxs": [{
      "version": 0,
      "stake": 3260634008,
      "timestamp": "19700101T000000",
      "valid_after": 0,
      "valid_blocks": 0,
      "inputs": [{
          "output_ref": {
            "trx_hash": "41bda2a7a8fcbb4af49fed950eb1e01eb605ffd4",
            "output_idx": 0
          },
          "input_data": ""
        }
      ],
      "outputs": [{
          "amount": 2000000000,
          "unit": "bts",
          "claim_func": "claim_by_signature",
          "claim_data": {
            "owner": "GnNSoijg9wEhfaXWkbLR1bkyoFn"
          }
        },{
          "amount": 7999837000,
          "unit": "bts",
          "claim_func": "claim_by_signature",
          "claim_data": {
            "owner": "MNztHhCvn1YqTboeY1EyLfKxAcE"
          }
        }
      ],
      "sigs": [
        "1f0de2cc1ca8ecf6c6e156c973c7a15da5dfa4dfd5d01826a392cf7f7459b2dda3bdc7ab3625199bf79f3a82074107a5122442aba9947e01bf97f7ac6155860120"
      ]
    }
  ]
Title: Re: 1000 PTS - BitShares Block/Market Explorer [TO BE DEFINED]
Post by: bytemaster on January 01, 2014, 05:25:29 am
Code: [Select]
enum claim_type_enum
{
   /** basic claim by single address */
   null_claim_type        = 0,
   claim_by_pts            = 1, ///< someone importing a PTS balance
   claim_by_signature    = 2, ///< someone signs with an address
   claim_by_bid             = 3, ///< someone makes an acceptable bid
   claim_by_long           = 4, ///< someone agrees to go long against a short
   claim_by_cover          = 5, ///< someone covers a short, freeing collateral
   claim_by_opt_execute = 6, ///< someone executes an option
   claim_by_multi_sig      = 7, ///< N of M signatures required
   claim_by_escrow         = 8, ///< claimable with 2 of 3 signatures, 3rd signature can only split between 1&2
   claim_by_password      = 9, ///< used for cross-chain trading
   num_claim_types
};

I will provide more information about the API shortly in the other bounty thread. 
Title: Re: 1000 PTS - BitShares Block/Market Explorer [TO BE DEFINED]
Post by: toast on January 01, 2014, 05:43:45 am

Example Transaction:
Code: [Select]
{
  "version": 0,
  "stake": 159535476,
  "timestamp": "19700101T000000",
  "valid_after": 0,
  "valid_blocks": 0,
  "inputs": [
    {
      "output_ref": {
        "trx_hash": "226632dd45b4da5d1800c9e05497fd8a9a57a794",
        "output_idx": 0
      },
      "input_data": ""
    },
    {
      "output_ref": {
        "trx_hash": "226632dd45b4da5d1800c9e05497fd8a9a57a794",
        "output_idx": 1
      },
      "input_data": ""
    }
  ],
  "outputs": [
    {
      "amount": 200000000,
      "unit": "bts",
      "claim_func": "claim_by_signature",
      "claim_data": {
        "owner": "PqdiEfgjYw8remotv6Zp25UbupJ"
      }
    },
    {
      "amount": 199348000,
      "unit": "bts",
      "claim_func": "claim_by_signature",
      "claim_data": {
        "owner": "QFFXKxxfNyYvFyyCMpfMTPrYr88"
      }
    }
  ],
  "sigs": [
    "1fdbdd814380c41102444bb4959d976645d668c0dd34d41c1f38b8c666b114b0aa0ff02d70f5d1926209a5f6ef9950b5d97cb6a360912e9263b685b4276db3adc9",
    "20596d1a215427a0ce4d71a6ccd9a72b4c5d1577c058d362d62caec7add86dad8ef3571e20a903f5bbaa7744831cd7b458207f7465b65aa6113bfc422f8019edb7"
  ]
}

Might make sense to put trx_hash in the transaction itself rather than as a field in the output_ref. Could you ever have inputs whose output_refs have different trx_hashes?
Title: Re: 1000 PTS - BitShares Block/Market Explorer [TO BE DEFINED]
Post by: toast on January 01, 2014, 07:58:35 pm
Example Block:
Quote
...

block json got clipped
possibly because of quote tags instead of code tags
Title: Re: 1000 PTS - BitShares Block/Market Explorer [TO BE DEFINED]
Post by: bytemaster on January 01, 2014, 08:38:49 pm

Example Transaction:
Code: [Select]
{
  "version": 0,
  "stake": 159535476,
  "timestamp": "19700101T000000",
  "valid_after": 0,
  "valid_blocks": 0,
  "inputs": [
    {
      "output_ref": {
        "trx_hash": "226632dd45b4da5d1800c9e05497fd8a9a57a794",
        "output_idx": 0
      },
      "input_data": ""
    },
    {
      "output_ref": {
        "trx_hash": "226632dd45b4da5d1800c9e05497fd8a9a57a794",
        "output_idx": 1
      },
      "input_data": ""
    }
  ],
  "outputs": [
    {
      "amount": 200000000,
      "unit": "bts",
      "claim_func": "claim_by_signature",
      "claim_data": {
        "owner": "PqdiEfgjYw8remotv6Zp25UbupJ"
      }
    },
    {
      "amount": 199348000,
      "unit": "bts",
      "claim_func": "claim_by_signature",
      "claim_data": {
        "owner": "QFFXKxxfNyYvFyyCMpfMTPrYr88"
      }
    }
  ],
  "sigs": [
    "1fdbdd814380c41102444bb4959d976645d668c0dd34d41c1f38b8c666b114b0aa0ff02d70f5d1926209a5f6ef9950b5d97cb6a360912e9263b685b4276db3adc9",
    "20596d1a215427a0ce4d71a6ccd9a72b4c5d1577c058d362d62caec7add86dad8ef3571e20a903f5bbaa7744831cd7b458207f7465b65aa6113bfc422f8019edb7"
  ]
}

Might make sense to put trx_hash in the transaction itself rather than as a field in the output_ref. Could you ever have inputs whose output_refs have different trx_hashes?

Yes, 99% of the time the trx_hashes are different.  This only happened because I was sending money to myself in the test case.   

The structure of the transaction is proven with testing and implementation.  This is not a SPEC, but a dump from actual running code.
Title: Re: 1000 PTS - BitShares Block/Market Explorer [TO BE DEFINED]
Post by: bytemaster on January 01, 2014, 08:40:20 pm

Example Transaction:
Code: [Select]
{
  "version": 0,
  "stake": 159535476,
  "timestamp": "19700101T000000",
  "valid_after": 0,
  "valid_blocks": 0,
  "inputs": [
    {
      "output_ref": {
        "trx_hash": "226632dd45b4da5d1800c9e05497fd8a9a57a794",
        "output_idx": 0
      },
      "input_data": ""
    },
    {
      "output_ref": {
        "trx_hash": "226632dd45b4da5d1800c9e05497fd8a9a57a794",
        "output_idx": 1
      },
      "input_data": ""
    }
  ],
  "outputs": [
    {
      "amount": 200000000,
      "unit": "bts",
      "claim_func": "claim_by_signature",
      "claim_data": {
        "owner": "PqdiEfgjYw8remotv6Zp25UbupJ"
      }
    },
    {
      "amount": 199348000,
      "unit": "bts",
      "claim_func": "claim_by_signature",
      "claim_data": {
        "owner": "QFFXKxxfNyYvFyyCMpfMTPrYr88"
      }
    }
  ],
  "sigs": [
    "1fdbdd814380c41102444bb4959d976645d668c0dd34d41c1f38b8c666b114b0aa0ff02d70f5d1926209a5f6ef9950b5d97cb6a360912e9263b685b4276db3adc9",
    "20596d1a215427a0ce4d71a6ccd9a72b4c5d1577c058d362d62caec7add86dad8ef3571e20a903f5bbaa7744831cd7b458207f7465b65aa6113bfc422f8019edb7"
  ]
}

Might make sense to put trx_hash in the transaction itself rather than as a field in the output_ref. Could you ever have inputs whose output_refs have different trx_hashes?

Yes, 99% of the time the trx_hashes are different.  This only happened because I was sending money to myself in the test case.   

The structure of the transaction is proven with testing and implementation.  This is not a SPEC, but a dump from actual running code.

The valid after and valid for integers will have to change to actual timestamps now that we are not using mining and have variable length blocks. 
Title: Re: 1000 PTS - BitShares Block/Market Explorer [TO BE DEFINED]
Post by: bytemaster on January 20, 2014, 05:47:59 am
JSON-RPC Interface + Alpha Wallet available for testing.  Everything necessary for building a block explorer.

https://bitsharestalk.org/index.php?topic=1890.msg30368#msg30368