Jammie  Yost

Jammie Yost

1666188900

Bitcoin integration Developer Preview with Rust

Bitcoin Integration Developer Preview

Overview

The integration between the Internet Computer and Bitcoin will enable developers to build canisters that:

Securely own Bitcoin.

Canisters will be able to have the Internet Computer securely create ECDSA keys for them via a threshold ECDSA protocol so that they can own Bitcoin.

Interact with the Bitcoin network.

Canisters will be able to send transactions, get transaction outputs, as well as get the balance of any Bitcoin address. The aforementioned threshold ECDSA protocol is used to securely sign transactions.

Differences to Main Release

The developer preview enables developers to work with the Bitcoin integration features before the proper launch.

In the developer preview, all components run locally, i.e., no Bitcoin functionality is deployed on mainnet. The Bitcoin canister is configured to interact with a local Bitcoin network in regtest mode.

By contrast, the Bitcoin functionality will be exposed through the management canister on mainnet.

The Bitcoin API on mainnet will be quite similar to the API in the developer preview. However, the function signatures will be slightly different. Moreover, the Bitcoin functionality will be extended, for example, by offering an API for fee management.

Components

The developer preview consists of the following components:

The Bitcoin Canister

The Bitcoin canister provides the API that developers can use to interact with the Bitcoin networks.

See the ./canister directory for more details.

An Example Project

The project showcases how developers can achieve the following:

Get the balance of a Bitcoin address.

Get transaction outputs and use them to build a transaction.

Sign a transaction and send it to the Bitcoin network.

See the ./example directory for more details.

NoteThe developer preview focuses strictly on the interaction with the Bitcoin network. Securely generating ECDSA keys is beyond the scope of the developer preview.

Getting Started

With the developer preview you’ll be able to setup a local Bitcoin network and interact with that network using canisters.

There are two ways to set up:

Manual Setup

Docker Setup

Manual Setup

Prerequisites

Rust

dfx >= 0.8.4

Bitcoin Core. Mac users are recommended to download the .tar.gz version.

Mac users need to install homebrew and then use it to install additional packages by running brew install llvm binaryen cmake

NoteThese instructions assume you’re running Linux or MacOS. We do not officially support Windows.

The first step would be to setup a local Bitcoin network.

Setting up a local Bitcoin network

Unpack the .tar.gz file.

Create a directory named data inside the unpacked folder.

Create a file called bitcoin.conf at the root of the unpacked folder and add the following contents:

# Enable regtest mode. This is required to setup a private bitcoin network.
regtest=1

# Dummy credentials that are required by `bitcoin-cli`.
rpcuser=btc-dev-preview
rpcpassword=Wjh4u6SAjT4UMJKxPmoZ0AN2r9qbE-ksXQ5I2_-Hm4w=
rpcauth=btc-dev-preview:8555f1162d473af8e1f744aa056fd728$afaf9cb17b8cf0e8e65994d1195e4b3a4348963b08897b4084d210e5ee588bcb

Run bitcoind to start the bitcoin client using the following command:

./bin/bitcoind -conf=$(pwd)/bitcoin.conf -datadir=$(pwd)/data

Create a wallet: ./bin/bitcoin-cli -conf=$(pwd)/bitcoin.conf createwallet mywallet

If everything is setup correctly, you should see the following output:

{
  "name": "mywallet",
  "warning": ""
}

Generate a bitcoin address and save it in variable for later reuse:

export BTC_ADDRESS=$(./bin/bitcoin-cli -conf=$(pwd)/bitcoin.conf getnewaddress)

This will generate a bitcoin address for your wallet to receive funds.

Mine blocks to receive some Bitcoin as a reward.

./bin/bitcoin-cli -conf=$(pwd)/bitcoin.conf generatetoaddress 101 $BTC_ADDRESS

You should see an output that looks similar to, but not exactly like, the following:

