goupnumber / gun Goto Github PK
View Code? Open in Web Editor NEWThe Go Up Number Wallet
License: BSD Zero Clause License
The Go Up Number Wallet
License: BSD Zero Clause License
It should be possible to take an existing gun wallet and migrate it to a new setup. This would take the same arguments as gun setup
but would create a tx sending all the existing coins to the new wallet afterwards.
it doesn't output any emojis. Right now the command logic is full of eprintln
. I think we should replace every eprintln
with a custom function for the purpose of the message so it can be formatted correctly.
for example, if it's warning the user about something prefix the message with the
The help
output for gun send
indicates that one can use abs:300
to define the absolute number of sats for the fee
ARGS:
<value> The amount to send with denomination e.g. 0.1BTC
<to> The address to send the coins to
<fee> The transaction fee to attach e.g. spb:4.5 (4.5 sats-per-byte), abs:300 (300 sats absolute fee), in-
blocks:3 (set fee so that it is included in the next three blocks) [default: in-blocks:1]
but attempting to build a transaction using absolute amount returns the following error:
âŊ gun send 0.0001BTC mkHS9ne12qx9pS9VojpwU5xtRd4T7X7ZUt abs:300
error: Invalid value for '<fee>': unknown denomination:
Is there supposed to be a denomination there if we want to use straight sats? I tried SAT
but it didn't work. Of course simply defining it in BTC did work. Just wondering if sats are an option, as per the help note.
Related to this: the note for ` explains one is required to provide a denomination, and one example is provided. It feels like there may be others but we're left wondering what they are. Are they listed anywhere else in the help?
There should be a way to only show unused addresses when listing addresses.
As a stepping stone for taproot.
A lot of the changes we made in v0.6 means that --yes
probably won't work very well. The value isn't passed down to the signers. Probably the solution is to pass a reference to something into the signers that we can mutate later by the signers.
I first sent myself 100k sats, then I split into two, then I noticed the bug and tried to do it again so I did a "send all" to one address, then split into three again.
un -d $(pwd)/test split 30000sat
> This is the transaction that will be broadcast.
> âââââââĶâââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââĶâââââââââââââââ
> â in â fbca9506d0de7ecad0e0979fb1127349ae19ecb1d2517479b8d794ea3626bf27:0 â 0.00 099 678 â
> â ââââââŽâââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââŽâââââââââââââââĢ
> â â total â 0.00 099 678 â
> â ââââââŽâââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââŽâââââââââââââââĢ
> â out â tb1qsrjk4wa9z53wehe7j2zc3ysy09lrapc87ee3t5 â 0.00 009 475 â
> â ââââââŽâââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââŽâââââââââââââââĢ
> â â tb1qqm4eprhj5nhzzhvr2qn2z2f4899nrua9ckmala â 0.00 030 000 â
> â ââââââŽâââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââŽâââââââââââââââĢ
> â â tb1q8tul7q9z97eazxxyfpd94m8xn28qskcls4yey2 â 0.00 030 000 â
> â ââââââŽâââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââŽâââââââââââââââĢ
> â â tb1qgca8xw8c4t0834e655t6vfk3auesjjgdpl9pz6 â 0.00 030 000 â
> â ââââââŽâââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââŽâââââââââââââââĢ
> â â total â 0.00 099 475 â
> â ââââââŽâââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââŽâââââââââââââââĢ
> â fee â 1.004 sats/vb â 0.00 000 203 â
> âââââââĐâââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââĐâââââââââââââââ
> Ok [y/n]? y
ââââââââĶâââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
â txid â a2d9d7848c2b711051cd4317088501ed9faa3885232ebbb4addcb73b7ac1ac80 â
ââââââââĐâââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
gun -d $(pwd)/test -s address list
syncing wallet with Esplora(EsploraBlockchainConfig { base_url: "https://blockstream.info/testnet/api", concurrency: Some(4), stop_gap: 10 })
ââââââââââââââââââââââââââââââââââââââââââââââĶââââââââĶââââââââ
â address â value â utxos â
â âââââââââââââââââââââââââââââââââââââââââââââŽââââââââŽââââââââĢ
â tb1qv04v98ehqtnfgjyey5gaffhlg2jeruvl43m8gn â 0 â 0 â
â âââââââââââââââââââââââââââââââââââââââââââââŽââââââââŽââââââââĢ
â tb1qla6ll870hzr4p83wv9dxd2yn0psuywme853x5w â 0 â 0 â
ââââââââââââââââââââââââââââââââââââââââââââââĐââââââââĐââââââââ
gun -d $(pwd)/test -s tx list
syncing wallet with Esplora(EsploraBlockchainConfig { base_url: "https://blockstream.info/testnet/api", concurrency: Some(4), stop_gap: 10 })
ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââĶââââââââââĶââââââââââââââââââââââĶâââââââââââââââĶâââââââââââââââ
â txid â height â seen â sent â received â
â âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââŽââââââââââŽââââââââââââââââââââââŽâââââââââââââââŽâââââââââââââââĢ
â a0296d39399043643f7b3ad351bcf5023f7071015461ce45549e0bb408c2cc7c â 2099501 â 2021-10-17T18:52:14 â 0.00 100 000 â 0.00 099 857 â
â âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââŽââââââââââŽââââââââââââââââââââââŽâââââââââââââââŽâââââââââââââââĢ
â aa0bd640878d2713328670e3aa58b01add70d5e8cc65f54b08a2bda617d32203 â 2099498 â 2021-10-17T18:29:37 â 0 â 0.00 100 000 â
â âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââŽââââââââââŽââââââââââââââââââââââŽâââââââââââââââŽâââââââââââââââĢ
â fbca9506d0de7ecad0e0979fb1127349ae19ecb1d2517479b8d794ea3626bf27 â - â - â 0.00 099 857 â 0.00 099 678 â
â âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââŽââââââââââŽââââââââââââââââââââââŽâââââââââââââââŽâââââââââââââââĢ
â a2d9d7848c2b711051cd4317088501ed9faa3885232ebbb4addcb73b7ac1ac80 â - â - â 0.00 099 678 â 0.00 099 475 â
ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââĐââââââââââĐââââââââââââââââââââââĐâââââââââââââââĐâââââââââââââââ
We need to be able to broadcast a signed transaction. The most important bit is that we can broadcast PSBTs but I guess we should also support broadcasting a raw transaction hex. I think the command should be:
gun broadcast [<tx-file>]
<tx-file>
can be a path to either a PSBT encoded as base64 or binary. Or it can be a raw consensus encoded transaction. If <tx-file>
is -
gun should read it from STDIN.
If is missing and psbt-output-dir
from #62 is set then gun should go through each .psbt
file in psbt-output-dir
and broadcast it if it looks finalized.
Which output is the bet output, which is whose change output etc.
If it's left out display the two possible outcomes and prompt user for their choice.
https://gun.fun/bet/propose.html
Would be helpful to offer strategies for how to set up the onchain utxo that will be offered in a public proposal. These sorts of situations offer zero margin for error since privacy leaks cannot be undone.
I don't want to turn this into yet another privacy argument but I do think a good gun user should be aware of all the options and then pick accordingly (personal time preference and competence level). Including this in the docs may be out of scope for the project but seeing as how it's onchain I don't see how any discussion of this protocol can escape the perils of poor onchain fungibility.
There are two strategies (this is an ordered list);
coinjoin (all things considered this is the best option because its the most secure way to enhance privacy) (this is an unordered list!!)
lightning to onchain via no-kyc exchange.
The exchange has no idea where the LN sats came from and they don't know who owns the newly created UTXO, outside observers only see an exchange whitdrawal and would have to ask the exchange who sent the deposit (cheaper, steganographic, much less secure since it requires custodians in most cases (sans submarine swaps but I'm still not 100% sure what the privacy implications of that protocol are), much lower liquidity, much faster and with more competing options)
self-mining
there are other ways but these methods are verboten and shall not be discussed nor encouraged. Well maybe we can discuss them but we really can't encourage them.
If there are any other workable strategies I would like to hear them.
Plebs (and degens alike) should not shy away from participating in this because of a fear of doxxing their stash.
Spending the utxo after a winning bet also presents privacy challenges.
It would be great if there were a way to select specific utxos when spending, bypassing whatever existing coin selection algorithm exists.
Brainstorming some ideas for how this could work
--spend-from
- perhaps poor UX but also extensible for gun as a cliindexes
with a flag - would probably want address list
to include an index column so these are accessible. We would also have to make some distinction on internal/external..--spend-from
)Other ideas?
We should be able to initialize the wallet with an arbitrary descriptor like gun init <external-descriptor> [<internal-descriptor>]
With no change descriptor:
gun init descriptor "wpkh([AAB893A5/84'/0'/0']xpub661MyMwAqRbcFGjD5niBpcDJ1evbWb51fZ5N29BZRykhud3gEefAvjKvoqGVYXBnBS8JqN1cqCpZg8qJqSPjn9dJNamSXJj/0/*
With a change descriptor:
gun init descriptor "wpkh([AAB893A5/84'/0'/0']xpub661MyMwAqRbcFGjD5niBpcDJ1evbWb51fZ5N29BZRykhud3gEefAvjKvoqGVYXBnBS8JqN1cqCpZg8qJqSPjn9dJNamSXJj/0/*)" "wpkh([AAB893A5/84'/0'/0']xpub661MyMwAqRbcFGjD5niBpcDJ1evbWb51fZ5N29BZRykhud3gEefAvjKvoqGVYXBnBS8JqN1cqCpZg8qJqSPjn9dJNamSXJj/1/*)"
The above should simplify to the below:
gun init xpub "[AAB893A5/84'/0'/0']xpub661MyMwAqRbcFGjD5niBpcDJ1evbWb51fZ5N29BZRykhud3gEefAvjKvoqGVYXBnBS8JqN1cqCpZg8qJqSPjn9dJNamSXJj"
I think the way this information should be stored should just be in the WalletKey enum like:
enum WalletKey {
SeedWordsFile,
Descriptor { external: String, internal: Option<String> }
}
And in the config.json like:
{
"kind": "descriptor",
"external" : "wpkh([AAB893A5/84'/0'/0']xpub661MyMwAqRbcFGjD5niBpcDJ1evbWb51fZ5N29BZRykhud3gEefAvjKvoqGVYXBnBS8JqN1cqCpZg8qJqSPjn9dJNamSXJj/0/*)",
"internal" "wpkh([AAB893A5/84'/0'/0']xpub661MyMwAqRbcFGjD5niBpcDJ1evbWb51fZ5N29BZRykhud3gEefAvjKvoqGVYXBnBS8JqN1cqCpZg8qJqSPjn9dJNamSXJj/1/*)"
}
I think the right thing to do is output the PSBT if a transaction is not finalized after signing. They should be output to psbt-output-dir
(default should be $GUN_DIR/psbts
). The filename should be <tentative-txid>.psbt
. You can get the tentative-txid by doing psbt.extract_tx().txid()
.
At the moment let's just hang and wait for the user to sign the PSBT there. Whenever they press enter read the file back in and check if it has been signed. Once it has been signed, broadcast it.
Right now we have a mandatory <network>
argument to init
. This should just be made into a optional --network
argument with the default being "bitcoin"
The existing gun init
should go under gun init seed
.
gun will sometimes choose additional inputs even when it has a single input that would cover the bet. We want as few as possible so everything fits into a tweet. Right now we are just deferring to the branch and bound algorithm that BDK uses. Need to investigate why it does this.
a proposal like:
0.00089689#h00.ooo#/random/2021-08-25T01:00:00/heads_tails.winner#ÐąÓÚŽāĻŠÆŦā·ā―
Ûá§āŠÏĒāđÞÞā°āķ―āŠāĻĒāĻā―Ķā―Õ§ÉÅÉāĻŅŽāŠāēŠáāķķāīāšÞÝÎķāŪČÕÚ ÝŪáÎūŨĨßĶČūÔÕÃÃ
when pasted into a zsh terminal might make weird stuff happen. The solution might be to to use right-to-let characters in base2048.
We should be able to bump the fee of a tx of a bet in the unconfirmed
state via CPFP by spending from the change output.
The annoying thing about this is that it implies that bet tx always need change outputs for both parties I guess.
gun send
only allows single address sends but we should allow building arbitrary transactions.
I'm not sure what the CLI api should be but something like:
gun psbt build \
-i 931043e6794c465665684fe0ef8c3ed070502bddd58ec7b07fe3aa2a9bbe3bf4:0 \
-i 2a9cd9d7ff02f0863335cbbe1908ad2b263935ddbad555b1b806ab168c22d7a7:1 \
-o bc1qw6h3w0g2446j2ycfe8h87sufethtawmsut8s9t:0.1BTC \
-o bc1q07sq6ch5gajwcr05c7nsdmegnyfsuw3lawgwul:0.3BTC \
--fee rate:5.1
This would output a PSBT.
You'd then have a gun psbt sign
command to sing it and a gun psbt broadcast
to check if it's finalized and try and broadcast it.
This is necessary to use gun as part of a traditional multisig setup where it isn't the initiating signer. i.e. where you just have a gun
on a laptop and get PSBTs and sign them from there.
I wanted to join the discord, but the invite appears to be broken ðŋ
Otherwise after you cancel a split you increment the change index too much without using any addresses inbetween.
This is what samurai wallet uses and I think its a user-friendly and effective way to secure the mnemonic.
Perhaps using https://github.com/rust-embedded/cross
Right now it outputs something like:
syncing wallet with Esplora(EsploraBlockchainConfig { base_url: "https://mempool.space/api", concurrency: Some(4), stop_gap: 100 })
But it there should be more information here and it should be nicely formatted:
gun -s bet list
it should mention which bets it is checking and output something useful if possible.I think #19 could have been caught by clippy.
I am wondering what would it require to add regtest RPC backend support in gun. I want to be able to create regtest betting transaction and test out various betting scenarios. Can be useful for automated integration testing too.
Is it possible right now? If not what needs to be done to bet on local regtest?
You should be able to inititialize gun with a coldcard:
gun init coldcard /path/to/sd-card
It should be able to read the PSBT in some format and initialize the wallet in a similar manner to #62 but instead reading the descriptor info from the exported keys. It should also set the psbt output dir to the appropriate place.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
ð Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ððð
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google âĪïļ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.