Author Topic: Help educate Charles on Bitshares 2  (Read 7108 times)

0 Members and 1 Guest are viewing this topic.

Offline DMo09

  • Full Member
  • ***
  • Posts: 101
    • View Profile
These Q&A's should go in an "Advanced FAQ's" section...  Very well done and thank you.

Offline Fox

It has come to my attention that I'm omitting mentioning Bitshares 2 in interviews. The primary reason is that I haven't spent the time on keeping up to date with Bitshares 2's development thus I figured to be fair I should create a thread to get up to speed with the help of the community. I'll post questions and you guys answer them.

Charles,
May I expand on your list to include:

Addresses and Transactions
  • Are multisignature transactions supported (BIP0011 [1])?
Bitshares 2 uses Dynamic Account Permissions [2]. 
Quote
We introduce a new approach to permissions based upon accounts which are assigned globally unique IDs.

Under this system, it is possible to define an account that has no keys itself, but instead depends solely upon the approval of other accounts. Those other accounts can, in turn, depend upon the approval of other accounts. This process forms a hierarchy of accounts that must grant permission. Each account can change its own permissions independently of any accounts above it in the hierarchy, which is what makes the permissions dynamic.

Each account defines its permissions as a set of keys and/or other account IDs that are each assigned weights by the account holder. If the combined weight of keys and/or accounts exceeds a threshold defined by the account, then permission is granted.

The second solution is to include the partially signed transaction in the consensus state and allow accounts to publish transactions that add or remove their approval of the transaction. This simplifies the signing coordination problem, enables people to change their mind before the threshold is reached, and applies the transaction immediately upon receipt of the final approval.

[2] https://en.bitcoin.it/wiki/BIP_0011
[1] https://bitshares.org/technology/dynamic-account-permissions/
Witness: fox

Offline betax

  • Hero Member
  • *****
  • Posts: 808
    • View Profile

A very comprehensive list of questions and excellent response from ElMato!

If Charles has the answers to these questions for every project he has mentioned there is a fantastic opportunity for an industry wide report. An intense aggregation of project info.

That will be fantastic, Charles will you care to share? I have setup http://crypto20.org/ and https://github.com/Crypto20/Crypto20org it will be invaluable if some of your knowledge could be leaked there :).
https://metaexchange.info | Bitcoin<->Altcoin exchange | Instant | Safe | Low spreads

Offline Riverhead


A very comprehensive list of questions and excellent response from ElMato!

If Charles has the answers to these questions for every project he has mentioned there is a fantastic opportunity for an industry wide report. An intense aggregation of project info.

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12922
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc
Wow .. @elmato .. comprehensive study .. you mind if I copy&paste your description into the docs?

Offline betax

  • Hero Member
  • *****
  • Posts: 808
    • View Profile
This is great, we should put in the wiki... Charles, elMato please ask, answer more ;)
https://metaexchange.info | Bitcoin<->Altcoin exchange | Instant | Safe | Low spreads

Offline bitmarket

  • Sr. Member
  • ****
  • Posts: 369
    • View Profile
    • BitShares TV
Charles, to be honest I don't think I have the skills to answer 5% of those questions, but they appear to be questions that would apply to any blockchain.

Just wanted to check in to see if you were aware of the unique aspects of bitshares?  1. Referal program 2. scheduled payments 3.on-chain proposed transactions, etc
Host of BitShares.TV and Author of BitShares 101

Offline ElMato

  • Sr. Member
  • ****
  • Posts: 288
    • View Profile
What data structures are used in the blockchain?
Blocks => transactions => operations => objects.
The blockchain state is contained in an object database that is affected by the operations.
Example objects:
  • account_object
  • asset_object
  • account_balance_object
  • ...
Code: [Select]
class account_balance_object : public abstract_object<account_balance_object>
   {
      public:
         static const uint8_t space_id = implementation_ids;
         static const uint8_t type_id  = impl_account_balance_object_type;

         account_id_type   owner;
         asset_id_type     asset_type;
         share_type        balance;

         asset get_balance()const { return asset(balance, asset_type); }
         void  adjust_balance(const asset& delta);
   };