[
  "1625281b2595b77276903868a0fe2fc31cb0c624e9bdc269e74a3f319ceb48de",
  "1cc5ba7e86fc313333c5448af6c7af44ff249eca3c8b681edc3c275efd3a2d38",
  "1d3c85b674497ba08a48d1b955bee5b4dc4505ffe4e9f49b428153e02e3e0764",
  ...
  "0dfd066985dc001ccc1fe6d7bfa53b7ad4944285dc173615792653bbd52151f1",
  "65975f1cd5809164f73b0702cf326204d8fee8b9669bc6bd510cb221cf09db5c",
]

Running the IC-Bitcoin Adapter

Now that bitcoin is setup locally, it is time to run the IC-Bitcoin adapter.

The IC-Bitcoin adapter is a process that fetches headers and blocks from the Bitcoin network and passes them into the Internet Computer. The ic-bitcoin adapter will be integrated into the replica with the main release. For the developer preview, it needs to be launched separately.

Run the following commands to download, build, and run the adapter.

# clone the ic repository and checkout a specific commit.
git clone https://github.com/dfinity/ic.git
cd ic
git checkout 99116f8e872b8765aa609f91eb8c9394914c483d

# Move into the rs directory and run the adapter.
cd rs
cargo run --bin ic-btc-adapter -- ./bitcoin/adapter/tests/sample/regtest.config.json

Deploying the Bitcoin Canister

With bitcoind and the adapter running, we can now run a local replica with the Bitcoin canister.

Clone this repository.

From the root directory of the repository, start the local replica.

dfx start --clean --background

Deploy the Bitcoin canister to the local replica in regtest mode.

dfx deploy btc --no-wallet

Running the Adapter Shim

The shim is the final piece that needs to be started up.

From this repository, run the following command:

cargo run --features="tokio candid ic-agent garcon tonic tonic-build" --bin adapter-shim $(dfx canister --no-wallet id btc)

The shim will start syncing blocks from your local bitcoin setup into the bitcoin canister. Once that’s complete, you’ll be able to query the bitcoin canister about the bitcoin state. See Using the Bitcoin Canister for more details and checkout the example project.

Docker Setup

Prerequisites

Instead of downloading bitcoin and cloning the ic repository, this repository offers an alternate solution using Docker and docker-compose.

Rust

dfx >= 0.8.4

Mac users need to install homebrew and then use it to install additional packages by running brew install llvm binaryen cmake

Docker

Mac: Docker for Mac

Linux: Docker Engine and Docker Compose.

Setting up a local Bitcoin network and the IC-Bitcoin Adapter

docker-compose up -d will start bitcoind in the background and begin building a fresh image for the IC-Bitcoin adapter.

Verify that bitcoind is running: docker-compose exec bitcoind bitcoin-cli -conf=/conf/bitcoin.conf getmininginfo

If everything is setup correctly, you should see the following output:

{
  "blocks": 0,
  "difficulty": 4.656542373906925e-10,
  "networkhashps": 0,
  "pooledtx": 0,
  "chain": "regtest",
  "warnings": ""
}

Create a wallet: docker-compose exec bitcoind bitcoin-cli -conf=/conf/bitcoin.conf createwallet mywallet

If everything is setup correctly, you should see the following output:

{
  "name": "mywallet",
  "warning": ""
}

Generate a bitcoin address and save it in variable for later reuse:

export BTC_ADDRESS=$(docker-compose exec bitcoind bitcoin-cli -conf=/conf/bitcoin.conf getnewaddress | tr -d '\r')

This will generate a bitcoin address for your wallet to receive funds.

Mine blocks to receive some Bitcoin as a reward.

docker-compose exec bitcoind bitcoin-cli -conf=/conf/bitcoin.conf generatetoaddress 101 $BTC_ADDRESS

You should see an output that looks similar to, but not exactly like, the following:

[
  "1625281b2595b77276903868a0fe2fc31cb0c624e9bdc269e74a3f319ceb48de",
  "1cc5ba7e86fc313333c5448af6c7af44ff249eca3c8b681edc3c275efd3a2d38",
  "1d3c85b674497ba08a48d1b955bee5b4dc4505ffe4e9f49b428153e02e3e0764",
  ...
  "0dfd066985dc001ccc1fe6d7bfa53b7ad4944285dc173615792653bbd52151f1",
  "65975f1cd5809164f73b0702cf326204d8fee8b9669bc6bd510cb221cf09db5c",
]

