Code Monkey home page Code Monkey logo

0xb10c / ofac-sanctioned-digital-currency-addresses Goto Github PK

View Code? Open in Web Editor NEW
89.0 14.0 22.0 108 KB

Tool to extract the 'sanctioned' digital currency (Bitcoin and others) addresses from the Specially Designated Nationals list by the US Office of Foreign Asset Control.

Home Page: https://github.com/0xB10C/ofac-sanctioned-digital-currency-addresses/tree/lists

License: MIT License

Python 100.00%
ofac sanction-lists cryptocurrency bitcoin

ofac-sanctioned-digital-currency-addresses's Introduction

OFAC Sanctioned Digital Currency Addresses

Tool to extract the 'sanctioned' Bitcoin (and other Digital Currency assets) addresses from the Specially Designated Nationals (SDN) list of the US Office of Foreign Asset Control. An XML version of this list can be downloaded here: sdn_advanced.xml.

As of December 2023 the tool covers the following assets. There might be assets on the SDN list that aren't covered yet. These can be found by grepping for "Digital Currency Address" on the sdn_advanced.xml file. Feel free to submit an issue or pull-request adding assets.

  • XBT (Bitcoin)
  • ETH (Ethereum)
  • XMR (Monero)
  • LTC (Litecoin)
  • ZEC (ZCash)
  • DASH (Dash)
  • BTG (Bitcoin Gold)
  • ETC (Ethereum Classic)
  • BSV (Bitcoin Satoshi Vision)
  • BCH (Bitcoin Cash)
  • XVG (Verge)
  • USDC (USD Coin)
  • USDT (USD Tether)
  • XRP (Ripple)
  • TRX (Tron)
  • ARB (Arbitrum)
  • BSC (Binance Smart Chain)

The sanctioned addresses can be extracted with this tool from the sdn_advanced.xml file. The tools supports the following output formats:

  • TXT file format (one address per line)
  • JSON file containing a list of addresses

Automatically Updated Lists

The lists branch of this repository contains automatically updated lists of sanctioned addresses for each covered asset. These are generated each night at 0 UTC by a GitHub Actions workflow.

Usage Examples

The SDN list as XML file (~80 MB in May 2023) can be downloaded, for example, via wget:

$ wget https://www.treasury.gov/ofac/downloads/sanctions/1.0/sdn_advanced.xml

By default, the python script expects the sdn_advanced.xml XML file to be located in the current working directory. This can be changed with the -sdn /path/to/sdn_advanced.xml argument.


By default, the XBT (Bitcoin) addresses are extracted into a TXT file:

$ python3 generate-address-list.py
$ cat sanctioned_addresses_XBT.txt | head -n2
12QtD5BFwRsdNsAZY76UVE1xyCGNTojH9h
1Kuf2Rd8mDyAViwBozGTNYnvWL8uYFrkVo

Other assets an be selected by supplying the tickers:

$ python3 generate-address-list.py ETH ETC DASH LTC
$ ls sanctioned_addresses_* -1
sanctioned_addresses_DASH.txt
sanctioned_addresses_ETC.txt
sanctioned_addresses_ETH.txt
sanctioned_addresses_LTC.txt

By default, a TXT file listing an address per line is produced. For example, a JSON file listing the addresses can be produced with the -f JSON flag.

$ python3 generate-address-list.py XMR -f JSON
$ ls sanctioned_addresses_* -1
sanctioned_addresses_XMR.json

For detailed help and usage instructions please see python3 generate-address-list.py --help

License and Warranty

This software is provided under the MIT License. For details see LICENSE.

The author does not provide warranty of any kind. Especially not on the completeness and correctness of the produced lists.

ofac-sanctioned-digital-currency-addresses's People

Contributors

0xb10c avatar michaelneale avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ofac-sanctioned-digital-currency-addresses's Issues

LookupError: No FeatureType with the name Digital Currency Address - XBT found

The nightly CI run of the tool fails with the following error:

  mkdir data
  python3 generate-address-list.py XBT ETH XMR LTC ZEC DASH BTG ETC BSV BCH XVG USDC USDT XRP TRX ARB BSC -f JSON TXT -path ./data
  shell: /usr/bin/bash -e {0}
  env:
    pythonLocation: /opt/hostedtoolcache/Python/3.11.9/x64
    PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.11.9/x64/lib/pkgconfig
    Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.11.9/x64
    Python[2](https://github.com/0xB10C/ofac-sanctioned-digital-currency-addresses/actions/runs/8954302705/job/24593793734#step:6:2)_ROOT_DIR: /opt/hostedtoolcache/Python/[3](https://github.com/0xB10C/ofac-sanctioned-digital-currency-addresses/actions/runs/8954302705/job/24593793734#step:6:3).11.9/x64
    Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.11.9/x64
    LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.11.9/x6[4](https://github.com/0xB10C/ofac-sanctioned-digital-currency-addresses/actions/runs/8954302705/job/24593793734#step:6:4)/lib
Traceback (most recent call last):
  File "/home/runner/work/ofac-sanctioned-digital-currency-addresses/ofac-sanctioned-digital-currency-addresses/generate-address-list.py", line 109, in <module>
    main()
  File "/home/runner/work/ofac-sanctioned-digital-currency-addresses/ofac-sanctioned-digital-currency-addresses/generate-address-list.py", line 97, in main
    address_id = get_address_id(root, asset)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/work/ofac-sanctioned-digital-currency-addresses/ofac-sanctioned-digital-currency-addresses/generate-address-list.py", line 4[5](https://github.com/0xB10C/ofac-sanctioned-digital-currency-addresses/actions/runs/8954302705/job/24593793734#step:6:5), in get_address_id
    raise LookupError("No FeatureType with the name {} found".format(
LookupError: No FeatureType with the name Digital Currency Address - XBT found
Error: Process completed with exit code 1.

Q: how do we know when a new cryptocurrency is added to the SDN?

My guess from reading https://github.com/0xB10C/ofac-sanctioned-digital-currency-addresses/blob/main/generate-address-list.py#L12 is that someone periodically fetches the XML file, does a grep and then compares that to the list at https://github.com/0xB10C/ofac-sanctioned-digital-currency-addresses/blob/main/generate-address-list.py#L13-L15

I am wondering if a better implementation strategy might be to have the script do two passes: first, to look for <FeatureType/> starting with "Digital Currency Address - ", to build up the list on lines 13-15, and, second, to proceed as usual. of course, i'd still keep what's on lines 13-15, just as a safety.

Your thoughts?

Invalid BTC address in addresses sanctioned by OFAC

The following address was added in https://ofac.treasury.gov/recent-actions/20231003. It's not a valid Bitcoin address.

How should the tool handle this address?

  • One option is to hardcode it in the tool to not add it to the generated lists
  • Another is to just leave it in and let downstream users take care of it (i.e. like 0xB10C/miningpool-observer#73)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.