What is the format of the block header?
Code: [Select]
struct block_header
   {
      digest_type                   digest()const;
      block_id_type                 previous;
      uint32_t                      block_num()const { return num_from_id(previous) + 1; }
      fc::time_point_sec            timestamp;
      witness_id_type               witness;
      checksum_type                 transaction_merkle_root;
      extensions_type               extensions;

      static uint32_t num_from_id(const block_id_type& id);
   };
What is the maximum bitshares block size?
Configurable by chain parameters.

Code: [Select]
   struct chain_parameters
   {
      /** using a smart ref breaks the circular dependency created between operations and the fee schedule */
      smart_ref<fee_schedule> current_fees;                       ///< current schedule of fees
      uint8_t                 block_interval                      = GRAPHENE_DEFAULT_BLOCK_INTERVAL; ///< interval in seconds between blocks
      uint32_t                maintenance_interval                = GRAPHENE_DEFAULT_MAINTENANCE_INTERVAL; ///< interval in sections between blockchain maintenance events
      uint8_t                 maintenance_skip_slots              = GRAPHENE_DEFAULT_MAINTENANCE_SKIP_SLOTS; ///< number of block_intervals to skip at maintenance time
      uint32_t                committee_proposal_review_period    = GRAPHENE_DEFAULT_COMMITTEE_PROPOSAL_REVIEW_PERIOD_SEC; ///< minimum time in seconds that a proposed transaction requiring committee authority may not be signed, prior to expiration
      uint32_t                maximum_transaction_size            = GRAPHENE_DEFAULT_MAX_TRANSACTION_SIZE; ///< maximum allowable size in bytes for a transaction
      uint32_t                maximum_block_size                  = GRAPHENE_DEFAULT_MAX_BLOCK_SIZE; ///< maximum allowable size in bytes for a block
      uint32_t                maximum_time_until_expiration       = GRAPHENE_DEFAULT_MAX_TIME_UNTIL_EXPIRATION; ///< maximum lifetime in seconds for transactions to be valid, before expiring
      uint32_t                maximum_proposal_lifetime           = GRAPHENE_DEFAULT_MAX_PROPOSAL_LIFETIME_SEC; ///< maximum lifetime in seconds for proposed transactions to be kept, before expiring
      uint8_t                 maximum_asset_whitelist_authorities = GRAPHENE_DEFAULT_MAX_ASSET_WHITELIST_AUTHORITIES; ///< maximum number of accounts which an asset may list as authorities for its whitelist OR blacklist
      uint8_t                 maximum_asset_feed_publishers       = GRAPHENE_DEFAULT_MAX_ASSET_FEED_PUBLISHERS; ///< the maximum number of feed publishers for a given asset
      uint16_t                maximum_witness_count               = GRAPHENE_DEFAULT_MAX_WITNESSES; ///< maximum number of active witnesses
      uint16_t                maximum_committee_count             = GRAPHENE_DEFAULT_MAX_COMMITTEE; ///< maximum number of active committee_members
      uint16_t                maximum_authority_membership        = GRAPHENE_DEFAULT_MAX_AUTHORITY_MEMBERSHIP; ///< largest number of keys/accounts an authority can have
      uint16_t                reserve_percent_of_fee              = GRAPHENE_DEFAULT_BURN_PERCENT_OF_FEE; ///< the percentage of the network's allocation of a fee that is taken out of circulation
      uint16_t                network_percent_of_fee              = GRAPHENE_DEFAULT_NETWORK_PERCENT_OF_FEE; ///< percent of transaction fees paid to network
      uint16_t                lifetime_referrer_percent_of_fee    = GRAPHENE_DEFAULT_LIFETIME_REFERRER_PERCENT_OF_FEE; ///< percent of transaction fees paid to network
      uint32_t                cashback_vesting_period_seconds     = GRAPHENE_DEFAULT_CASHBACK_VESTING_PERIOD_SEC; ///< time after cashback rewards are accrued before they become liquid
      share_type              cashback_vesting_threshold          = GRAPHENE_DEFAULT_CASHBACK_VESTING_THRESHOLD; ///< the maximum cashback that can be received without vesting
      bool                    count_non_member_votes              = true; ///< set to false to restrict voting privlegages to member accounts
      bool                    allow_non_member_whitelists         = false; ///< true if non-member accounts may set whitelists and blacklists; false otherwise
      share_type              witness_pay_per_block               = GRAPHENE_DEFAULT_WITNESS_PAY_PER_BLOCK; ///< CORE to be allocated to witnesses (per block)
      uint32_t                witness_pay_vesting_seconds         = GRAPHENE_DEFAULT_WITNESS_PAY_VESTING_SECONDS; ///< vesting_seconds parameter for witness VBO's
      share_type              worker_budget_per_day               = GRAPHENE_DEFAULT_WORKER_BUDGET_PER_DAY; ///< CORE to be allocated to workers (per day)
      uint16_t                max_predicate_opcode                = GRAPHENE_DEFAULT_MAX_ASSERT_OPCODE; ///< predicate_opcode must be less than this number
      share_type              fee_liquidation_threshold           = GRAPHENE_DEFAULT_FEE_LIQUIDATION_THRESHOLD; ///< value in CORE at which accumulated fees in blockchain-issued market assets should be liquidated
      uint16_t                accounts_per_fee_scale              = GRAPHENE_DEFAULT_ACCOUNTS_PER_FEE_SCALE; ///< number of accounts between fee scalings
      uint8_t                 account_fee_scale_bitshifts         = GRAPHENE_DEFAULT_ACCOUNT_FEE_SCALE_BITSHIFTS; ///< number of times to left bitshift account registration fee at each scaling
      uint8_t                 max_authority_depth                 = GRAPHENE_MAX_SIG_CHECK_DEPTH;
      extensions_type         extensions;

      /** defined in fee_schedule.cpp */
      void validate()const;
   };

