-
Notifications
You must be signed in to change notification settings - Fork 122
Script to update token with P2SH multisig owner
Script to assist with the creation of update token transaction for tokens that are owned by 1-of-N P2SH multisig addresses. These transactions cannot easily be created using the updatetoken RPC call due to the requirement of a redeem script to spend from a multisig. Creates a raw transaction for token with multisig owner to update a token's various owner configurable values like name and symbol, there are also mintable, tradable, isDAT and finalize flags.
Place script in a directory with the defi-cli binary which should be configured to work with a running defid. defi-cli will be used to run createrawtransaction, signrawtransactionwithkey and sendrawtransaction.
Note that Python 3 required. Any problems, questions or bug reports please create a GitHub Issue.
Usage instructions can be viewed by running the script without any arguments.
python3 multisig_updatetoken.py
The following arguments are required:
token (number) Token identifier.
metadata (string)
One or more of the token details to be updated, for example.
'{"name":"NAME","symbol":"SYM","isDAT":false,"mintable":true,"tradeable":true,"finalize":false}'
private key (string) Private key that corresponds to one of the public keys in the multisig, used to sign the raw transaction to authorize spending from the mutltisig.
redeem script (string) Multisig redeem script, created when the multisig address was made, is the unlocking script required to spend funds in a multisig address.
input (string) Must be a UTXO that belongs to the token owner with at least 0.0001 DFI for the fee. Requires the following information in the form shown below. txid is the transaction hash related to the UTXO, vout is the output index of the UTXO and exact amount in the UTXO.
Be careful specifying the amount, the fee will be deducted and the rest sent back to the owner address, any difference between the to will end up as the miner fee. Set the amount to 1 DFI for a 10 DFI UTXO and the miner will get 9.0001 DFI.
'[{"txid":"TXID","vout":0,"amount":"0.00000000"}]'
https://github.com/Bushstar/defi-python-scripts/blob/master/multisig_updatetoken.py