Counterparty Send With ElectrumThis form generates an OP_RETURN message for sending Counterparty tokens from the Electrum Bitcoin Wallet.
UTXO (Output Point)
Asset (Token) Name
Optional Tip to Developer (BTC)
This is an experimental script. Peer review pending. Your tokens may get lost. Use at own risk!
Instructions1. Open Electrum
2. Locate the address with your Counterparty tokens. If the btc balance is zero, top it up with enough btc to pay a miner fee.
3. Find this address under the 'Coins' tab.
4. Right click -> 'Spend'.
5. Right click again -> Copy -> 'Output point'.
6. Paste the UTXO (Output point) in this form.
7. Enter asset, amount and recipient address.
8. Include a tip if you like to support further development of this script.
9. Click 'Generate OP_RETURN' and 'COPY' to clipboard.
10. Open Electrum again.
11. Click 'Send' tab.
12. Paste into 'Pay to' field.
13. Click 'Pay...'.
14. Send as usual with Electrum. Make sure the fee is fine. Note the amount shall be the tip only. Electrum is not aware of Counterparty tokens.
Recommended SettingsOptional but recommended.
In Electrum, go to 'Preferences' -> 'Transactions':
- Tick 'Advanced Preview'
- Untick 'Use Change Address'
Why This ScriptI want to reduce the threshold for Bitcoin users to send tokens.
Before this script, if you held tokens in Electrum, in order to send you had to export the private key to a Counterparty-aware wallet.
Now your private key stays within Electrum.
Risks by Using This Script- Although your bitcoin private keys are entirely handled by Electrum, you must take care while making the transaction. Make sure the fee is fine, that the OP_RETURN btc amount is zero, and that any tip is reasonable.
- The OP_RETURN contains all token send info and is not human readable nor does Electrum check it. This script does not check the asset and amount against your address either. If you input wrong values, you may lose your tokens or at the very least a bitcoin miner fee.
- This script is pending peer review. Use at own risk!
FAQWhich address formats are supported?
- legacy, prefix '1' (p2pkh)
- native segwit, prefix 'bc1q' and 42 char length (bech32, p2wpkh).
- legacy multisig, prefix '3' (p2sh).
- nested segwit, prefix '3', identical to p2sh (p2wsh-p2sh).
Which address formats are not supported?
- multisig segwit, prefix 'bc1q' and 62 char length (bech32, p2wsh).
Show me examples
How to open a legacy multisig wallet?
Electrum does not have this option anymore. However, there is a workaround.
Begin by creating a new seed. Then go back and choose 'I already have a seed'. Enter the seed. You know it's correct when the text 'Seed type: segwit' appears. Now choose option 'BIP39 seed' and ignore the warnings. Then choose p2sh-segwit (legacy would also work but result in higher fees). Then continue the normal process.
My address has several UTXOs. Which one to use?
It does not matter. Pick one of them.
Does this script work for other wallets than Electrum?
Yes, as long as it allows sending OP_RETURN data. If your wallet doesn't show UTXOs you can find them on a block explorer.
Can I receive tokens to my Electrum wallet?
Yes, unless you have a multisig segwit wallet. Just keep in mind that Electrum does not show token balances. Manually add a label to keep track of tokens and check the history on xchain.io.
Can I buy from a dispenser through Electrum?
Yes, a dispense is triggered by a standard Bitcoin transaction. Multisig segwit is the exception and will not work.
Also keep in mind that Electrum will not confirm the tokens. Please view the status on xchain.io.
Can I issue tokens, place DEX orders, and do other Counterparty actions with Electrum?
Not currently. But I can write similar scripts for almost all Counterparty transactions if there's any demand for it.
API ConsiderationsIf the API is down, the script will fail. Please try again in a minute.
A malicious API could not cause much harm.
For regular assets the only risk is a wrong divisibility status, losing you a miner fee and potentially some token-satoshis.
For subassets the asset ID could be false and theoretically cause you to send the wrong asset.
I consider these risks minuscule but if you want you can check the values in console (CTRL+SHIFT+I).
The API provider is Xchain.io which has served the community for years.
CreditI used Loon3's Freeport Wallet to build this script. All libraries are copied and unmodified. My code is within index.html only.
API is provided by xchain.io.