Are there any sharding mechanics currently deployed?
No

How are SPV clients handled?
No SPV clients at the moment, each full node can expose a public websocket/http api.

Does the protocol provide mechanisms for overlay protocols to interact such as OR_RETURN?
Yes, using a custom_operation.
Code: [Select]
struct custom_operation : public base_operation
   {
      struct fee_parameters_type {
         uint64_t fee = GRAPHENE_BLOCKCHAIN_PRECISION;
         uint32_t price_per_kbyte = 10;
      };

      asset                     fee;
      account_id_type           payer;
      flat_set<account_id_type> required_auths;
      uint16_t                  id = 0;
      vector<char>              data;

      account_id_type   fee_payer()const { return payer; }
      void              validate()const;
      share_type        calculate_fee(const fee_parameters_type& k)const;
   };

How is time addressed in the blockchain? Is NTP used or some other protocol?
NTP

How do new clients bootstrap into the network?
trusted seed nodes

What is the average block time?
Current 3 seconds, configurable by chain parameters.

Is this done via a gossip protocol or through a federate relay?
Each node immediately broadcast the data it receives to its peers after validating it
https://github.com/cryptonomex/graphene/blob/master/libraries/p2p/design.md

Offline ElMato

  • Sr. Member
  • ****
  • Posts: 288
    • View Profile
What is the standard Bitshares address structure and format?
address = 'BTS'+base58(ripemd(sha512(compressed_pub)))  (checksum obviated)
But addresses are not used directly, instead you have an account (that can be controlled by one or more address, pubkey or another account).
https://bitshares.org/technology/dynamic-account-permissions/

What public key system is used? If elliptic curve, then what is the curve?
Same as Bitcoin, secp256k1.

Is there a specification for Bitshares scripting language? (assuming there is one)
No scripting

Is the scripting language turing complete?
No scripting

What transaction types are natively supported?
Transaction are composed of operations (about ~40 different types).
Example of operations are:
 * transfer_operation
 * limit_order_create_operation
 * asset_issue_operation

Full list
https://github.com/cryptonomex/graphene/blob/master/libraries/chain/include/graphene/chain/protocol/operations.hpp

