summaryrefslogtreecommitdiff
path: root/7d/421b0f03e221d3e00a528b8c1599227fbd0698
blob: 67b4943da873cad0a4505cfe11ebd22fcaf92577 (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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
Delivery-date: Sat, 04 May 2024 08:40:31 -0700
Received: from mail-yb1-f190.google.com ([209.85.219.190])
	by mail.fairlystable.org with esmtps  (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
	(Exim 4.94.2)
	(envelope-from <bitcoindev+bncBCKI7BNCZUJBBZ5N3GYQMGQE245DPQI@googlegroups.com>)
	id 1s3HV0-0006Ka-Lo
	for bitcoindev@gnusha.org; Sat, 04 May 2024 08:40:31 -0700
Received: by mail-yb1-f190.google.com with SMTP id 3f1490d57ef6-de5a8638579sf1376571276.1
        for <bitcoindev@gnusha.org>; Sat, 04 May 2024 08:40:30 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=googlegroups.com; s=20230601; t=1714837224; x=1715442024; darn=gnusha.org;
        h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post
         :list-id:mailing-list:precedence:x-original-sender:mime-version
         :subject:message-id:to:from:date:sender:from:to:cc:subject:date
         :message-id:reply-to;
        bh=nP2n7Ei2uXToiQ5Lj5tM//G4jxMRaUXKwtD4W8Zq4Ls=;
        b=bu9LV46Gui5P9waV4zrgGsMWio+LNHw5ldjG27k/Fy4W8ejzZ2T7s0LRPyBmGzuBy5
         o/Fy115oPGy6ooTm5wXkCxzD1mxKTNsY/feQNaQzjRDt7isQEgqy84qQH12KexU0AvdY
         V30QaF/rGTRr7ncG2SUNcrQpBOAt5cJv5QomL88RLeK0nhghPaMBf1sEt61f4k1Xvr7c
         /9Ls1gpeGN4H44yryKwQDmCzY6OebwzjTOcyJL9llqWSoBngmsC4ZvsvMtpW6PVDpaBv
         Wsqs/TXbyCcRcFG1+DwsK9E+XMNwL9KqK27TBJhL8cGVNQ+guoiOv/d4x228r15Bu4At
         8ZCw==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20230601; t=1714837224; x=1715442024; darn=gnusha.org;
        h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post
         :list-id:mailing-list:precedence:x-original-sender:mime-version
         :subject:message-id:to:from:date:from:to:cc:subject:date:message-id
         :reply-to;
        bh=nP2n7Ei2uXToiQ5Lj5tM//G4jxMRaUXKwtD4W8Zq4Ls=;
        b=ZVuBczmof4Fi7HJ+r+t3jzXKXUJPGvWuMdWUXAzWG4+vVHqpr7yXuysDVizyn0r8hJ
         UrixPHpDDsRMEF+yhyV/6dCEaw6L29+zXyWrGpjvLES1fC61Cq1CUN8xB5Eed1ZNoOxW
         W5pppJ1MZrhw7o6OkUpIGoQmEfiiHCLbonopbiN5PLTkXQYzivxwuzQJvf74B9GFp7+L
         v41nWBHcm1Buce3IflGELH1fZy+tHL1pCnHnc+PrcaaUyHOBS+cQbK7cUP+4i2GEfSQP
         N/dMt0lb9YtIgZ46KmEvNa32gY86KY0data3SGFqIs0mjL1XRAyJRz1Re9ylnOLMntmx
         g6yw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20230601; t=1714837224; x=1715442024;
        h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post
         :list-id:mailing-list:precedence:x-original-sender:mime-version
         :subject:message-id:to:from:date:x-beenthere:x-gm-message-state
         :sender:from:to:cc:subject:date:message-id:reply-to;
        bh=nP2n7Ei2uXToiQ5Lj5tM//G4jxMRaUXKwtD4W8Zq4Ls=;
        b=TwEkB182lwnFIhAinXPVg5IsBWrJDljv+ZGIi2klSk9Ja30mIfZ8iGigstRlr9j6FN
         X4XsfRZi5D1En2zCDISZhFTLShPgqstQNnr/3dQ6UqpqxEeHsjR0rxDi03VYH3+TxeCg
         MBHnS7KLdw+btb4c2HaOQsTBVBHTIpoqMQxS9TvadHxYMDJpgQ6n7dVELu8EvBXQLc/B
         TfU1SfzlUQcgdRW9NzwXrrzmP2T3LbeVShZI9wXtDPjNMkoXuqLf9wOvH2wgdyd44JQJ
         6dxG/oJVmk25lFzX0Sn6mz/LMp1UdDapJM1ChPWOEIaPhfn53yEIg4Yd6ne2EhqVYv08
         EjHw==
Sender: bitcoindev@googlegroups.com
X-Forwarded-Encrypted: i=1; AJvYcCU5Y49/0f4V0nBRF74g2TStPKYCXCdIJ5WFPd9FR1nGhP+4zFaS3Uofkt5b/wpI8gFseqotDZbpXOitlem074ZGgN3pHas=
X-Gm-Message-State: AOJu0YyeJecBzjOX2KbvaIhRZ7PhzokBXKaDlJphMuq3vAlshnxx9Ugq
	ucV3isCRXFcAb7zkVHMf2ka076tm4sj9OJa4E0vDXpcdAImNMadd
X-Google-Smtp-Source: AGHT+IEDw3Geo9StDtl/GU2REZ2ME7WRdfRaniY3OPWZYCyUxZfFlmfs834ZZgFXkTqB8jQJoEXI3A==
X-Received: by 2002:a25:7446:0:b0:de5:5040:ea12 with SMTP id p67-20020a257446000000b00de55040ea12mr6712874ybc.32.1714837224470;
        Sat, 04 May 2024 08:40:24 -0700 (PDT)
X-BeenThere: bitcoindev@googlegroups.com
Received: by 2002:a25:ac19:0:b0:dcc:37ed:efb1 with SMTP id 3f1490d57ef6-de8b54f938els551488276.2.-pod-prod-00-us;
 Sat, 04 May 2024 08:40:22 -0700 (PDT)
X-Received: by 2002:a05:6902:2192:b0:de6:569:325c with SMTP id dl18-20020a056902219200b00de60569325cmr2124039ybb.4.1714837222771;
        Sat, 04 May 2024 08:40:22 -0700 (PDT)
Received: by 2002:a05:690c:d8a:b0:620:26bb:319f with SMTP id 00721157ae682-62026bb31f1ms7b3;
        Sat, 4 May 2024 08:00:09 -0700 (PDT)
X-Received: by 2002:a05:690c:d8c:b0:61b:e2e9:b59c with SMTP id da12-20020a05690c0d8c00b0061be2e9b59cmr1346765ywb.4.1714834808033;
        Sat, 04 May 2024 08:00:08 -0700 (PDT)
Date: Sat, 4 May 2024 08:00:07 -0700 (PDT)
From: Fractal Encrypt <fractalencryptlsd@gmail.com>
To: Bitcoin Development Mailing List <bitcoindev@googlegroups.com>
Message-Id: <75628135-32ae-4df3-be52-9f7d054bc096n@googlegroups.com>
Subject: [bitcoindev] A Fool's Errand or should I try?
MIME-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_1712_337132614.1714834807661"
X-Original-Sender: fractalencryptlsd@gmail.com
Precedence: list
Mailing-list: list bitcoindev@googlegroups.com; contact bitcoindev+owners@googlegroups.com
List-ID: <bitcoindev.googlegroups.com>
X-Google-Group-Id: 786775582512
List-Post: <https://groups.google.com/group/bitcoindev/post>, <mailto:bitcoindev@googlegroups.com>
List-Help: <https://groups.google.com/support/>, <mailto:bitcoindev+help@googlegroups.com>
List-Archive: <https://groups.google.com/group/bitcoindev
List-Subscribe: <https://groups.google.com/group/bitcoindev/subscribe>, <mailto:bitcoindev+subscribe@googlegroups.com>
List-Unsubscribe: <mailto:googlegroups-manage+786775582512+unsubscribe@googlegroups.com>,
 <https://groups.google.com/group/bitcoindev/subscribe>
X-Spam-Score: -0.5 (/)

------=_Part_1712_337132614.1714834807661
Content-Type: multipart/alternative; 
	boundary="----=_Part_1713_833547110.1714834807661"

------=_Part_1713_833547110.1714834807661
Content-Type: text/plain; charset="UTF-8"

TLDR: I'd like to investigate the possibilities of extending 
decoderawtransaction to include the fee (and maybe even sats per v/b).

I'm hoping it will be a good project for me to work on and build at least a 
tiny understanding of bitcoin development.

------------------------------------------------------------------------

I use the createrawtransaction function to create transactions, and before 
broadcasting, I always like to use decoderawtransaction to see if I made 
any mistakes.

I've sometimes messed up on the fee calculation, as I do that myself with a 
calculator.

Unfortunately decoderawtransaction doesn't give me the fee information (for 
a very good reason, it is not aware of the value of the inputs in the tx).

So to double check the fees, instead of using createrawtransaction, I'll 
use createpsbt and then go through the process of finalizing it so I can 
run decodepsbt, which does give the fee along with all the other relevant 
data.

But the createpsbt process is more work for a simple transaction where all 
UTXOs are in the wallet I am creating the rawtx in.

My goal would be to modify decoderawtransaction to perform these additional 
steps:
   
   1. Fetch UTXO details for each input.
   2. Calculate the total input value.
   3. Subtract the total output value to determine the fee.

Additionally there are the considerations about whether the inputs in the 
transaction are in your wallet or not. 

If I run listunspent it gives me the info I need to create the raw tx or 
psbt, and it has the values of the UTXOs that will be used as inputs in my 
tx.

But I understand decoderawtransaction is meant to be used whether or not 
the keys are in your wallet (so I was thinking to make a command argument 
T/F to show the fee value only if keys are in your wallet).

Alternatively if you are running the command in a node with txindex, then 
you have the full chainstate to look up txids (whether unspent or not) - so 
this needs to be addressed too.

Doing this within my own node would be cool enough and I don't necessarily 
need it to go farther than that. However if I do get it working, I'd 
certainly try to submit a PR.

I have no idea if any of this is possible, so I wanted to ask here for some 
guidance and maybe mentorship in this self-interest driven project. Also 
looking for this to be shot down mercilessly if it's just ridiculous.

My abilities and skills are very low. My interest and persistence are high.

Any help or ridicule invited ;)

