MCPcopy
hub / github.com/yeasy/blockchain_guide / txUnixTime

Function txUnixTime

11_app_dev/chaincode_example05.go:259–265  ·  view source on GitHub ↗
(ctx contractapi.TransactionContextInterface)

Source from the content-addressed store, hash-verified

257}
258
259func txUnixTime(ctx contractapi.TransactionContextInterface) (int64, error) {
260 timestamp, err := ctx.GetStub().GetTxTimestamp()
261 if err != nil {
262 return 0, fmt.Errorf("failed to read transaction timestamp: %w", err)
263 }
264 return timestamp.Seconds, nil
265}
266
267func nextID(ctx contractapi.TransactionContextInterface, counterKey string) (int, error) {
268 id, err := currentID(ctx, counterKey)

Callers 1

BuyByAddressMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected