Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multi: implement user onboarding game #2921

Merged
merged 3 commits into from
Aug 23, 2024
Merged

Conversation

buck54321
Copy link
Member

This introduces functionality to play a geocache-like marketing game wherein we publish the GPS coordinates to caches placed in the real world that contain a code redeemable for DCR and a prepaid bond. Here's how it works

  1. Generate a standard 16-byte (32 hex digits) prepaid bond
  2. Using the prepaid bond as entropy, generate a private/public key pair and get the P2PKH address for the pubkey.
  3. Fund the game by sending some DCR to the address
  4. Print the prepaid bond and stick it into a waterproof container
  5. Hide the container somewhere cool and record the GPS coordinates of the spot
  6. Publish the GPS coordinates
  7. Player goes to the coordinates and retrieves the code
  8. Using Bison Wallet, player redeems their code, regenerating the key, redeeming the funds, and bonding with the server. The funds are immediately available for trading

The user also has the option to encode a message of up to 256 characters in their redemption transaction.

Tested on testnet and mainnet.

image
image

Copy link
Contributor

@ukane-philemon ukane-philemon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utAck.

How can I generate a prepaid bond that is not tied to an account?

func (dcr *ExchangeWallet) RedeemGeocode(code []byte, msg string) (dex.Bytes, uint64, error) {
msgLen := len([]byte(msg))
if msgLen > stdscript.MaxDataCarrierSizeV0 {
return nil, 0, fmt.Errorf("message is too long. must be %d > %d", msgLen, stdscript.MaxDataCarrierSizeV0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: must be %d < %d

// prepaid bond (code is a prepaid bond). If the user is not registered with
// dex.decred.org yet, the dex will be added first.
func (c *Core) RedeemGeocode(appPW, code []byte, msg string) (dex.Bytes, uint64, error) {
const dcrBipID = 42
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should use the const from the network pkg? And say that this supports only dcr codes in the comment.

Comment on lines +10772 to +10779
host := "dex.decred.org:7232"
switch c.net {
case dex.Testnet:
host = "bison.exchange:17232"
case dex.Simnet:
host = "127.0.0.1:17273"
}
cert := CertStore[c.net][host]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Host should be a param. Maybe make it be part of the code?

Copy link
Member Author

@buck54321 buck54321 Aug 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that the server should be a parameter, but it can't be "part of the code". If we expand this, we'll just have to note the server on the paper in the cache. That would, of course, add friction when the user redeems, so I'm avoiding that for now. May change later.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to follow up, here is my reasoning for hard-coding the hosts.

  • When we make the host a parameter, we will be adding more steps and new things to break.
  • We could start with radio buttons for our "known servers", but there is only one public mainnet server right now anyway.
  • We could add an input field for a custom host, but since we're so late in the release cycle, I want to minimize new code, and I think there's a balance to be struck

@buck54321 buck54321 merged commit bce9337 into decred:master Aug 23, 2024
5 checks passed
buck54321 added a commit to buck54321/dcrdex that referenced this pull request Aug 23, 2024
* implement geogame

* internationalize

* remove superfluous module
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants