Received: from sog-mx-3.v43.ch3.sourceforge.com ([172.29.43.193]
	helo=mx.sourceforge.net)
	by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.76)
	(envelope-from <rick.wesson@iidf.org>) id 1QlWOH-0005K4-ST
	for bitcoin-development@lists.sourceforge.net;
	Tue, 26 Jul 2011 01:24:57 +0000
X-ACL-Warn: 
Received: from mail-gx0-f175.google.com ([209.85.161.175])
	by sog-mx-3.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-MD5:128)
	(Exim 4.76) id 1QlWOG-0003u6-Hy
	for bitcoin-development@lists.sourceforge.net;
	Tue, 26 Jul 2011 01:24:57 +0000
Received: by gxk3 with SMTP id 3so3259582gxk.34
	for <bitcoin-development@lists.sourceforge.net>;
	Mon, 25 Jul 2011 18:24:49 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.151.61.4 with SMTP id o4mr4836810ybk.354.1311640161049; Mon,
	25 Jul 2011 17:29:21 -0700 (PDT)
Received: by 10.151.114.15 with HTTP; Mon, 25 Jul 2011 17:29:21 -0700 (PDT)
Date: Mon, 25 Jul 2011 17:29:21 -0700
Message-ID: <CAJ1JLts5_r6hHoJR-gS-CuuvS00p=RQ6iYbCyOkBDcvgs1xtew@mail.gmail.com>
From: Rick Wesson <rick@support-intelligence.com>
To: bitcoin-development@lists.sourceforge.net
Content-Type: multipart/alternative; boundary=00032555382edf5c3704a8ee05b9
X-Spam-Score: 1.0 (+)
X-Spam-Report: Spam Filtering performed by mx.sourceforge.net.
	See http://spamassassin.org/tag/ for more details.
	1.0 HTML_MESSAGE           BODY: HTML included in message
X-Headers-End: 1QlWOG-0003u6-Hy
Subject: [Bitcoin-development] bitcoin DNS addresses
X-BeenThere: bitcoin-development@lists.sourceforge.net
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: <bitcoin-development.lists.sourceforge.net>
List-Unsubscribe: <https://lists.sourceforge.net/lists/listinfo/bitcoin-development>,
	<mailto:bitcoin-development-request@lists.sourceforge.net?subject=unsubscribe>
List-Archive: <http://sourceforge.net/mailarchive/forum.php?forum_name=bitcoin-development>
List-Post: <mailto:bitcoin-development@lists.sourceforge.net>
List-Help: <mailto:bitcoin-development-request@lists.sourceforge.net?subject=help>
List-Subscribe: <https://lists.sourceforge.net/lists/listinfo/bitcoin-development>,
	<mailto:bitcoin-development-request@lists.sourceforge.net?subject=subscribe>
X-List-Received-Date: Tue, 26 Jul 2011 01:24:58 -0000

--00032555382edf5c3704a8ee05b9
Content-Type: text/plain; charset=ISO-8859-1

I've just joined the list with the goals of producing a patch to
sendtoaddress in rpc.cpp to support DNS lookups so that one could publish a
TXT record in the DNS with their wallet address to facilitate sending of
coin.

I'm proposing something like the code below, which works but needs
additional error handling.

also working on a internet-draft to describe how to put bitcoin addresses in
the DNS which I hope to post the first draft of this week.

I'd appreciate comments on issues around annomity, community push back and
any other issues you might have with leveraging the DNS for bitcoin
transactions.

thanks,

-rick


