Skip to content

Instantly share code, notes, and snippets.

View dexX7's full-sized avatar

dexX7

View GitHub Profile

SPV clients lack the ability of full nodes to detect whether or not a chain provided to them by another source complies with the rules of the Bitcoin protocol.

SPV clients can connect to multiple full nodes in the hope that at least one of the nodes is honest and will provide them with the best valid chain, however situations may arise where the non-compliant chain contains more proof of work than the compliant chain. In this situation, there is no way for the honest full node to signal to an SPV client that it should disregard the chain with more proof of work.

Fraud proofs are a technique which provide honest full nodes the capability to conclusively demonstrate that chain is invalid regardless of the amount of proof of work backing the invalid chain.

If Bitcoin nodes implement the ability to create, propagate, and verify fraud proofs, the security of SPV clients will be improved.

Assumptions and Definitions

namespace sanitization {
inline char to_hex_char( unsigned int c )
{
assert( c <= 0xF );
const char ch = static_cast< char >( c );
if( ch < 10 ) return '0' + ch;
@dexX7
dexX7 / files.md
Created June 25, 2015 16:35
Omni Core persistence overview

write_msc_balances

File path:

"MP_persist/balances"

Persisted information:

"%s=%d:%d,%d,%d,%d;[%d:%d,%d,%d,%d;..]"
@dexX7
dexX7 / p2sh_watchonly_import.sh
Created June 18, 2015 05:45
Watch-only import of P2SH addresses and redeemScripts
$ ./src/bitcoin-cli addmultisigaddress 2 '["04c2eafdda35b83622d5c199bcfc94eed92c9f633f2fd0eeaa6b62d546fa2f57ea31b30474b76d3e4dca908f9bd86540eaec3bab3d5fda31f03452cc9c72370a72", "0441b5e5365075fc3a3df8313abefdceb0a7f67f5253f96f7ea2cb5d952ac6537adad5e25ca9eef68a486c3c0fe4c87e9fe566b1849c9da03b02c686dfecee99c9", "04833bd2554180768f247ab0cbd552f35cd6653704e9aa02f1e68cf61f7330d3c8a1a90f43bac80e695c0d90dba8c43c9003c27cd7ffb8e4d0c8c04aace33fe674"]'
2N55BnWYhDhPgKCkCMAxuXzxWbA3p6dU4YQ
$ ./src/bitcoin-cli importaddress "2N55BnWYhDhPgKCkCMAxuXzxWbA3p6dU4YQ"
# done!
# since addmultisigaddress already added the script, it's not necessary
# to import each key, which was used to construct the script
$ ./src/bitcoin-cli validateaddress "2N55BnWYhDhPgKCkCMAxuXzxWbA3p6dU4YQ"
{
@dexX7
dexX7 / dispatchers.md
Created June 16, 2015 08:46
Omni Core event system overview

CheckWalletUpdate

Updates wallet balance cache.

Fires OmniBalanceChanged and OmniStateChanged signal.

init.cpp:
  - AppInit2()
@dexX7
dexX7 / oc-0.10-diff.md
Last active August 29, 2015 14:22
Omni Core - 0.10 modifications/diff

Modified/Shared:

  • .gitignore
  • .travis.yml
  • Makefile.am
  • README.md
  • qa/pull-tester/rpc-tests.sh
  • qa/pull-tester/run-bitcoind-for-test.sh.in
  • qa/rpc-tests/util.py
  • qa/rpc-tests/util.sh
from random import shuffle
def is_accepted_output(output):
"""Determine, if the output qualifies as input for an Omni transaction.
Any input with a type other than "pay-to-pubkey-hash" and "pay-to-script-hash"
invalidates an Omni transaction."""
return output['type'] == 'pubkeyhash' or output['type'] == 'scripthash'
Value sendtrade_OMNI(const Array& params, bool fHelp)
{
if (fHelp || params.size() != 6)
throw runtime_error(
"sendtrade_OMNI \"fromaddress\" propertyidforsale \"amountforsale\" propertiddesired \"amountdesired\" action\n"
"\nPlace or cancel a trade offer on the distributed token exchange.\n"
"\nParameters:\n"
"FromAddress : the address to send this transaction from\n"
"PropertyIDForSale : the property to list for sale\n"
"AmountForSale : the amount to list for sale\n"
@dexX7
dexX7 / classic.diff
Last active August 29, 2015 14:20
boost::filesystem::path workarounds
# Using std::locale::classic() over std::locale("C") may be the preferable
# default, given the following properties.
#
# According to http://en.cppreference.com/w/cpp/locale/locale/classic:
#
# Some of the standard-required facets, such as the UTF-8/UTF-32 conversion
# facet std::codecvt<char32_t, char, std::mbstate_t>, have no equivalents in
# the "C" locale, but they are nevertheless present in the locale returned
# by std::locale::classic(), as in any other locale constructed in a C++
# program.