Skip to content

Instantly share code, notes, and snippets.


Jonathan Chappelow chappjc

View GitHub Profile
chappjc / addrpool.go
Created Jun 10, 2021
address pool hacking
View addrpool.go
package dcr
import (
chappjc /
Last active Jun 9, 2021
Ethereum full node (geth) notes

With geth 1.10.3+, the following options should be used to sync a full node from scratch:

  • --datadir.ancient=, to put the freezer on a larger and less expensive drive (HDD), option added in geth 1.9
  • --syncmode snap, to use the new "snap" initial sync mode, added in geth 1.10

e.g. geth --datadir /mnt/fast-ssd/geth --datadir.ancient /mnt/big-hdd/geth-ancient --syncmode snap

As of Ethereum mainnet block 12,517,949 (May-27-2021 06:27:52 PM +UTC), the disk space required is:

  • state and indexes (datadir minus the ancient folder): 151 GiB
  • freezer (datadir.ancient folder): 215 GiB

Welcome to DCRDEX!

Although DCRDEX looks and feels like a regular exchange, there are important differences. Please read the Highlights and Important Notices at

Trades do not settle instantly. Settlement happens on-chain, and requires multiple block confirmations. Depending on network conditions, this can take hours. The DEX software and external wallets like bitcoind MUST stay running until your trades have fully settled or refunded. Always start external wallets first, and stop them last.

You must remain connected to the internet for the full duration of trade settlement. Loss of connectivity for several minutes is generally OK, but extended downtime may cause a swap may be revoked (forced to refund) and your booked orders to be canceled. Losing your connection to the DEX server does NOT put funds at risk. If you do need to restart the DEX software, be sure to login again immediately.

During a swap, if either you or

chappjc / usdt.sol
Created Feb 15, 2021
usdt contract
View usdt.sol
*Submitted for verification at on 2017-11-28
pragma solidity ^0.4.17;
* @title SafeMath
* @dev Math operations with safety checks that throw on error
chappjc / usdc.sol
Created Feb 15, 2021
usdc solidity contracts
View usdc.sol
*Submitted for verification at on 2020-08-20
// File: @openzeppelin/contracts/math/SafeMath.sol
// License: MIT
pragma solidity ^0.6.0;
View dcrwallet hang2
2021-02-11 12:39:30.950 [INF] RPCS: RPC method "getbestblock" invoked by
2021-02-11 12:39:31.950 [INF] RPCS: RPC method "getbestblock" invoked by
2021-02-11 12:39:32.950 [INF] RPCS: RPC method "getbestblock" invoked by
2021-02-11 12:39:33.950 [INF] RPCS: RPC method "getbestblock" invoked by
2021-02-11 12:39:34.416 [INF] RPCS: RPC method "walletlock" invoked by
2021-02-11 12:39:34.950 [INF] RPCS: RPC method "getbestblock" invoked by
2021-02-11 12:39:35.950 [INF] RPCS: RPC method "getbestblock" invoked by
2021-02-11 12:39:36.950 [INF] RPCS: RPC method "getbestblock" invoked by
2021-02-11 12:39:37.950 [INF] RPCS: RPC method "getbestblock" invoked by
2021-02-11 12:39:38.950 [INF] RPCS: RPC method "getbestblock" invoked by
View dcrwallet hang
SIGABRT: abort
PC=0x473ae1 m=0 sigcode=0
goroutine 0 [idle]:
runtime.futex(0x15cee08, 0x80, 0x0, 0x0, 0x7ffe00000000, 0x4736bc, 0x57f5d, 0x1ee57559, 0x7ffe4c8c2738, 0x40ddff, ...)
/home/jon/go115/src/runtime/sys_linux_amd64.s:587 +0x21
runtime.futexsleep(0x15cee08, 0x0, 0xffffffffffffffff)
/home/jon/go115/src/runtime/os_linux.go:45 +0x46
/home/jon/go115/src/runtime/lock_futex.go:159 +0x9f
chappjc /
Last active Oct 27, 2020
dcrdex v0.1.0 release notes

DCRDEX v0.1.0 (beta)

Important Notices

  • Ensure your nodes (and wallets) are fully synchronized with the blockchain network before placing orders. The software will verify this for you in the next patch release.
  • Never shutdown your wallets with dexc running. When shutting down, always stop dexc before stopping your wallets.
  • If you have to restart dexc with active orders or swaps, you must immediately login again with your app password when dexc starts up. The next patch release wil inform you on startup if this is required.
  • There is a 5 minute "inaction timeout" when it becomes your client's turn to broadcast a transaction, so be sure not to stop dexc or lose connectivity for longer than that or you risk having your active orders and swaps/matches revoked. If you do have to restart dexc, remember to login as soon as you start it up again.
  • Only one dexc process should be running for a given user account at any time. For example, if you have identical dexc configurations on two comput
chappjc / user-matches-snippets.go
Created Oct 5, 2020
View user-matches-snippets.go
const (
// TallyInactiveUserMatches gets a tally of inactive matches for a user,
// grouped by match status. This excludes cancel order matches with
// "takerSell IS NOT NULL". MatchComplete is inferred by "bRedeemTime IS NOT
// NULL" so the MatchComplete integer value need not be a query argument.
TallyInactiveUserMatches = `SELECT COUNT(*), status, makeraccount=$1 AS isMaker, takeraccount=$1 AS isTaker
AND (takerAccount = $1 OR makerAccount = $1)
AND (NOT active OR bRedeemTime IS NOT NULL)