Verify the adapter is running: docker-compose logs adapter

You should an output that looks similar to the following:

adapter_1   | Feb 02 01:01:56.512 INFO Connected to 172.29.0.2:18444
adapter_1   | Feb 02 01:01:57.022 INFO Received version from 172.29.0.2:18444
adapter_1   | Feb 02 01:01:57.022 INFO Completed the version handshake with 172.29.0.2:18444
adapter_1   | Feb 02 01:01:57.022 INFO Adding peer_info with addr : 172.29.0.2:18444
adapter_1   | Feb 02 01:01:57.223 INFO Received verack from 172.29.0.2:18444

Continue with the Getting Started directions from Deploying the Bitcoin Canister to complete setup.

Viewing bitcoind and IC-Bitcoin Adapter output

To view the logs of the bitcoind container: docker-compose logs -f bitcoind

To view the logs of the adapter container: docker-compose logs -f adapter

Using the Bitcoin Canister

There’s an example project in the ./example directory that showcases how to interact with the Bitcoin canister. Additionally, you can call the Bitcoin canister directly using dfx. Examples:

Fetching the balance/UTXOs of an address

dfx canister --no-wallet call btc get_balance "(record { address = \"$BTC_ADDRESS\"})"
dfx canister --no-wallet call btc get_utxos "(record { address = \"$BTC_ADDRESS\"})"

Fetching the balance/UTXOs of an address with a minimum of 6 confirmations

dfx canister --no-wallet call btc get_balance "(record { address = \"$BTC_ADDRESS\"; min_confirmations = opt 6})"
dfx canister --no-wallet call btc get_utxos "(record { address = \"$BTC_ADDRESS\"; min_confirmations = opt 6})"

Download Details:

Author: dfinity
Source Code: https://github.com/dfinity/bitcoin-developer-preview

License: Apache-2.0 license

#rust #bitcoin 

What is GEEK

Buddha Community

Bitcoin integration Developer Preview with Rust

How to develop competitive bitcoin software?

Science has always made us fascinated. We all have grown up listening to people using virtual money. But can it be used? Who uses virtual money? And the most important question is, who develops this virtual money for everyone? Then we were all introduced to the entire concept of Blockchain and Bitcoin. And all of the questions and wonders came back to life. But to use this virtual money. You need to be able to own a bitcoin wallet app. But how does one develop an app like this? Bitcoin wallet applications are a very easy way to receive any kind of currencies and send any currencies. This all is done in a secure and private manner. Is Bitcoin software development as easy as the other app development process is? The answer to this would be, no. Bitcoin development has a big impact on the entire world and its types are also very important for everyone. In this blog, we will be discussing what bitcoin app development is and how it can have an impact on your business. For more details click on the link.

#bitcoin wallet application development #bitcoin application development in usa #bitcoin app development #bitcoin software development #app development #software development

How To Create a Bitcoin Wallet App?

Cryptocurrency is taking over the world. Bitcoins are particular. They have become very common among people. But, even though bitcoins have become so common, there are still questions about where to keep them safe? The answer can be difficult because you can not keep virtual money in a bank. The answer to keeping bitcoins safe is keeping them in a personal Bitcoin Wallet Application. Bitcoin has no owner or no one who controls it. But anyone can become a member of it. This is why bitcoin app development is not as difficult as it sounds. This application will help you make different transactions any time you want, including burning cryptocurrency and selling it. Bitcoin wallet application development is a great marketing tool. This is because bitcoin has easy payment accepting modes that help in attracting more customers to your company. For more details click on the link.

#bitcoin wallet application development #bitcoin app development in uae #dedicated bitcoin app developer #app development, #bitcoin app development #bitcoin

How to Develop a Cryptocurrency Exchange Application for Your Business?

