Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

基础数据格式 #2

Open
clarenous opened this issue Mar 10, 2019 · 1 comment
Open

基础数据格式 #2

clarenous opened this issue Mar 10, 2019 · 1 comment

Comments

@clarenous
Copy link
Owner

clarenous commented Mar 10, 2019

syntax = "proto3";

package typespb;

// Hash (32 bytes)
message Hash {
    fixed64 s0 = 1;
    fixed64 s1 = 2;
    fixed64 s2 = 3;
    fixed64 s3 = 4;
}

message Hash160 {
    fixed32 s0 = 1;
    fixed32 s1 = 2;
    fixed32 s2 = 3;
    fixed32 s3 = 4;
    fixed32 s4 = 5;
}

// Block
message Block {
    BlockHeader block_header    = 1;
    repeated    Tx transactions = 2;
}

// Block Header
message BlockHeader {
    Hash                chain_id         = 1;
    uint64              version          = 2;
    uint64              height           = 3;
    uint64              timestamp        = 4;
    Hash                previous         = 5;
    Hash                transaction_root = 6;
    Hash                witness_root     = 7;
    bytes               proof            = 8;
}

// Transaction
message Tx {
    message TxIn {
        message ValueSource {
            Hash      txid  = 1;
            uint64    index = 2;
        }
        ValueSource value_source  = 1;
        bytes       redeem_script = 2;
        bytes       unlock_script = 3;
        uint64      sequence      = 4;
    }
    message TxOut {
        uint64  value         = 1;
        Hash160 script_hash   = 2;
    }
    message Evidence {
        bytes  digest       = 1;
        bytes  source       = 2;
        bytes  valid_script = 3;
    }
    uint64            version   = 1;
    repeated TxIn     inputs    = 2;
    repeated TxOut    outputs   = 3;
    repeated Evidence evidences = 4;
    uint64            lock_time = 5;
}
syntax = "proto3";

package pow;

// PoW Proof
message Proof {
    uint64 target = 1;
    uint64 nonce  = 2;
}
@clarenous
Copy link
Owner Author

@Qearlyy 这一版基本定稿。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant