Adaptors - KevinSmall/blockchain3d GitHub Wiki

Adaptors - Data Sources Available

Adaptors are the link between the outside world and the blockchain3d engine. The engine overview page gives more information about the role of the adaptor layer and the adaptor selector component. This page gives details about the available adaptors and how they source data.

Open the scene called minimal which can be found in the folder Assets/B3d/Demos/Btc/Minimal/Scenes.

Look at the game object called B3dEngineAllInOne, it contains a group of components related to adaptors:

Adaptor Btc Dot Info

The inspector contains the following fields:

Inspector Value Default Explanation
Cdm core Empty The Cdm game object that this adaptor will send data to.
Api Key Empty If you make very many calls to the blockchain.info site, you need to get an API key from them. During normal development, you'll probably not need this.
Api Uri Root for Addr Root address to get bitcoin address data.
Api Uri Root for Tx Root address to get bitcoin transaction data.
Api Uri Root for Tx Root address to get bitcoin transaction data.
Record to File On Off Tick this as on to record the raw data returned by blockchain.info to file. Useful for building offline demo data.
Record to File Folder Addr An assets folder Location where address data will be written.
Record to File Folder Tx An assets folder Location where transaction data will be written.

This adaptor gets bitcoin JSON data from the web API provided by https://blockchain.info. This API always returns transaction data in one call, regardless of how many inputs and outputs the tx has. Address data is paged and is sent in chunks of transactions.

Adaptor Btc Offline Files

The inspector contains the following fields:

Inspector Value Default Explanation
Cdm core Empty The Cdm game object that this adaptor will send data to.
Resources Subfolder for Addr BtcAddress Folder where adaptor will look for offline address data.
Resources Subfolder for Tx BtcTx Folder where adaptor will look for offline transaction data.

This adaptor reads bitcoin JSON data from a Unity resources file. The adaptor expects the source data to look exactly as if it came from the web API https://blockchain.info. In fact the files stored in the folders under /Assets/B3d/Engine/Adaptors/Resources (that get compiled into app at build time) were all created by running the AdaptorBtcDotInfo adaptor in "record mode" by ticking the Record to File On checkbox in its inspector.