user83874: I am using bitcoin core library in node js.
const privateKey = new bitcore.PrivateKey('testnet');
const address = privateKey.toAddress('testnet);

When i console.log it, it get result as below. How can i extract the address part only? I try to use address.Address but it returns undefined
<Address: mmNeqV9HWKUDRUAVdknRKDPHyKYGpBEDzm, type: pubkeyhash, network: testnet>


user63569: it's better to get public key first then convert it to address
var publicKey = privateKey.toPublicKey();
var address = publicKey.toAddress(Networks.livenet);

address is an object, you can use it as a string. if you want to see it in console try
console.log("Address: ", address);


user83965: You should have the public key first to get bitcoin address.
var publicKey = privateKey.toPublicKey();
var address = publicKey.toAddress(Networks.livenet);

Check out the link to know "How bitcoin address is generated from the public key".
Better to try yourself in this Playground. 

83874: <p>I am using bitcoin core library in node js.</p>

<pre><code>const privateKey = new bitcore.PrivateKey('testnet');
const address = privateKey.toAddress('testnet);
</code></pre>

<p>When i <code>console.log</code> it, it get result as below. How can i extract the address part only? I try to use <code>address.Address</code> but it returns undefined</p>

<pre><code>&lt;Address: mmNeqV9HWKUDRUAVdknRKDPHyKYGpBEDzm, type: pubkeyhash, network: testnet&gt;
</code></pre>
 63569: <p>it's better to get public key first then convert it to address</p>

<pre><code>var publicKey = privateKey.toPublicKey();
var address = publicKey.toAddress(Networks.livenet);
</code></pre>

<p><code>address</code> is an object, you can use it as a string. if you want to see it in console try</p>

<pre><code>console.log("Address: ", address);
</code></pre>
 83965: <p>You should have the public key first to get bitcoin address.</p>

<pre><code>var publicKey = privateKey.toPublicKey();
var address = publicKey.toAddress(Networks.livenet);
</code></pre>

<p>Check out the <a href="https://en.bitcoin.it/wiki/Technical_background_of_version_1_Bitcoin_addresses#How_to_create_Bitcoin_Address" rel="nofollow noreferrer">link</a> to know "How bitcoin address is generated from the public key".</p>

<p>Better to try yourself in this <a href="http://gobittest.appspot.com/Address" rel="nofollow noreferrer">Playground</a>. </p>
