How would one go by accepting btc investments for an erc20 ICO? I assume a script of some sort would be necessary, has anyone dealt with this feature previously?


There are multiple ways of doing this.

Trust method

People will send BTC to your account and they will need to trust to that you will take each sender and give them their ERC20 tokens. This is easily done by seeding the smart contract with the owners of the tokens and the respective number.

You need to get all the transactions that enter your Bitcoin wallet and save the respective amounts. Next you need to write some code that will generate a bit of solidity code. The code you need to generate could look like this

balanceOf["0x3E65303043928403F8A1a2CA4954386E6f39008c"] = 1000
balanceOf["0x4C109f7B95295b6c7aCf6C2617A2f4441Fb1A773"] = 5000

And so on. Code that can be added in the constructor function of your token smart contract. Each Ethereum address should correspond to the people who send the Bitcoin (the ones scraped before) and the value is the corresponding number of tokens for their participation. For example if account 0x4C109f7B95295b6c7aCf6C2617A2f4441Fb1A773 sent 0.5 Bitcoin and 1 Bitcoin buys you 10000 ERC20 of your tokens, he needs to be seeded with

balanceOf["0x4C109f7B95295b6c7aCf6C2617A2f4441Fb1A773"] = 5000

Trustless method

You can use http://btcrelay.org/ to verify a transaction happened on the Bitcoin network

| improve this answer | |
  • 3
    I should point that BTCRelay is way behind the current Bitcoin blockchain, last block submitted is 501329, and it is currently on block 514290. Also you have to pay a small fee to confirm a transaction using BTCRelay. – Ismael Mar 19 '18 at 21:18
  • Do you have any insight as why people are not participating in this anymore? – Daniel Luca CleanUnicorn Mar 19 '18 at 21:49
  • The main reason are high costs, the value of ether reaching USD 1000 and CryptoKitties high network fees killed it. Right now at USD 540 storing a single block cost about USD 1, you need USD 144 per day, and USD 4320 per month. The usage always was very low, so the fees do not compensate the costs. – Ismael Mar 19 '18 at 22:10
  • Would any of you be able to show how this seeding can be automated by a script in Js or Go? e.g. if I go by the first method (trust method) and load all btc contributor address/value to a csv file and then run a script to automatically distribute tokens every time new csv data is added. I appreciate the interest and replies a lot guys! – NowsyMe Mar 19 '18 at 23:37
  • 1
    I've added more information in the answer. However I need to warn you that writing smart contracts does not allow for too many mistakes. You need to be a very good, experienced programmer to write a smart contract (considering it handles value directly, cannot be upgraded, anybody can and will try to exploit it) – Daniel Luca CleanUnicorn Mar 20 '18 at 10:28

Not the answer you're looking for? Browse other questions tagged or ask your own question.