I will create my personal token and I would like to be able to sell it for ETH and BTC. I know how to add the sell function for ETH, but how can I sell the tokens for BTC?
The ETH sell function I will use is the following:
function sell(uint256 amount) {
if (balanceOf[msg.sender] < amount ) throw;
balanceOf[this] += amount;
balanceOf[msg.sender] -= amount;
msg.sender.send(amount * sellPrice);
Transfer(msg.sender, this, amount);
}
Best Answer
This is not as easy as with ETH, since a contract cannot own a BTC address. However you can use services like http://btcrelay.org/ which allow you to watch a btc address.