user1053: If someone provides me with a payment address, how can I derive the staking address from the payment address?
This can be useful for example when we want to sent rewards to the people in return for staking to a pool.

user899: As Samuel said, the address in question must contain the staking part in the first place.
cardano-address uses IOG's implementation of bech32. Instead of using cardano-address you could also install bech32 instead and decode/encode the address.
bech32 <<< addr_test1qqcleq68hy4szxgwd6q8erqsw05plx0pvv0hg7vmwsg74qcyrh94aeq8qpldgyjeyvvzhwypamcpdrwm0gd830yh2x5s7t4m0s

0031fc8347b92b01190e6e807c8c1073e81f99e1631f74799b7411ea83041dcb5ee407007ed4125923182bb881eef0168ddb7a1a78bc9751a9

Now extract the last 56 bytes from the result as it is the staking address
echo -n "0031fc8347b92b01190e6e807c8c1073e81f99e1631f74799b7411ea83041dcb5ee407007ed4125923182bb881eef0168ddb7a1a78bc9751a9" | tail -c 56

Then you prefix that with the correct network tag (e0 for testnet and e1 for mainnet) and encode with bech32 to receive the staking address
bech32 stake_test <<< e0041dcb5ee407007ed4125923182bb881eef0168ddb7a1a78bc9751a9

stake_test1uqzpmj67usrsqlk5zfvjxxpthzq7auqk3hdh5xnchjt4r2gdn6t4d

On a side note, be aware of the existence of franken addresses. A constructed address which has the payment part of one wallet and the staking part of another. This way I could pretend I am the owner of the stake delegated to the pool.

user382: This only works if it's an address embedding the payment and stake credential. You can use cardano-address address inspect locally. You could also use a tool like cardanoscan.io which when given an address to scan tells you the stake address associated as well.
Note that some addresses don't have stake addresses and other ones can have only pointers to stake registrations.

1053: <p>If someone provides me with a payment address, how can I derive the staking address from the payment address?</p>
<p>This can be useful for example when we want to sent rewards to the people in return for staking to a pool.</p>
 899: <p>As Samuel said, the address in question must contain the staking part in the first place.</p>
<p>cardano-address uses <a href="https://github.com/input-output-hk/bech32" rel="nofollow noreferrer">IOG's implementation of bech32</a>. Instead of using cardano-address you could also install bech32 instead and decode/encode the address.</p>
<pre><code>bech32 &lt;&lt;&lt; addr_test1qqcleq68hy4szxgwd6q8erqsw05plx0pvv0hg7vmwsg74qcyrh94aeq8qpldgyjeyvvzhwypamcpdrwm0gd830yh2x5s7t4m0s

0031fc8347b92b01190e6e807c8c1073e81f99e1631f74799b7411ea83041dcb5ee407007ed4125923182bb881eef0168ddb7a1a78bc9751a9
</code></pre>
<p>Now extract the last 56 bytes from the result as it is the staking address</p>
<pre><code>echo -n &quot;0031fc8347b92b01190e6e807c8c1073e81f99e1631f74799b7411ea83041dcb5ee407007ed4125923182bb881eef0168ddb7a1a78bc9751a9&quot; | tail -c 56
</code></pre>
<p>Then you prefix that with the correct network tag (e0 for testnet and e1 for mainnet) and encode with bech32 to receive the staking address</p>
<pre><code>bech32 stake_test &lt;&lt;&lt; e0041dcb5ee407007ed4125923182bb881eef0168ddb7a1a78bc9751a9

stake_test1uqzpmj67usrsqlk5zfvjxxpthzq7auqk3hdh5xnchjt4r2gdn6t4d
</code></pre>
<p>On a side note, be aware of the existence of franken addresses. A constructed address which has the payment part of one wallet and the staking part of another. This way I could pretend I am the owner of the stake delegated to the pool.</p>
 382: <p>This only works if it's an address embedding the payment and stake credential. You can use <code>cardano-address address inspect</code> locally. You could also use a tool like cardanoscan.io which when given an address to scan tells you the stake address associated as well.</p>
<p>Note that some addresses don't have stake addresses and other ones can have only pointers to stake registrations.</p>
