ZeroNet Site for Counterparty Users



In post ZeroNet and Counterwallet addresses I went through some basics of how ZeroNet uses bitcoin addresses (which are also Counterparty addresses) and hinted at some possibilities related to integration with Counterparty features and tools.

This post is a Proof of Concept type of post that shows how one can use a bitcoin address from his Counterwallet as the site-owning address in ZeroNet. Some practical uses of this may be:

  • The ability to have a “backup” of your private key for ZeroNet site without having yet another backup of your pass phrase (or wallet seed, which is the same thing in another format)
  • The ability to publish and sign content directly from a Counterparty wallet with ZeroNet integration
  • The ability to broadcast your other bitcoin addresses (Counterwallet or other) using the site-owning address (which can be used for reputation or other purposes)

Also as indicated in the previous post on ZeroNet, another place where bitcoin addresses are used are per-site addresses: for every 3rd party ZeroNet site you visit, if you choose to register a new per-site address will be created to register on that site. You’d need additional addresses for that, but that’s a topic for another post.

##Create a New Wallet

  • Create a new wallet using any Counterparty-compatible wallet
  • For this simple how-to, we can use CW (but you must remember to not use the address you plan to use on ZN for receiving and sending funds, or at least sweep that address regularly) and generate a new wallet seed, and 3 address/private key pairs. Write down the 12 word pass phrase if you intend to use this wallet later! There’s a also a script and in fact nothing prevents you from creating a ZN-only Counterwallet wallet, which wouldn’t be used for real funds)

The same could be achieved by creating a new wallet using Counterwallet, for example. Or, you could also use an unused address from existing wallet, although in that case you must be aware that anyone who hacks your system can have its private key. So in case you want to use existing wallet, I suggest to create new addresses (Counterwallet can display up to 20), and use address number 20. That way you’d use 20, 19, 18, etc. for ZeroNet while tokens and BTC would be stored at 1, 2, 3, 4. Just don’t overlap them.

In our case, the used a new wallet randomly generated on and the first address/private key combo:

ADDRESS                                 PRIVATE KEY
16xc855RUjERFJ9yZ8payPhhCFSren8nxd	L4V6JzHQY4Bpoph6DDmdormsU5fFmxoS3MnnrRAcEuXLKPot9u1k

Download and Deploy ZeroNet and Make It Use Your Counterwallet Address

NOTE: ZeroNet uses python2. Use python2 if you have python3 as your default.

This is a hackish approach, but I’ve found it to work. As I said, this is a Proof of Concept.

  • Download ZeroNet and decompress the archive.
  • Descend into decompressed directory.
  • Make a backup of