Value sendtoaddress(const Array& params, bool fHelp)
{
   if (fHelp || params.size() < 2 || params.size() > 4)
       throw runtime_error(
           "sendtoaddress <bitcoinaddress> <amount> [comment]
[comment-to]\n"
           "<amount> is a real and is rounded to the nearest 0.00000001");

/**
; <<>> DiG 9.7.3 <<>> _btc.rick.wesson.us txt
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 43754
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;_btc.rick.wesson.us.           IN      TXT

;; ANSWER SECTION:
_btc.rick.wesson.us.    300     IN      TXT     "BTC=1;
1GCVXLfF1TcpnnDLJRHk845NZhuJWQTnUD"

;; Query time: 143 msec
**/


   string strAddress = params[0].get_str();
   string dname="_btc.";
   if(strAddress.find("@")){
      unsigned char answer[255];
      int len=0;
      dname.append(strAddress);
      dname.replace(dname.find("@"), 1, ".");

      if((len = res_query(dname.c_str(), C_IN, T_TXT, answer, PACKETSZ)) <
0) {
        string dnsAnswer=(char*)answer;
        int i=dnsAnswer.find("BTC=1;");
        if( i < 0) throw runtime_error( dname + " is not associated with a
bitcoin address");
        i += 6;
        i = dnsAnswer.find("1", 6) ; // address start with a one (1)
        dnsAnswer.erase(0,i);
        strAddress=dnsAnswer;
      }

   }
   // Amount
   int64 nAmount = AmountFromValue(params[1]);
...

--00032555382edf5c3704a8ee05b9
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

I&#39;ve just joined the list with the goals of producing a patch to sendto=
address in rpc.cpp to support DNS lookups so that one could publish a TXT r=
ecord in the DNS with their wallet address to facilitate sending of coin.<b=
r>
<br>I&#39;m proposing something like the code below, which works but needs =
additional error handling.<br><br>also working on a internet-draft to descr=
ibe how to put bitcoin addresses in the DNS which I hope to post the first =
draft of this week.<br>
<br>I&#39;d appreciate comments on issues around annomity, community push b=
ack and any other issues you might have with leveraging the DNS for bitcoin=
 transactions.<br><br>thanks,<br><br>-rick<br><br><br>Value sendtoaddress(c=
onst Array&amp; params, bool fHelp)<br>
{<br> =A0 =A0if (fHelp || params.size() &lt; 2 || params.size() &gt; 4)<br>=
 =A0 =A0 =A0 =A0throw runtime_error(<br> =A0 =A0 =A0 =A0 =A0 =A0&quot;sendt=
oaddress &lt;bitcoinaddress&gt; &lt;amount&gt; [comment] [comment-to]\n&quo=
t;<br> =A0 =A0 =A0 =A0 =A0 =A0&quot;&lt;amount&gt; is a real and is rounded=
 to the nearest 0.00000001&quot;);<br>
<br>/**<br>; &lt;&lt;&gt;&gt; DiG 9.7.3 &lt;&lt;&gt;&gt; _<a href=3D"http:/=
/btc.rick.wesson.us">btc.rick.wesson.us</a> txt<br>;; global options: +cmd<=
br>;; Got answer:<br>;; -&gt;&gt;HEADER&lt;&lt;- opcode: QUERY, status: NOE=
RROR, id: 43754<br>
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0<br><br=
>;; QUESTION SECTION:<br>;_<a href=3D"http://btc.rick.wesson.us">btc.rick.w=
esson.us</a>. =A0 =A0 =A0 =A0 =A0 IN =A0 =A0 =A0TXT<br><br>;; ANSWER SECTIO=
N:<br>_<a href=3D"http://btc.rick.wesson.us">btc.rick.wesson.us</a>. =A0 =
=A0300 =A0 =A0 IN =A0 =A0 =A0TXT =A0 =A0 &quot;BTC=3D1; 1GCVXLfF1TcpnnDLJRH=
k845NZhuJWQTnUD&quot;<br>
 =A0 =A0<br>;; Query time: 143 msec<br>**/<br><br><br> =A0 =A0string strAdd=
ress =3D params[0].get_str();<br> =A0 =A0string dname=3D&quot;_btc.&quot;;<=
br> =A0 =A0if(strAddress.find(&quot;@&quot;)){<br> =A0 =A0 =A0 unsigned cha=
r answer[255];<br> =A0 =A0 =A0 int len=3D0;<br>
 =A0 =A0 =A0 dname.append(strAddress);<br> =A0 =A0 =A0 dname.replace(dname.=
find(&quot;@&quot;), 1, &quot;.&quot;);<br><br> =A0 =A0 =A0 if((len =3D res=
_query(dname.c_str(), C_IN, T_TXT, answer, PACKETSZ)) &lt; 0) {<br> =A0 =A0=
 =A0 =A0 string dnsAnswer=3D(char*)answer;<br>
 =A0 =A0 =A0 =A0 int i=3DdnsAnswer.find(&quot;BTC=3D1;&quot;);<br> =A0 =A0 =
=A0 =A0 if( i &lt; 0) throw runtime_error( dname + &quot; is not associated=
 with a bitcoin address&quot;);<br> =A0 =A0 =A0 =A0 i +=3D 6;<br> =A0 =A0 =
=A0 =A0 i =3D dnsAnswer.find(&quot;1&quot;, 6) ; // address start with a on=
e (1)<br>
 =A0 =A0 =A0 =A0 dnsAnswer.erase(0,i);<br> =A0 =A0 =A0 =A0 strAddress=3Ddns=
Answer;<br> =A0 =A0 =A0 }<br><br> =A0 =A0}<br> =A0 =A0// Amount<br> =A0 =A0=
int64 nAmount =3D AmountFromValue(params[1]);<br>...

--00032555382edf5c3704a8ee05b9--