Nowadays, cryptocurrencies have become a hot topic everywhere. These have taken over the digital world entirely. Cryptocurrencies like Bitcoin, Ethereum, Zcash, etc., are the most popular ones in the market. Users are showing newly interested in the digital trading systems because of these crypto platforms. Hence, the traffic for crypto exchanges has grown. New companies and startups are going towards Bitcoin wallet application development. This is because developing this application will have many benefits in the year 2021 and the coming future. Cryptocurrency is also very famous because it is made out of one of the main blockchain trends of 2021. If you are a dedicated bitcoin app developer in the USA, UAE or Saudi Arabia, you can create a crypto exchange system with your coding. But a lot of the time, these systems fail and have loads of bugs in them. So, to solve this, you can contact the best cryptocurrency app development company and make things easier for your organization that will give you loads of benefits. To read more click on the link.

#bitcoin wallet application development #bitcoin app development in uae #dedicated bitcoin app developer #app developer #bitcoin app development #software developer

Fredy  Larson

Fredy Larson

1595059664

How long does it take to develop/build an app?

With more of us using smartphones, the popularity of mobile applications has exploded. In the digital era, the number of people looking for products and services online is growing rapidly. Smartphone owners look for mobile applications that give them quick access to companies’ products and services. As a result, mobile apps provide customers with a lot of benefits in just one device.

Likewise, companies use mobile apps to increase customer loyalty and improve their services. Mobile Developers are in high demand as companies use apps not only to create brand awareness but also to gather information. For that reason, mobile apps are used as tools to collect valuable data from customers to help companies improve their offer.

There are many types of mobile applications, each with its own advantages. For example, native apps perform better, while web apps don’t need to be customized for the platform or operating system (OS). Likewise, hybrid apps provide users with comfortable user experience. However, you may be wondering how long it takes to develop an app.

To give you an idea of how long the app development process takes, here’s a short guide.

App Idea & Research

app-idea-research

_Average time spent: two to five weeks _

This is the initial stage and a crucial step in setting the project in the right direction. In this stage, you brainstorm ideas and select the best one. Apart from that, you’ll need to do some research to see if your idea is viable. Remember that coming up with an idea is easy; the hard part is to make it a reality.

All your ideas may seem viable, but you still have to run some tests to keep it as real as possible. For that reason, when Web Developers are building a web app, they analyze the available ideas to see which one is the best match for the targeted audience.

Targeting the right audience is crucial when you are developing an app. It saves time when shaping the app in the right direction as you have a clear set of objectives. Likewise, analyzing how the app affects the market is essential. During the research process, App Developers must gather information about potential competitors and threats. This helps the app owners develop strategies to tackle difficulties that come up after the launch.

The research process can take several weeks, but it determines how successful your app can be. For that reason, you must take your time to know all the weaknesses and strengths of the competitors, possible app strategies, and targeted audience.

The outcomes of this stage are app prototypes and the minimum feasible product.

#android app #frontend #ios app #minimum viable product (mvp) #mobile app development #web development #android app development #app development #app development for ios and android #app development process #ios and android app development #ios app development #stages in app development

How Much Does It Cost to Develop A Blockchain-based App?

Funnily, cryptocurrencies can be called ghosts. This is because people who have seen them swear at them, and the ones who have not yet seen them, do what everyone tells them to. Cryptocurrencies were introduced by an inventor called Satoshi Nakamoto. He created the first cryptocurrency called Bitcoin. Bitcoin became big news very fast, and it led to many other cryptocurrency technologies being developed. Now, what exactly are cryptocurrency wallet applications? The main use of this digital wallet store, send, and receive digital money like Bitcoin, Zcash, DubaiCoin, etc. The number of cryptocurrency traders is growing, and with the help of remote cryptocurrency exchange software development, users can securely keep their money safe. Because of the rise in cryptocurrency wallets, the increase in blockchain wallet applications has also increased worldwide. This rise in the use of cryptocurrency wallets has also enabled businesses to add cryptocurrency wallets as a part of their revenue systems. One needs to consider many things when they decide to develop a block-based application for their organizations. Owners need to look into bitcoin wallet application development; they need to consider its cost and affect their business. To read more click on the link.

#bitcoin wallet application development #bitcoin app development in uae #remote cryptocurrency exchange software development #dedicated bitcoin app developer #software development #app development