$ cp src/Crypt/ src/Crypt/
  • Edit [src/Crypt/](

The goal is to tell the tool to use our private key instead of generating a random new one:

Original source:

def newPrivatekey(uncompressed=True):  # Return new private key
    privatekey = btctools.encode_privkey(btctools.random_key(), "wif")
    return privatekey

After our changes:

def newPrivatekey(uncompressed=True):  # Return new private key
    privatekey = "L4V6JzHQY4Bpoph6DDmdormsU5fFmxoS3MnnrRAcEuXLKPot9u1k"
    return privatekey

##Create a New Site Using Your Counterwallet Address

$ python2 siteCreate
- Starting ZeroNet...
- OpenSSL loaded, version: 01000206F
- Generating new privatekey...
- ----------------------------------------------------------------------
- Site private key: L4V6JzHQY4Bpoph6DDmdormsU5fFmxoS3MnnrRAcEuXLKPot9u1k
-                   !!! ^ Save it now, required to modify the site ^ !!!
- Site address:     16xc855RUjERFJ9yZ8payPhhCFSren8nxd
- ----------------------------------------------------------------------
? Have you secured your private key? (yes, no) > yes
- Creating directory structure...
- Creating content.json...
Site:16xc85..8nxd Content.json not exist: data/16xc855RUjERFJ9yZ8payPhhCFSren8nxd/content.json
Site:16xc85..8nxd File content.json not exist yet, loading default values...
Site:16xc85..8nxd Opening site data directory: data/16xc855RUjERFJ9yZ8payPhhCFSren8nxd/...
Site:16xc85..8nxd - index.html (SHA512: b0bd5729bed1a01f2133bf4435f9c4d2871f88a53ce61188f5a1400177ef6081)
Site:16xc85..8nxd Adding timestamp and sha512sums to new content.json...
Site:16xc85..8nxd Verifying private key...
Site:16xc85..8nxd Correct 16xc855RUjERFJ9yZ8payPhhCFSren8nxd in valid signers: ['16xc855RUjERFJ9yZ8payPhhCFSren8nxd']
Site:16xc85..8nxd Signing content.json...
Site:16xc85..8nxd Saving to content.json...
Site:16xc85..8nxd File content.json signed!
- Site created!
  • You don’t need to backup your private key if you already have the 12 word pass phrase from Counterwallet (which you’re supposed to have)
  • Notice the location of your site relative to Zeronet folder (/data/<YOUR-BITCOIN-ADDRESSS/) and that it was signed by the owner of 16xc855RUjERFJ9yZ8payPhhCFSren8nxd which is our Counterwallet address.

##Start ZeroNet and Check Out Your Site

##Edit Or Update Content

You can edit site contents by editing or adding new files to your site directory tree. Ours is in the data subdirectory of decompressed ZeroNet source:

$ vi data/16xc855RUjERFJ9yZ8payPhhCFSren8nxd/index.html

Updated content:

<h2>Hello Counterpartier at 16xc855RUjERFJ9yZ8payPhhCFSren8nxd!<h2>
  • We need to re-sign the new content using our private key. If you already started ZeroNet, stop it. Then use sitePublish followed by your address (ours is 16xc855RUjERFJ9yZ8payPhhCFSren8nxd):
$ python2 sitePublish 16xc855RUjERFJ9yZ8payPhhCFSren8nxd
- Starting ZeroNet...
- OpenSSL loaded, version: 01000206F
- Loading site...
- Creating FileServer....
- Sending siteReload
- {'to': 1, 'cmd': 'response', 'ok': 'Reloaded'}
- Sending sitePublish
- {'to': 2, 'cmd': 'response', 'ok': 'Successfuly published to 0 peers'}
- Done.
  • Now start Zeronet again:

$ python2

  • Visit your page again:

  • You can run multiple sites from one ZeroNet instance, by creating additional sites using this same process, but if you use a hacked code as we did, you need to remember to edit for each new site ( used for previous sites can be backed up).
  • Site(s) configuration file contains a list of all sites configured to run on this instance. data directory can be backed up, as well as the two JSON files in it, because the content and configuration files cannot be magically restored from Counterwallet.
$ cat data/sites.json

  "16xc855RUjERFJ9yZ8payPhhCFSren8nxd": {
    "auth_key": "a3b863b86cb98be0a0a7e60b0fd865eee094e83e7b59462d670416753afa4835",
    "own": true,
    "permissions": [],
    "serving": true,
    "size": 795,
    "wrapper_key": "343a34c7dfbceaf1e5cb2046ca2f6812ac432d3a77c8038a20c373aee585b6ac"
ZeroNet Apps with Counterwallet Addresses

not valid anymore could you post anotherlink please


You can just create a new wallet on, and then add 2-3 addresses in it, and then click on each address and show & copy the private key. The address itself is public key.
There’s also a counterwallet-helper (on this forum) which is Python based client to generate addresses in the same order, using the Counterwallet-style 12 word pass phrase.

I didn’t suggest to use Counterwallet because the danger is you may use a CW address number 1, for example, in ZeroNet, and later forget you did that.
Now if you send some crypto to your first address and you forget about your ZN setup, someone might get hold of your private key for that address and sweep it…

I guess you can label your address “ZeroNet” to remind yourself to not use that address for funds, but that label is kept only until Counterwallet server is reinstalled (usually until the next version) and it’s not cross-server.
Anyway, you can use a CW address for this, just don’t forget there’s a risk that it may get leaked in case of ZN bugs or your setup errors, etc. Maybe create a ZN-only Counterwallet wallet and don’t use it for anything but ZN.

1 Like