Skip to content

Instantly share code, notes, and snippets.

Avatar
🍀

Jonathan Chappelow chappjc

🍀
View GitHub Profile
@chappjc
chappjc / addrpool.go
Created Jun 10, 2021
address pool hacking
View addrpool.go
package dcr
import (
"errors"
"fmt"
"github.com/decred/dcrd/crypto/ripemd160"
"github.com/decred/dcrd/dcrec"
"github.com/decred/dcrd/dcrutil/v4"
"github.com/decred/dcrd/hdkeychain/v3"
@chappjc
chappjc / ethereum_full_node.md
Last active Jun 9, 2021
Ethereum full node (geth) notes
View ethereum_full_node.md

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
View dex-enable-notes.md

Welcome to DCRDEX!

Although DCRDEX looks and feels like a regular exchange, there are important differences. Please read the Highlights and Important Notices at https://github.com/decred/dcrdex/blob/master/docs/release-notes/release-notes-0.2.0.md.

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
chappjc / usdt.sol
Created Feb 15, 2021
usdt contract
View usdt.sol
/**
*Submitted for verification at Etherscan.io on 2017-11-28
*/
pragma solidity ^0.4.17;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
@chappjc
chappjc / usdc.sol
Created Feb 15, 2021
usdc solidity contracts
View usdc.sol
/**
*Submitted for verification at Etherscan.io 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 127.0.0.1:48372
2021-02-11 12:39:31.950 [INF] RPCS: RPC method "getbestblock" invoked by 127.0.0.1:48372
2021-02-11 12:39:32.950 [INF] RPCS: RPC method "getbestblock" invoked by 127.0.0.1:48372
2021-02-11 12:39:33.950 [INF] RPCS: RPC method "getbestblock" invoked by 127.0.0.1:48372
2021-02-11 12:39:34.416 [INF] RPCS: RPC method "walletlock" invoked by 127.0.0.1:48372
2021-02-11 12:39:34.950 [INF] RPCS: RPC method "getbestblock" invoked by 127.0.0.1:48372
2021-02-11 12:39:35.950 [INF] RPCS: RPC method "getbestblock" invoked by 127.0.0.1:48372
2021-02-11 12:39:36.950 [INF] RPCS: RPC method "getbestblock" invoked by 127.0.0.1:48372
2021-02-11 12:39:37.950 [INF] RPCS: RPC method "getbestblock" invoked by 127.0.0.1:48372
2021-02-11 12:39:38.950 [INF] RPCS: RPC method "getbestblock" invoked by 127.0.0.1:48372
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
runtime.notesleep(0x15cee08)
/home/jon/go115/src/runtime/lock_futex.go:159 +0x9f
@chappjc
chappjc / dcrdex_v0.1.0_rn.md
Last active Oct 27, 2020
dcrdex v0.1.0 release notes
View dcrdex_v0.1.0_rn.md

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
chappjc / user-matches-snippets.go
Created Oct 5, 2020
user-matches-snippets.go
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
FROM %s
WHERE takerSell IS NOT NULL
AND (takerAccount = $1 OR makerAccount = $1)
AND (NOT active OR bRedeemTime IS NOT NULL)