Comments (4)
I write the endpoints inputs and outputs here
I believe I need the following
Login
This exists and is called signmessage
it return a key (the address)
Now I have added to return a pubkey, however if we want to to conform to the BCIP we need to be able to provide a path or create a new sign in endpoint
I also propose that we will return in the signmessage
the
walletId: string;
accountId: string;
keyId: string;
This is so future calls (like get balance for an account can pass those params and not let the user pick them)
Balance
idea: make it more generic and call this getinfo that can return balances or trxid or trxhex etc...
Balance will return the balance of that account
Input : { walletId, accountId }
Output : { balance }
Send
Send funds to a given address (or addresses)
(do we need to also specify walletId, accountId?)
Input : { target[{address, amount}], fee (high,medium,low)}
Output : { trxid }
Optional params to consider on the input
Input : { network(do we need this?), data(opreturn), walletId, accountId }
Spending the swap trx
This is a special case we have two options somehow build the special swap script in the wallet itself or enable the wallet to sign an input
To get an idea of the complexity of building the swap spend trx look here
https://github.com/block-core/blockcore-atomic-swaps/blob/main/src/Blockcore.AtomicSwaps/Shared/SwapBuilder.cs#L71
An idea I have is that we could potentially make an api endpoint that return the swap special private key and do the signing in the dapp, and give the user extra warnings about this operation.
The risk is lower because if we implement the BCIP then the private key is hardened and if leaked only open swaps are potentially compromised (assuming the attacked has the secret hash)
out of the 3 options here are the inputs
- build the swap trx in the wallet
Input : { redeemscript, sharedSecret, outpoint (or swap trxid that has the outpoint), swap-pubkey, target-address,}
Output : { trxid }
- sign swap input
Input : { pubkey, sighash, SigHashType}
Output : { signature}
- return the special swap private key
Input : { pubkey, }
Output : { privatekey}
Derivation of the secret hash
The secret hash need to be a random number, however if we are able to have access to the private key then we can derive the secret hash in a deterministic way (which can be useful for recovery)
If we go for the option of asking for the private key this is not an issue, however otherwise we can add an endpoint to sign the session id and hash that (I think this can potentially be achieved already with the signmessage
endpoint.
from blockcore-wallet.
Another endpoint we could potentially get and then not use the send endpoint is to fetch UTXOs and then call the sign method
Or to pass to the wallet an unsigned trx and have it sign the inputs
Doing this will give the swaps dapp more flexibility
from blockcore-wallet.
I that I have one more requirement, there are two methods that do not require consent (no popup)
atomicswaps.key
- return the swaps derived pubkey
atomicswaps.secret
- generate a secret hash using the swaps key
However when the wallet is locked this is not possible, I suggest when those methods are called if the wallet is locked we must initiate a wallet popup to unlock the wallet.
Why is it without consent? during a swap I may need to call a wallet a few times, the UX will be horrible if a user has to approve a few popups one after the other
from blockcore-wallet.
One more to the list
block-core/blockcore-atomic-swaps#32
from blockcore-wallet.
Related Issues (20)
- Add export of individual private key on identity tools HOT 1
- Hide most options on account create HOT 2
- Display popup in dapp DOM whenever extension has signed, encrypted or decrypted a data HOT 1
- Count key usage HOT 5
- Add nostr relay management HOT 1
- Provider - send coins - cancel button doesn't work HOT 1
- Protocol handler does not require ://
- Make extension override links that are clicked
- Add support for stratis contracts DAO/Tokens/call-contract
- Error on sidechain swap transactions info HOT 2
- transaction.send component HOT 4
- Display error dialog when storage is spent
- Add support for NIP-26 HOT 1
- Missing indexers for new accounts
- Atomic swaps bug - when deleting a wallet
- Add support for ChangeNOW
- Action fails if no wallet exists
- Display unconfirmed as part of the balance HOT 3
- Popup when using nostr clients HOT 3
- "authorize for 5 minutes" doesn't appear to be 5 minutes HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from blockcore-wallet.