Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/near/near-linkdrop
Contract to drop tokens via link
https://github.com/near/near-linkdrop
Last synced: about 2 months ago
JSON representation
Contract to drop tokens via link
- Host: GitHub
- URL: https://github.com/near/near-linkdrop
- Owner: near
- Created: 2020-02-20T07:35:48.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2024-01-10T17:31:33.000Z (12 months ago)
- Last Synced: 2024-02-12T23:11:10.759Z (11 months ago)
- Language: Rust
- Size: 453 KB
- Stars: 54
- Watchers: 14
- Forks: 30
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-near - NEAR Linkdrop
README
# LinkDrop contract
LinkDrop contract allows any user to create a link that their friends can use to claim tokens even if they don't have an account yet.
The way it works:
Sender, that has NEAR:
- Creates a new key pair `(pk1, privkey1)`.
- Calls `linkdrop.send(pk1)` with attached balance of NEAR that they want to send.
- Sends a link to any supported wallet app with `privkey1` as part of URL.Receiver, that doesn't have NEAR:
- Receives link to the wallet with `privkey1`.
- Wallet creates new key pair for this user (or they generate it via HSM) `(pk2, privkey2)`.
- Enters the `new_account_id` receiver want for their new account.
- Wallet creates a transaction to `linkdrop.create_account_and_claim(new_account_id, pk2)`.
- Contract creates new account with `new_account_id` name and `pk2` as full access key and transfers NEAR that Sender sent.If Receiver already has account (or Sender wants to get back the money):
- Sign tx with `privkey1` to call `linkdrop.claim()`, which transfers money to signer's account.