-- 
You received this message because you are subscribed to the Google Groups "Bitcoin Development Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bitcoindev+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bitcoindev/75628135-32ae-4df3-be52-9f7d054bc096n%40googlegroups.com.

------=_Part_1713_833547110.1714834807661
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div>TLDR: I'd like to investigate the possibilities of extending decoderaw=
transaction to include the fee (and maybe even sats per v/b).</div><div><br=
 /></div><div>I'm hoping it will be a good project for me to work on and bu=
ild at least a tiny understanding of bitcoin development.</div><div><br /><=
/div><div>-----------------------------------------------------------------=
-------<br /></div><div><br /></div><div>I use the createrawtransaction fun=
ction to create transactions, and before broadcasting, I always like to use=
 decoderawtransaction to see if I made any mistakes.</div><div><br /></div>=
<div>I've sometimes messed up on the fee calculation, as I do that myself w=
ith a calculator.</div><div><br /></div><div>Unfortunately decoderawtransac=
tion doesn't give me the fee information (for a very good reason, it is not=
 aware of the value of the inputs in the tx).</div><div><br /></div><div>So=
 to double check the fees, instead of using createrawtransaction, I'll use =
createpsbt and then go through the process of finalizing it so I can run de=
codepsbt, which does give the fee along with all the other relevant data.<b=
r /></div><div><br /></div><div>But the createpsbt process is more work for=
 a simple transaction where all UTXOs are in the wallet I am creating the r=
