/// <reference types="node" />
import { IConnection } from "../network";
import { RosterWSConnection } from "../network";
import { Roster } from "../network/proto";
import { GetSingleBlockByIndexReply, StoreSkipBlockReply } from "./proto";
import { SkipBlock } from "./skipblock";
/**
 * SkipchainRPC provides basic tools to interact with a skipchain
 * with a given roster
 *
 * TODO:
 * - make SkipchainRPC with only static methods
 * - add Skipchain class that represents one single skipchain
 */
export default class SkipchainRPC {
    static serviceName: string;
    /**
     * Create a leader connection. As the roster can change over the course of a
     * skipchain, this the leader is not always the same.
     *
     * @param roster list of nodes, the first one is taken as the leader
     */
    private static getLeader;
    private roster;
    private conn;
    constructor(nodes: Roster | IConnection | RosterWSConnection);
    /**
     * Create a skipchain with a base and a max height
     *
     * @param baseHeight    base height of the skipchain
     * @param maxHeight     maximum height of the skipchain
     * @returns a promise that resolves with the genesis block
     */
    createSkipchain(baseHeight?: number, maxHeight?: number): Promise<StoreSkipBlockReply>;
    /**
     * Add a new block to a given skipchain
     * @param gid the genesis ID of the skipchain
     * @param msg the data to include in the block
     * @throws an error if the request is not successful
     */
    addBlock(gid: Buffer, msg: Buffer): Promise<StoreSkipBlockReply>;
    /**
     * Get the block with the given ID
     *
     * @param bid   block ID being the hash
     * @returns a promise that resolves with the block
     */
    getSkipBlock(bid: Buffer): Promise<SkipBlock>;
    /**
     * Get the block by its index and the genesis block ID
     *
     * @param genesis   Genesis block ID
     * @param index     Index of the block
     * @returns a promise that resolves with the block, or reject with an error
     */
    getSkipBlockByIndex(genesis: Buffer, index: number): Promise<GetSingleBlockByIndexReply>;
    /**
     * Get the list of known skipchains
     *
     * @returns a promise that resolves with the list of skipchain IDs
     */
    getAllSkipChainIDs(): Promise<Buffer[]>;
    /**
     * Get the shortest path to the more recent block starting from
     * latestID. As the initial roster can change during the skipchain, this
     * method tries hard to get the complete update, even if the roster changes.
     *
     * @param latestID  ID of the block
     * @param verify    Verify the integrity of the chain when true
     * @returns a promise that resolves with the list of blocks
     */
    getUpdateChain(latestID: Buffer, verify?: boolean, acceptProxy?: boolean): Promise<SkipBlock[]>;
    /**
     * Get the latest known block of the skipchain. It will follow the forward
     * links as much as possible and it is resistant to roster changes.
     *
     * @param latestID  the current latest block
     * @param verify    Verify the integrity of the chain
     * @returns a promise that resolves with the block, or reject with an error
     */
    getLatestBlock(latestID: Buffer, verify?: boolean, acceptProxy?: boolean): Promise<SkipBlock>;
    /**
     * Check the given chain of blocks to insure the integrity of the
     * chain by following the forward links and verifying the signatures
     *
     * @param blocks    the chain to check
     * @param firstID   optional parameter to check the first block identity
     * @returns null for a correct chain or a detailed error otherwise
     */
    verifyChain(blocks: SkipBlock[], firstID?: Buffer): Error;
}
