Skip to content

Instantly share code, notes, and snippets.

# Example of stealth addressess using Diffie-Hellman, to create a unique offset between 2 mpks
# doesn't need to exchange data in the blockchain. Payee can just look for new transactions against their
# mpk at offset S, where S is the shared secret between the two parties.
import obelisk
import os
from ecdsa import numbertheory, curves, util, ellipticcurve
# From https://github.com/FelixWeis/python-hdwallet/blob/master/hdwallet/hdwallet.py
def point_decompress(data):
@Bobalot
Bobalot / Stealth example
Created January 16, 2014 16:47
Stealth without nonces. As long as bob and alice know each other then can each create the shared secret and check that branch for a payment, using a gap limit to decide when to stop checking.
In [1]: %run examples/stealth.py
Bob secret e8f32e723decf4051aefac8e2c93c9c5b214313817cdb01a1494b917c8436b35
Alice secret 4b03d6fc340455b363f51020ad3ecca4f0850280cf436c70c727923f6db46c3e
Bob mpk (compressed) 0339a36013301597daef41fbe593a02cc513d0b55527ec2df1050e2e8ff49c85c2
Alice mpk (compressed) 03cbcaa9c98c877a26977d00825c956a238e8dddfbd322cce4f74b0b5bd6ace4a7
Bob chain 873dff81c02f525623fd1fe5167eac3a55a049de3d314bb42ee227ffed37d508
@Bobalot
Bobalot / stealth.py
Last active January 3, 2016 09:59
Bitcoin stealth address example without needing to store data in the blockchain. Payee can listen for new addresses against the shared secret S, as long as they know the master public key of who is sending the payment(s)
# Example of stealth addressess using Diffie-Hellman, to create a unique offset between 2 mpks
# doesn't need to exchange data in the blockchain. Payee can just look for new transactions against their
# mpk at offset S, where S is the shared secret between the two parties.
# This will require the payee to subscribe to n addresses,
# where n is the number of identities they expect to receive a payment from.
import obelisk
import os
from ecdsa import numbertheory, curves, util, ellipticcurve
/*
Magic read test derp
*/
#include <future>
#include <bitcoin/bitcoin.hpp>
#define LOG_BOOTSTRAP "bootstrap"
using namespace bc;
using std::placeholders::_1;
/*
Imports blocks from bootstrap.dat
bootstrap.dat is the raw blocks in the format
[magic bytes] [block length] [serialized block]
*/
#include <future>
#include <bitcoin/bitcoin.hpp>
#define LOG_BOOTSTRAP "bootstrap"