How is accounting addressed in Bitshares? Is it a Nxt style accounting model or like Bitcoin's UTXO
Each account has a finite set of balances, one for each asset type.

What is the average size in Bytes of a Bitshares transaction?
Average wire size of operations is ~30 bytes.
Average mem size of operations is ~100 bytes.
https://github.com/cryptonomex/graphene/blob/master/programs/size_checker/main.cpp

How are transactions validated?
Each operation has a defined evaluator that checks for preconditions (do_evaluate) and modify the state (do_apply). (After signature verification)
Code: [Select]
class transfer_evaluator : public evaluator<transfer_evaluator>
   {
      public:
         typedef transfer_operation operation_type;

         void_result do_evaluate( const transfer_operation& o );
         void_result do_apply( const transfer_operation& o );
   }


Are there any special affordances made for privacy such as using CoinJoin or a ZK-SNARK based
privacy scheme like Zerocash? If mixing is integrated at the protocl level are you using the standards set forth by the BNMCKF Mixcoin proposal

Confidential values (same as blockstream elements using the same secp256k1-zkp lib) + stealth addresses.
https://github.com/ElementsProject/elementsproject.github.io/blob/master/confidential_values.md
No mixing, No CoinJoin.
« Last Edit: October 22, 2015, 04:11:13 am by ElMato »

IOHKCharles

  • Guest
It has come to my attention that I'm omitting mentioning Bitshares 2 in interviews. The primary reason is that I haven't spent the time on keeping up to date with Bitshares 2's development thus I figured to be fair I should create a thread to get up to speed with the help of the community. I'll post questions and you guys answer them.

Addresses and Transactions
  • What is the standard Bitshares address structure and format?
  • What public key system is used? If elliptic curve, then what is the curve?
  • Is there a specification for Bitshares scripting language? (assuming there is one)
  • Is the scripting language turing complete?
  • What transaction types are natively supported?
  • How is accounting addressed in Bitshares? Is it a Nxt style accounting model or like Bitcoin's UTXO
  • What is the average size in Bytes of a Bitshares transaction?
  • How are transactions validated?
  • Are there any special affordances made for privacy such as using CoinJoin or a ZK-SNARK based privacy scheme like Zerocash? If mixing is integrated at the protocl level are you using the standards set forth by the BNMCKF Mixcoin proposal?

Blockchain Design
  • What data structures are used in the blockchain?
  • What is the format of the block header?
  • How do you guarantee liveness, correctness and consistency as the network changes state?
  • How are blockchain reorganizations addressed?
  • Being a trading system, what prevents front running?
  • What economic incentives do those promoting a correct state have for honest behavior?
  • Are there incentives for data relay?
  • What is an anticipated rate of growth for the Bitshares blockchain per day?
  • What is the maximum bitshares block size?
  • Are there any sharding mechanics currently deployed?
  • How are SPV clients handled?
  • Does the protocol provide mechanisms for overlay protocols to interact such as OR_RETURN?
  • How is time addressed in the blockchain? Is NTP used or some other protocol?
  • How do new clients bootstrap into the network?
  • What is the average block time? How long does it take for this block to propagate to 95 percent of the network? Is this done via a gossip protocol or through a federate relay?
  • How do you address forks in the network? What level of byzantine fault tolerance does the network have given a Quorum set N?

Development and Governance
  • How many developers are actively working on the protocol? Where are they located and what is their stake in the project?
  • What is the protocol being developed in?
  • What development standards and methodologies are being deployed to ensure the code is high quality?
  • How is testing addressed? Do you have test suites and a test net?
  • Has Bitshares 2 gone through a security audit?
  • How are upgrades to the protocol handled? Is there an equivalent notion to BIPs from bitcoin? How can I propose new or changed code?
  • What license is Bitshares source code developed under? Is it compatible with the Free software foundation's notion of open source?
  • How are the Bitshares core developers documenting both the protocol and the source code? Is there an explicit method for how this should be done?
« Last Edit: October 21, 2015, 08:38:28 pm by IOHKCharles »