summaryrefslogtreecommitdiff
path: root/3e/4d427da4bf2cb14e4cc419f9bbe6a2741d5d7e
blob: 6260d81f313339b363f6c840f94a469e0d1f19b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
Return-Path: <johanth@gmail.com>
Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137])
 by lists.linuxfoundation.org (Postfix) with ESMTP id 103B7C0032
 for <bitcoin-dev@lists.linuxfoundation.org>;
 Fri, 29 Sep 2023 13:14:39 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by smtp4.osuosl.org (Postfix) with ESMTP id DEEA042DB6
 for <bitcoin-dev@lists.linuxfoundation.org>;
 Fri, 29 Sep 2023 13:14:38 +0000 (UTC)
DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org DEEA042DB6
Authentication-Results: smtp4.osuosl.org;
 dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com
 header.a=rsa-sha256 header.s=20230601 header.b=lJ7rTS+s
X-Virus-Scanned: amavisd-new at osuosl.org
X-Spam-Flag: NO
X-Spam-Score: -2.099
X-Spam-Level: 
X-Spam-Status: No, score=-2.099 tagged_above=-999 required=5
 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
 DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001]
 autolearn=ham autolearn_force=no
Received: from smtp4.osuosl.org ([127.0.0.1])
 by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id rEMW42W9NIBy
 for <bitcoin-dev@lists.linuxfoundation.org>;
 Fri, 29 Sep 2023 13:14:38 +0000 (UTC)
Received: from mail-yb1-xb2f.google.com (mail-yb1-xb2f.google.com
 [IPv6:2607:f8b0:4864:20::b2f])
 by smtp4.osuosl.org (Postfix) with ESMTPS id C4A4442DA0
 for <bitcoin-dev@lists.linuxfoundation.org>;
 Fri, 29 Sep 2023 13:14:37 +0000 (UTC)
DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org C4A4442DA0
Received: by mail-yb1-xb2f.google.com with SMTP id
 3f1490d57ef6-d81b42a3108so15821179276.1
 for <bitcoin-dev@lists.linuxfoundation.org>;
 Fri, 29 Sep 2023 06:14:37 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1695993276; x=1696598076;
 darn=lists.linuxfoundation.org; 
 h=to:subject:message-id:date:from:mime-version:from:to:cc:subject
 :date:message-id:reply-to;
 bh=dYaTCv9WeBroPGo5E2DTBy4OcjUSyEXNUSUVzcsP4uI=;
 b=lJ7rTS+shVZFGJqogyYcihYLZn80La+lm0j58gSJ3LdJdKab1BokJcF8Ze/KtXOdyc
 87NdolhKEJV/hMiijx4/i/oux9ftmUdiod2sMxvVS25EUtNECAiOHE1WyjLDOJ/jy/Ca
 1EkoZ0h1dPH8Xz+iUKinCBFLYjJvipeFlk6ftgVkdmBCEJD5HJtRW6WH+CpHYJvVfFxv
 hV8sPg43Le/bnUbQ0ETpoL7hkwfNoGCdIpCEMV3Ei3VDI7vNJOIUHxN/mzbea83rWSAz
 6/Up3dFNZAjtma0UVZiTfXCqXN6FbWJkvxJTElrTOie39knC5jrcieCInck/xNKGbMpf
 Ik3Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1695993276; x=1696598076;
 h=to:subject:message-id:date:from:mime-version:x-gm-message-state
 :from:to:cc:subject:date:message-id:reply-to;
 bh=dYaTCv9WeBroPGo5E2DTBy4OcjUSyEXNUSUVzcsP4uI=;
 b=ZmNgBKMXRv5nKRSnPZU4gVONcbddCgD0hc/M3nvA4/t2xKkv/24vGehDHW8D8JkEYw
 L0WjVJJU6TnhbYxxeI/km/x5fdKmC5276XyToRGskHYkNbRO2L6YRzCldZr1/17sMkzd
 vVxuR8e5I8qzfNdzyipmYzc1VrFB3SnjGk+RffT5i7jatp6k3kXz0uzICYk+4N8OEYkZ
 my1nRSRGcvkGVxUu96FW4UvyjNkUu51K+075p/DqcKvzmD/dgT7RVBUv22LFCzPtTX/E
 mRVKLD2spP3MQd0hJHLf1chIZek52kvR0OCq+B7TZf79B1NvgTaurSZBKo1Laer7Hs8N
 axeQ==
