bloxberg Demonstration Notebook

​
Accessing bloxberg blockchain data
Supplementary material for the book “Innovations in Social Finance” and for users of FairAi.uk

BlockchainData

◼
  • Ask the latest information about the bloxberg blockchain data.
  • In[]:=
    BlockchainData[BlockchainBase"bloxberg"]//Dataset
    Out[]=
    Type
    Ethereum
    Name
    bloxberg
    Core
    Ethereum
    Blocks
    6601040
    LatestBlockHash
    1396e94a228f377a9b390e73da95c4882b2cc26c7345060ecddf62de8063baf2

    BlockchainBlockData

    ◼
  • Let’s check information about the latest block.
  • In[]:=
    BlockchainBlockData[-1,BlockchainBase"bloxberg"]//Dataset
    Out[]=
    BlockHash
    1396e94a228f377a9b390e73da95c4882b2cc26c7345060ecddf62de8063baf2
    BlockNumber
    6601040
    Timestamp
    Wed 27 May 2020 10:17:15
    ValidatorAddress
    9CA00a5b1B61157D5D75F0c41cdDb157dD050d71
    ValidatorName
    9CA00a5b1B61157D5D75F0c41cdDb157dD050d71
    ByteCount
    588
    Confirmations
    0
    GasUsed
    0
    GasLimit
    10000000
    PreviousBlockHash
    e01a8d998bc6d71c8a07efabec79fb7626f1e4866797485098f31cd110d2eb26
    MerkleRoot
    491bacc54f64c7d27012535a0c8e3c1c9055adbaed0dd68da8cd7a2632436881
    TotalTransactions
    0
    TransactionList
    ◼
  • Let’s check information for specific block number.
  • In[]:=
    BlockchainBlockData[4952741,BlockchainBase"bloxberg"]//Dataset
    Out[]=
    BlockHash
    09718a7d5fd0fd9c6066aa3738d4d08d4be787e59fd954bbeedab800c0da8010
    BlockNumber
    4952741
    Timestamp
    Fri 7 Feb 2020 12:41:55
    ValidatorAddress
    AA4870919390F1026C17651B4F8f29CBc50fD789
    ValidatorName
    Instituto Gulbenkian de Ciencia
    ByteCount
    1991
    Confirmations
    1648301
    GasUsed
    250176
    GasLimit
    8529202
    PreviousBlockHash
    8d45b190c5f6638106a8674b7ae51b68092e49f458d2e9069fe5518506835a73
    MerkleRoot
    cd2803c2df498111c2ffe6d4e44f1d8ac8e7eb3b783d2403088ea22b272ea5ff
    TotalTransactions
    8
    TransactionList
    ec51dab479fa8b3a277a05432c2a9e759d43a796931d80dfc48ec638397e9b96
    a11875a6b0c9bfcb6a775dd290da4cbbbe6ba09dfef41b2d65e817334f052690
    ef2b16d039830132f54d30a742eeebb5752b132e725c66125a97652e3a9e5787
    2575f8626d3c185e8363490d8259b7558bf7d3f2ca5912d1737642d1718d53ee
    75c606c3aec49cce9f9af13bdd40e40b4ddf764bc354d52f89556a100cb7c02d
    791a3776e351d10d37bfcffda2c99c7534fa0ac6e5c819409d5e54a1bac5fced
    fd06e7bdfc81a0e0b05c731e0dfd8a84eb10e0be8296b664da3cb3d6cd971b06
    5c2d420eef6609d966ad060ef998eae9ff1f39595454f189bc76e4ecc291bab7
    ◼
  • Let’s check information for specific block hash.
  • In[]:=
    BlockchainBlockData["09718a7d5fd0fd9c6066aa3738d4d08d4be787e59fd954bbeedab800c0da8010",BlockchainBase"bloxberg"]//Dataset
    Out[]=
    BlockHash
    09718a7d5fd0fd9c6066aa3738d4d08d4be787e59fd954bbeedab800c0da8010
    BlockNumber
    4952741
    Timestamp
    Fri 7 Feb 2020 12:41:55
    ValidatorAddress
    AA4870919390F1026C17651B4F8f29CBc50fD789
    ValidatorName
    Instituto Gulbenkian de Ciencia
    ByteCount
    1991
    Confirmations
    1648302
    GasUsed
    250176
    GasLimit
    8529202
    PreviousBlockHash
    8d45b190c5f6638106a8674b7ae51b68092e49f458d2e9069fe5518506835a73
    MerkleRoot
    cd2803c2df498111c2ffe6d4e44f1d8ac8e7eb3b783d2403088ea22b272ea5ff
    TotalTransactions
    8
    TransactionList
    ec51dab479fa8b3a277a05432c2a9e759d43a796931d80dfc48ec638397e9b96
    a11875a6b0c9bfcb6a775dd290da4cbbbe6ba09dfef41b2d65e817334f052690
    ef2b16d039830132f54d30a742eeebb5752b132e725c66125a97652e3a9e5787
    2575f8626d3c185e8363490d8259b7558bf7d3f2ca5912d1737642d1718d53ee
    75c606c3aec49cce9f9af13bdd40e40b4ddf764bc354d52f89556a100cb7c02d
    791a3776e351d10d37bfcffda2c99c7534fa0ac6e5c819409d5e54a1bac5fced
    fd06e7bdfc81a0e0b05c731e0dfd8a84eb10e0be8296b664da3cb3d6cd971b06
    5c2d420eef6609d966ad060ef998eae9ff1f39595454f189bc76e4ecc291bab7

    BlockchainTransactionData

    ◼
  • Let’s check information about the blockchain transaction using a transaction hash.
  • In[]:=
    BlockchainTransactionData["de99f19438d0fbd151b6f718d5eb2368d3c1a3c59a8d29df06231cd626536876",BlockchainBase"bloxberg"]//Dataset
    Out[]=
    TransactionID
    de99f19438d0fbd151b6f718d5eb2368d3c1a3c59a8d29df06231cd626536876
    BlockHash
    27b33e8d6c15294c9776a1d1ba3178b4638ca5c3bd53c1ada4d78d4c501237f7
    BlockNumber
    4990920
    Confirmations
    1690143
    Time
    Mon 10 Feb 2020 15:58:25
    Status
    True
    TransactionIndex
    0
    Sender
    93dA5507a26090448a03FC1F77e1C7DA20A24292
    Receiver
    9850711951A84Ef8a2A31a7868d0dCa34B0661cA
    Amount
    0
    brox
    GasUsed
    31336
    Fee
    0
    brox
    TransactionCount
    345026
    InputData
    ByteArray
    68 bytes
    
    TransactionDigest
    ByteArray
    32 bytes
    
    DigitalSignature
    DigitalSignature
    type: elliptic curve (secp256k1)
    signature type: deterministic
    
    SenderPublicKey
    PublicKey
    type: elliptic curve (secp256k1)
    public key size: 512 bits
    
    EventList
    {Address56e4F51aB81f67DEb59891107f80F83652b98FBD,Topics{32c78b6140c46745a46e88cd883707d70dbd2f06d13dd76fe5f499c01290da4f,00000000000000000000000093da5507a26090448a03fc1f77e1c7da20a24292,0000000000000000000000009583259d41d3409a11e73addadc399f391e7957d,0000000000000000000000000000000000000000000000000000000000000000},DataNull}
    InternalTransactionList
    CallTypeCALL_1,Sender9850711951A84Ef8a2A31a7868d0dCa34B0661cA,Receiver56e4F51aB81f67DEb59891107f80F83652b98FBD,Amount
    0
    brox
    ,GasLimit1550138,GasUsed6035,InputByteArray
    100 bytes
    ,OutputMissing[NotAvailable]

    BlockchainAddressData

    ◼
  • Let’s check information connected with the specified address.
  • In[]:=
    BlockchainAddressData["aA84378fA41da83a9B6523bA46E45A664FbEBFC8",BlockchainBase"bloxberg"]//Dataset
    Out[]=
    › TransactionList
    TransactionID
    BlockNumber
    Time
    Sender
    Receiver
    Amount
    0728c27bea2876f2adb1f57e357793230cda2373deb66b1cafe666dfeea467ba
    6281307
    Mon 4 May 2020 04:57:35
    aA84378fA41da83a9B6523bA46E45A664FbEBFC8
    19e51aFD3EfA98A6E4B82D3834DE174D7a33f9B5
    0
    brox
    9f58d4a5124da11224c7cba8a6cf41b64074e6121940a72a8b521099b40df9c7
    6280989
    Mon 4 May 2020 04:25:55
    aA84378fA41da83a9B6523bA46E45A664FbEBFC8
    19e51aFD3EfA98A6E4B82D3834DE174D7a33f9B5
    0
    brox
    c6e301cb7ee2fd05befb725cabf28fb455fe984f9a2635a1859bf1172032fb8c
    6280985
    Mon 4 May 2020 04:25:30
    aA84378fA41da83a9B6523bA46E45A664FbEBFC8
    19e51aFD3EfA98A6E4B82D3834DE174D7a33f9B5
    0
    brox
    326dba5a2d45eb806bd15a75da5a82f359ec6556698a9f76ecaeff63d7d83c37
    5988785
    Tue 14 Apr 2020 02:30:55
    aA84378fA41da83a9B6523bA46E45A664FbEBFC8
    19e51aFD3EfA98A6E4B82D3834DE174D7a33f9B5
    0
    brox
    8b1cd234f607cb793741a2fc52a914dde013a8b41b931aa585497342ef4b8b00
    5988679
    Tue 14 Apr 2020 02:20:20
    aA84378fA41da83a9B6523bA46E45A664FbEBFC8
    56e4F51aB81f67DEb59891107f80F83652b98FBD
    0
    brox
    52640ca859c07251479b472c9d425786f22bbba76cb92e4c3c885cffb90c2057
    5902864
    Wed 8 Apr 2020 03:55:50
    aA84378fA41da83a9B6523bA46E45A664FbEBFC8
    E5a9654C7e190701016EBf18206020bf16D8Beab
    0
    brox
    f48bdbcd59a078c4a841e529d6e04e4c14c2fd992aab93ceeb257cf5a53c93cc
    5902817
    Wed 8 Apr 2020 03:51:35
    aA84378fA41da83a9B6523bA46E45A664FbEBFC8
    E5a9654C7e190701016EBf18206020bf16D8Beab
    0
    brox
    439d9c5dd26c5f884dccaabebd7d1c9e7b7d91ca8bd59264b9294aa9149a0c1f
    5902745
    Wed 8 Apr 2020 03:45:00
    aA84378fA41da83a9B6523bA46E45A664FbEBFC8
    E5a9654C7e190701016EBf18206020bf16D8Beab
    0
    brox
    2bfad84bcd51c07e90e0b8b46d7f6d519004b46bb2712750ba96b1664ff86706
    5890456
    Tue 7 Apr 2020 08:06:05
    aA84378fA41da83a9B6523bA46E45A664FbEBFC8
    E5a9654C7e190701016EBf18206020bf16D8Beab
    0
    brox
    3f6d232b4de618879684693179a7ca827d39fe09f798b965e00aa7c082731714
    5887397
    Tue 7 Apr 2020 03:17:20
    aA84378fA41da83a9B6523bA46E45A664FbEBFC8
    E5a9654C7e190701016EBf18206020bf16D8Beab
    0
    brox
    b6df7324a791ceac42b449b214cccbd028f39d538a194be2d1d5239fc422c021
    5875491
    Mon 6 Apr 2020 08:21:10
    aA84378fA41da83a9B6523bA46E45A664FbEBFC8
    D216153c06E857cD7f72665E0aF1d7D82172F494
    1000000000000000000
    brox
    c425df69a327108153b2005effc8ef79247d3f91bfcf4afdb7de7ac0b7acf020
    5813769
    Thu 2 Apr 2020 06:55:10
    aA84378fA41da83a9B6523bA46E45A664FbEBFC8
    19e51aFD3EfA98A6E4B82D3834DE174D7a33f9B5
    0
    brox
    f448e810bd877ffe0382594e6034d9c638e77b8919078594431198a3f551ead0
    5799339
    Wed 1 Apr 2020 07:58:00
    aA84378fA41da83a9B6523bA46E45A664FbEBFC8
    19e51aFD3EfA98A6E4B82D3834DE174D7a33f9B5
    0
    brox
    9f698392a46a09ac3bbf63a7a49a7b932907488fc223c0830f2081bd3fb1008a
    5799044
    Wed 1 Apr 2020 07:29:45
    aA84378fA41da83a9B6523bA46E45A664FbEBFC8
    19e51aFD3EfA98A6E4B82D3834DE174D7a33f9B5
    0
    brox
    ccc45d5b81c442d2ebf6069131f1b43579add5484ff81ea8805c6a7416a1157b
    5796267
    Wed 1 Apr 2020 03:03:15
    aA84378fA41da83a9B6523bA46E45A664FbEBFC8
    19e51aFD3EfA98A6E4B82D3834DE174D7a33f9B5
    0
    brox
    66511eeefbed3b4e8d4e8b003a21840e52b6c42aa583dcc35fb62021c469ac69
    5796252
    Wed 1 Apr 2020 03:01:50
    aA84378fA41da83a9B6523bA46E45A664FbEBFC8
    19e51aFD3EfA98A6E4B82D3834DE174D7a33f9B5
    0
    brox
    266262ded433fa3fa1aeeca9eeb9f1b590928169ce8d851cc4991f408caa0695
    5781765
    Tue 31 Mar 2020 04:19:25
    aA84378fA41da83a9B6523bA46E45A664FbEBFC8
    19e51aFD3EfA98A6E4B82D3834DE174D7a33f9B5
    0
    brox
    2e56f52cc29cccbd37e01e2432b243350efa0a8e7b3c9325f30234ef46ed73b7
    5781724
    Tue 31 Mar 2020 04:15:30
    aA84378fA41da83a9B6523bA46E45A664FbEBFC8
    56e4F51aB81f67DEb59891107f80F83652b98FBD
    0
    brox
    cd45aac6116b4ae603ff6547e2c31668a0b947d78202cae0b3f09b9fef6936a8
    5767881
    Mon 30 Mar 2020 08:01:40
    aA84378fA41da83a9B6523bA46E45A664FbEBFC8
    D216153c06E857cD7f72665E0aF1d7D82172F494
    1000000000000000000
    brox
    1b52c92517768ee765fe3ad101f112609e1ad3f12a39d284b0cbef2463f59c57
    5703626
    Thu 26 Mar 2020 09:32:20
    aA84378fA41da83a9B6523bA46E45A664FbEBFC8
    D216153c06E857cD7f72665E0aF1d7D82172F494
    1000000000000000000
    brox

    BlockchainTokenData

    ◼
  • Let’s check all the tokens deployed on the bloxberg blockchain
  • In[]:=
    Dataset[BlockchainTokenData[All,BlockchainBase"bloxberg"],MaxItemsAll]
    ◼
  • Let’s check holder’s tokens.
  • BlockchainContractValue

    ◼
  • Let’s check the RelaySet contract address
  • ◼
  • Ask for the owner address calling the “owner” property at the RelaySet contract
  • ◼
  • The syntax to use the Typed symbol is the following:
  • ◼
  • Typed[func, datatype], where the func and datatype is defined in a Solidity smart contract code
  • ◼
  • Typed[property, datatype], where the property and datatype is defined in a Solidity smart contract code
  • ◼
  • Ask for the current validators calling the function “getValidators” at the RelaySet contract.
  • $BlockchainBase

    Gives the name of the default blockchain to be used for blockchain computations. By default it is Automatic which for the blockchain computations is Bitcoin.
    ◼
  • Changing the setting to bloxberg:
  • ◼
  • BlockchainData will use the current setting for $BlockchainBase:
  • Exploring Units on bloxberg
    In the following weeks Unit will have support for the official symbol of bergs
    Create a bloxberg account
    Generate an address to make basic transactions on the bloxberg blockchain network. As bloxberg is based on Ethereum, the next steps generate a valid address and key pair as well.
    ◼
  • First we need the private and the public key. We generate those keys with GenerateAsymmetricKeyPair.
  • ◼
  • The following shows the private key in HEX string
  • ◼
  • The following shows the private key in HEX string
  • ◼
  • Use BlockchainKeyEncode to derive a unique new Ethereum address from the public key, it can be used as a bloxberg account address:
  • ◼
  • Use BarcodeImage to create a QR code associated with this Ethereum address
  • ◼
  • Send QR code, use SendMessage to send the address and QR code to your mobile device
  • ◼
  • Save your private key. Use Export to save the private key to a .wl file for later use:
  • Send bergs
    ◼
  • Changing the setting to bloxberg:
  • ◼
  • Set the addresses of the sender and the receiver
  • ◼
  • Use BlockchainAddressData to check receiver’s balance
  • ◼
  • Use BlockchainAddressData to check the balance and the transaction count of the sender
  • ◼
  • Set a gas price
  • ◼
  • Use BlockchainTransaction to build the transaction object, using the preceding transaction count and gas price. The following example will send 1 Gbrox to the receiver’s address.
  • ◼
  • The transaction exists locally until it is submitted to the bloxberg blockchain
  • ◼
  • Use BlockchainTransactionSign to sign the transaction with the private key as HEX string
  • ◼
  • Another option it to use the key pair coming from the BlockchainKeyEncode. In this way, your private key is not exposed as HEX String
  • ◼
  • Use BlockchainTransactionSubmit to send the transaction to the blockchain
  • ◼
  • After the transaction is submitted, you must wait for it to be included in a block.
  • ◼
  • Use BlockchainTransactionData and the transaction ID to check if the transaction has been added to the blockchain.
  • ◼
  • Use BlockchainAddressData to check the receiver’s balance. The previous balance was 13 Gbrox but now it’s 14 Gbrox
  • Verify a transaction using a Cryptographic Digital Signature
    ◼
  • Use BlockchainTransactionData with a transaction ID, the output includes a TransactionDigest, a Digital Signature and the sender’s Public Key.
  • ◼
  • Use VerifyDigitalSignature to verify the signature with the public key
  • Use Case: “Verify & Certify”
    ◼
  • Let’s hash a Notebook with research data on Coronavirus
  • ◼
  • We also need UNIX time and the certify contract address.
  • ◼
  • To send a transaction, an address with some berg balance and a private key are required
  • ◼
  • Use BlockchainAddressData to know the transaction for the address
  • ◼
  • Set a gas price value
  • ◼
  • Use BlockchainTransaction to build a transaction that calls to createData which is a function in the certify smart contract
  • ◼
  • Where the FunctionCall key parameter set the Function and Inputs to call to a smart contract’s function
  • ◼
  • Typed[func, {idatatype1, idatatyp2,...}] -> {odatatype}, the left side of this rule set function name and the Solidity datatype of the inputs. The right side set the Solidity datatype of the output.
  • ◼
  • Inputs -> {ivalue1, ivalue2,...}, This rule set the input values
  • ◼
  • Use BlockchainTranscationSign to sign the transaction
  • ◼
  • Use BlockchainTransactionSubmit to submit the transaction
  • ◼
  • Let’s check if our transaction has been added to the blockchain.
  • ◼
  • Use the TransactionID to verify the transaction
  • ◼
  • The following works as the bloxberg verifying application