awtx in.</div><div><br /></div><div>My goal would be to modify <span>decode=
rawtransaction</span> to perform these additional steps:<ol><li>Fetch UTXO =
details for each input.</li><li>Calculate the total input value.</li><li>Su=
btract the total output value to determine the fee.</li></ol><div>Additiona=
lly there are the considerations about whether the inputs in the transactio=
n are in your wallet or not. <br /></div><div><br /></div><div>If I run lis=
tunspent it gives me the info I need to create the raw tx or psbt, and it h=
as the values of the UTXOs that will be used as inputs in my tx.<br /><br /=
>But I understand decoderawtransaction is meant to be used whether or not t=
he keys are in your wallet (so I was thinking to make a command argument T/=
F to show the fee value only if keys are in your wallet).<br /><br />Altern=
atively if you are running the command in a node with txindex, then you hav=
e the full chainstate to look up txids (whether unspent or not) - so this n=
eeds to be addressed too.</div><div><br /></div><div>Doing this within my o=
wn node would be cool enough and I don't necessarily need it to go farther =
than that. However if I do get it working, I'd certainly try to submit a PR=
.<br /></div><div><br />I have no idea if any of this is possible, so I wan=
ted to ask here for some guidance and maybe mentorship in this self-interes=
t driven project. Also looking for this to be shot down mercilessly if it's=
 just ridiculous.</div><div><br /></div><div>My abilities and skills are ve=
ry low. My interest and persistence are high.</div><div><br /></div><div>An=
y help or ridicule invited ;)<br /></div>

</div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;Bitcoin Development Mailing List&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:bitcoindev+unsubscribe@googlegroups.com">bitcoind=
ev+unsubscribe@googlegroups.com</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/d/msgid/bitcoindev/75628135-32ae-4df3-be52-9f7d054bc096n%40googlegroups.=
com?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.com/d/msg=
id/bitcoindev/75628135-32ae-4df3-be52-9f7d054bc096n%40googlegroups.com</a>.=
<br />

------=_Part_1713_833547110.1714834807661--

------=_Part_1712_337132614.1714834807661--