X-Gm-Message-State: AOJu0Ywm0AaCLjiQMU675g81aIC/PYzthBOUBezf3pgmjnmpdhHxthjn
 ZFKwZCHdSy0HUnv7Qpe/k8l9s94WTjdqEV0+9X3oWidiYf940g==
X-Google-Smtp-Source: AGHT+IEOM9kaMb5uRDTvYaOHVG5WfNiCgI0FZF5DErNVk01c0OWv0Ndf5jGLyjl7bZ7YjU6csXGZH/i6YGdIUD7WzGU=
X-Received: by 2002:a25:5f41:0:b0:d88:a049:e902 with SMTP id
 h1-20020a255f41000000b00d88a049e902mr4161844ybm.53.1695993276300; Fri, 29 Sep
 2023 06:14:36 -0700 (PDT)
MIME-Version: 1.0
From: =?UTF-8?Q?Johan_Tor=C3=A5s_Halseth?= <johanth@gmail.com>
Date: Fri, 29 Sep 2023 15:14:25 +0200
Message-ID: <CAD3i26BAoN06rR=BnvNDDBCyMkKTcROGK7zaC784XV5FWYM+5w@mail.gmail.com>
To: Bitcoin Protocol Discussion <bitcoin-dev@lists.linuxfoundation.org>
Content-Type: text/plain; charset="UTF-8"
X-Mailman-Approved-At: Fri, 29 Sep 2023 15:08:59 +0000
Subject: [bitcoin-dev] MATT: [demo] Optimistic execution of arbitrary
	programs
X-BeenThere: bitcoin-dev@lists.linuxfoundation.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: Bitcoin Protocol Discussion <bitcoin-dev.lists.linuxfoundation.org>
List-Unsubscribe: <https://lists.linuxfoundation.org/mailman/options/bitcoin-dev>, 
 <mailto:bitcoin-dev-request@lists.linuxfoundation.org?subject=unsubscribe>
List-Archive: <http://lists.linuxfoundation.org/pipermail/bitcoin-dev/>
List-Post: <mailto:bitcoin-dev@lists.linuxfoundation.org>
List-Help: <mailto:bitcoin-dev-request@lists.linuxfoundation.org?subject=help>
List-Subscribe: <https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev>, 
 <mailto:bitcoin-dev-request@lists.linuxfoundation.org?subject=subscribe>
X-List-Received-Date: Fri, 29 Sep 2023 13:14:39 -0000

Hi, all!

I've been working on an implementation of the original MATT challenge
protocol[0], with a detailed description of how we go from a
"high-level arbitrary program" to something that can be verified
on-chain in Bitcoin Script.

You can find the write-up here, which also includes instructions of
how to run the code and inspect the transactions using a local block
explorer: https://github.com/halseth/mattlab/blob/main/docs/challenge.md

TLDR; Using the proposed opcode OP_CHECKCONTRACTVERIFY and OP_CAT, we
show to trace execution of the program `multiply` [1] and challenge
this computation in O(n logn) on-chain transactions:

func multiply(x int) int {
    i := 0
    while {
        if i < 8 {
            x = x + x
            i = i + 1
        } else {
            break
        }
    }
    return x
}

Next steps would be to make this a generic framework with tools to
automatically compile arbitrary high-level programs down to
MATT-compatible Bitcoin Scripts.

All feedback appreciated!

- Johan

[0] https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2022-November/021182.html
[1] https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2022-November/021205.html