Rusty Russell
a663dc322c
Remove signature leaking.
Alpha has segregated witnesses, so txid doesn't include the inputs.
That means we can create the first commit transaction before we sign
the anchor tx.
Bitcoin will need to do this differently: presumbly via new sipops
(a OP_CHECKSIG2VERIFY I imagine).
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
f510e29e22
alpha: switch over to Elements Alpha by default.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
62a002c860
script: make DER for signature encoding optional.
Alpha does the sane thing, places signatures raw.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
faae91f3fc
Schnorr signature support.
This variation is used by alpha.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
d20ddb5a90
Use libsecp256k1 instead of openssl for crypto.
We still use openssl for bignums (base58) and for ripemd.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
5a79ef9502
Import secp256k1 (schnorr version)
Imported from: git@github.com:sipa/secp256k1.git schnorr3 (0ab0b47)
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
20624c049f
tx: prepare for Elements Alpha.
They sign, hash, and serialize differently.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
602117e8bb
Add valgrind memcheck helpers.
Otherwise valgrind tells you when you test a hash; you want to
know if you hash uninitialized memory long before that.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
c91d2b5206
ccan: add local copy.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
a0b621689e
TAGS: Improve support.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
4e8eda47a1
Move hacky command line utils out to test-cli subdir.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
442f321585
Move protobuf<->bitcoin converters out of bitcoin/
They're lightning-specific.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
612d713470
Move bitcoin stuff into bitcoin subdir.
It's not very interesting if you're looking for LN code.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
2d714f5ad4
create-commit-tx: create a commit tx.
Required for unilateral close. Also lets us test stealing funds
from a revoked transaction.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
ed3f0115d6
protocol: fix horribly thinko, keep own secrets.
I had each side using the other side's hash secret. That's a very
dumb idea, since it means you can steal from a unilateral close!
A's secret applies to A's commit transaction: it needs the
secret and B's final signature to steal funds, and that should
never happen (since A doesn't have the B's final signature, and
once A has given B the secret, they never broadcast the commit tx).
This makes the update a 4 step dance, since you need the new
revocation hash to make the other side's TX to sign.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
3fef1584e5
update-channel-complete: final step in channel update.
(note: I didn't bother writing the code to check the sig on this).
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
3957f1e1c1
update-channel-accept: accept the channel update.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
d51f6372aa
update-channel: prepare a new tx with modified amounts.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
ecb39efed1
find_p2sh_out: extract helper.
Really only for our silly little utils.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
7175d73573
create-close-tx: create a mutual close tx from the close sigs.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
38f7a23064
close-channel: create message to mutually close channel.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
16baa1dae9
create-commit-spend-tx: spend the commit tx (after timeout)
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
fc8552318a
opt_bits: parsing routines for 'bits' == 100 satoshi.
Also fix open-channel usage message.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
126192a842
create-steal-tx: get my money back!
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
0742e5356f
get-anchor-depth: simple helper to get min_confirms from OpenChannel packet
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
33bbd38691
Makefile: cleanup and generalize
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
623c6562af
Makefile: add TAGS target.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
617d21eb43
check-anchor-scriptsigs: dump out anchor tx if scriptsigs make expected tx.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
67f98fe6b6
Rename "anchor sig" to "anchor scriptsigs" to be clearer.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
c291d19af6
Add check-commit-sig.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
07c7214edb
Explicit pubkey structure.
This checks that the protobuf is the right form, also handles uncompressed
keys (though you shouldn't be using those any more, should you?)
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
c04d20e019
commit_tx: new file containing logic to create initial commitment transaction.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
bf38ca052e
open-commit-sig: create signature for commit tx.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
63986e5b2d
Rename perturb to permute.
Perturb is a bit stretched for this, permute is better.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
f43cdf085a
Move anchor creation out into its own file.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
10133575b9
leak-anchor-sigs: the horrible hack until we have normalized txs.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
670670f138
open-anchor-sig, many fixes for open-channel.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
81ac81e699
Rename openchannel to open-channel.
Since I'm about to write create-anchor, which definitely needs a separator.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago
Rusty Russell
1c4fdce514
Initial silly cmdline util to create an openchannel packet.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years ago