可以在orderer级别实现额外的事务验证逻辑吗?

时间:2017-07-11 11:27:13

标签: hyperledger-fabric

据我了解,orderer服务的功能是按照收到的顺序将交易发送给同行,并提供总订单交付和可靠性以达成共识。作为开发人员,我可以向orderer服务添加代码,以便在广播块验证对等体之前执行额外的验证检查,例如tx1应始终在tx2之前或基于事务有效负载执行某些验证。

1 个答案:

答案 0 :(得分:0)

虽然扩展当前的订购服务实施对我来说听起来不是一个正确的方法,但如果您想添加额外的验证政策,您可能会考虑使用可插入的ESCC或VSCC政策的可能性(分别认可,验证政策)

此外,只要符合/实施Deliver / Broadcast API,您就可以使用自己的订购服务并将其插入而不是两个当前可用的选项。

message BroadcastResponse {
    common.Status status = 1;
}

message SeekNewest { }

message SeekOldest { }

message SeekSpecified {
    uint64 number = 1;
}

message SeekPosition {
    oneof Type {
        SeekNewest newest = 1;
        SeekOldest oldest = 2;
        SeekSpecified specified = 3;
    }
}

// SeekInfo specifies the range of requested blocks to return
// If the start position is not found, an error is immediately returned
// Otherwise, blocks are returned until a missing block is encountered, then behavior is dictated
// by the SeekBehavior specified.  If BLOCK_UNTIL_READY is specified, the reply will block until
// the requested blocks are available, if FAIL_IF_NOT_READY is specified, the reply will return an
// error indicating that the block is not found.  To request that all blocks be returned indefinitely
// as they are created, behavior should be set to BLOCK_UNTIL_READY and the stop should be set to
// specified with a number of MAX_UINT64
message SeekInfo {
    enum SeekBehavior {
        BLOCK_UNTIL_READY = 0;
        FAIL_IF_NOT_READY = 1;
    }
    SeekPosition start = 1;    // The position to start the deliver from
    SeekPosition stop = 2;     // The position to stop the deliver
    SeekBehavior behavior = 3; // The behavior when a missing block is encountered
}

message DeliverResponse {
    oneof Type {
        common.Status status = 1;
        common.Block block = 2;
    }
}

service AtomicBroadcast {
    // broadcast receives a reply of Acknowledgement for each common.Envelope in order, indicating success or type of failure
    rpc Broadcast(stream common.Envelope) returns (stream BroadcastResponse) {}

    // deliver first requires an Envelope of type DELIVER_SEEK_INFO with Payload data as a mashaled SeekInfo message, then a stream of block replies is received.
    rpc Deliver(stream common.Envelope) returns (stream DeliverResponse) {}
}