---
# System prepended metadata

title: Untitled

---

```
pragma solidity ^0.6.0;

import "https://raw.githubusercontent.com/smartcontractkit/chainlink/develop/evm-contracts/src/v0.6/ChainlinkClient.sol";

contract GetAddressBalance is ChainlinkClient {
  
    uint256 public address_balance;
    
    address private oracle;
    bytes32 private jobId;
    uint256 private fee;
    

    constructor() public {
        setPublicChainlinkToken();
        oracle = 0x2f90A6D021db21e1B2A077c5a37B3C7E75D15b7e;
        jobId = "29fa9aa13bf1468788b7cc4a500a45b8";
        fee = 0.1 * 10 ** 18; // 0.1 LINK
    }
    
    function requestBTCAddressBalance(string memory _btcAddress) public returns (bytes32 requestId) 
    {
        Chainlink.Request memory request = buildChainlinkRequest(jobId, address(this), this.fulfill.selector);
        
        // Set the URL to perform the GET request on
        request.add("get", this.getReqURL(_btcAddress));
        
        return sendChainlinkRequestTo(oracle, request, fee);
    }
    
    function requestURLBalance(string memory url) public returns (bytes32 requestId) 
    {
        Chainlink.Request memory request = buildChainlinkRequest(jobId, address(this), this.fulfill.selector);
        
        return sendChainlinkRequestTo(oracle, request, fee);
    }
    
     function requestEthereumPrice() public returns (bytes32 requestId) 
    {
        Chainlink.Request memory request = buildChainlinkRequest(jobId, address(this), this.fulfill.selector);
        
        // Set the URL to perform the GET request on
        request.add("get", "https://min-api.cryptocompare.com/data/price?fsym=ETH&tsyms=USD");
        
        // Set the path to find the desired data in the API response, where the response format is:
        // {"USD":243.33}
        request.add("path", "USD");
        
        // Multiply the result by 100 to remove decimals
        request.addInt("times", 100);
        
        // Sends the request
        return sendChainlinkRequestTo(oracle, request, fee);
    }
    
    /**
     * Receive the response in the form of uint256
     */ 
    function fulfill(bytes32 _requestId, uint256 total_received) public recordChainlinkFulfillment(_requestId)
    {
        address_balance = total_received;
    }
    
    function getReqURL(string memory _btcAddress) public pure returns(string memory)
    {
        return string(abi.encodePacked("https://api.blockcypher.com/v1/btc/main/addrs/", _btcAddress, "/balance"));
    }
    
    function destroy() public{
        selfdestruct(msg.sender);
    }
}
```