_images/database.png

Querying

Assets and contracts deployed on the ledger be queried for specific information regarding their state, history of all previous states, and all participants involved in their history.

Integrating Private State

The private state file contains values to use with Storage Commitment Scheme.

To check whether a private state file matches the locals in a contract:

$ uplink scripts compile contracts/locals.s -s contracts/locals_state.json

To commit a private state file to the local db for a specific contract and account:

$ uplink data commit contracts/locals_state.json <contract_addr> <account_addr>

Private state allows two parties to load some private values shared between them into a contract. These values can then have certain operations applied to them by a contract. After a contract is finalized, the creator of the contract can then reveal a parameter of the commitment process, which allows other parties to verify there initial values were the same.

Querying Ledger Database

The uplink command line exposes two ways to get data:

Get a contract, asset, or account by address

$ uplink data get <address>

Dumping all contracts, assets, accounts, and blocks

$ uplink data list

Exporting to XML

Exporting to XML:

$ uplink data export backup.xml
<?xml version="1.0" encoding="UTF-8"?>
<blocks>
    <block index="0">
        <signatures>
            <BlockSignature signature="AE4xMTUxMzY4MDA4MjA0NTY4MzM3Mzc5OTQxMjY3NzEzODYwMTUwMjYyODcwOTUwMzQ2MjU2MjM2NDQxODYyNzgxMDg5MjY2OTA3Nzk1Njc6AE0zNDMyMDI5NDIxMzI4MTA2OTgzNTQwNjkyMDAxNDY1MTc4NDA1MjA5ODQ4MjkxMTA0NDYzMjk1NDcwODM5OTc0OTU1MzIzNTc2ODcwNA==" signerAddr="fwBVDsVh8SYQy98CzYpNPcbyTRczVUZ96HszhNRB8Ve"/>
        </signatures>
        <header origin="fwBVDsVh8SYQy98CzYpNPcbyTRczVUZ96HszhNRB8Ve" prevHash="" merkleRoot="a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a" timestamp="1231006505">
            <consensus validatorSet="fromList []" blockPeriod="1" blockGenLimit="1" blockSignLimit="1" threshold="1" minTxs="1"/>
        </header>
        <transactions/>
    </block>
</blocks>