Skip to content

Instantly share code, notes, and snippets.

@crossle
Last active July 26, 2019 07:00
Show Gist options
  • Save crossle/787bf9e44d01ffa37c80403ba9d980e4 to your computer and use it in GitHub Desktop.
Save crossle/787bf9e44d01ffa37c80403ba9d980e4 to your computer and use it in GitHub Desktop.
1. Mixin testnet launch
$ ./mixin setuptestnet
$ mixin kernel -dir /tmp/mixin-7001 -port 7001
$ mixin kernel -dir /tmp/mixin-7002 -port 7002
$ mixin kernel -dir /tmp/mixin-7003 -port 7003
$ mixin kernel -dir /tmp/mixin-7004 -port 7004
$ mixin kernel -dir /tmp/mixin-7005 -port 7005
$ mixin kernel -dir /tmp/mixin-7006 -port 7006
$ mixin kernel -dir /tmp/mixin-7007 -port 7007
2. Create Mixin Mainnet address
$ ./mixin createaddress
Example:
address: XIN6zb31xAmmtiZfDoZwYxA39LvgzqKeJtT4X2D5gvFRbcmiucwg3Mz9HNAuBeTaiWGxvBtJZ7czi8CZWRdGEprDbYHYYfzc
view key: 2f5320933fce783f36bc3192a7110660fff2dee256b17229a076f2b325dbfe03
spend key: 0f7c6d8861b1fcdb936a1fd80f3acab452bb02e676ceb1949314bda8b915a902
3. Deposit asset
Create a deposit transaction to account, MixinNetwork transaction like UTXO include inputs and outputs
Example:
{
"version":1,
"asset":"a99c2e0e2b1da4d648755ef19bd95139acbbe6564cfb06dec7cd34931ca72cdc",
"inputs":[
{
"deposit": {
"chain":"8dd50817c082cdcdd6f167514928767a4b52426997bd6d4930eca101c5ff8a27",
"asset":"0xa974c709cfb4566686553a20790685a47aceaa33",
"transaction":"0xc7c1132b58e1f64c263957d7857fe5ec5294fce95d30dcd64efef71da1000000",
"index":0,
"amount":"100.035"
}
}
],
"outputs":[
{
"type":0,
"amount":"100.035",
"script":"fffe01",
"accounts":["XIN6zb31xAmmtiZfDoZwYxA39LvgzqKeJtT4X2D5gvFRbcmiucwg3Mz9HNAuBeTaiWGxvBtJZ7czi8CZWRdGEprDbYHYYfzc"]
}
]
}
Sign the deposit transaction get the hex string
Example:
./mixin signrawtransaction -n localhost:8001 -key xx -raw '{"version":1,"asset":"a99c2e0e2b1da4d648755ef19bd95139acbbe6564cfb06dec7cd34931ca72cdc","inputs":[{"deposit":{"chain":"8dd50817c082cdcdd6f167514928767a4b52426997bd6d4930eca101c5ff8a27","asset":"0xa974c709cfb4566686553a20790685a47aceaa33","transaction":"0xc7c1132b58e1f64c263957d7857fe5ec5294fce95d30dcd64efef71da1000000","index":0,"amount":"100.035"}}],"outputs":[{"type":0,"amount":"100.035","script":"fffe01","accounts":["XIN6zb31xAmmtiZfDoZwYxA39LvgzqKeJtT4X2D5gvFRbcmiucwg3Mz9HNAuBeTaiWGxvBtJZ7czi8CZWRdGEprDbYHYYfzc"]}]}'
key is your address view append spend string
raw is above transaction raw string
Send raw transaction
./mixin sendrawtransaction -n localhost:8001 -raw xx
4. Transfer asset transaction
Create raw transaction
{
"version": 1,
"asset": "a99c2e0e2b1da4d648755ef19bd95139acbbe6564cfb06dec7cd34931ca72cdc",
"extra": "",
"outputs": [
{
"type": 0,
"amount": "115.06849309",
"script": "fffe01",
"accounts": [
"XINPXu5NBXszhpZDRJ8iA26TbQ2oWTSq1tXqKKeVeYWgLSz8yXGTtVhMogynYytoMewYVFR541wauLhy1YV33zg445E49YA7"
]
}
],
"inputs": [
{
"hash": "20001842d6eff5129c11f7c053bf1209f0267bf223f1681c9cb9d19fc773a692",
"index": 11
}
]
}
Sign the raw transaction get hex string
./mixin signrawtransaction -n localhost:8001 -key xx -raw '{"version":1,"asset":"a99c2e0e2b1da4d648755ef19bd95139acbbe6564cfb06dec7cd34931ca72cdc","extra":"","outputs":[{"type":0,"amount":"115.06849309","script":"fffe01fffe01","accounts":["XINPXu5NBXszhpZDRJ8iA26TbQ2oWTSq1tXqKKeVeYWgLSz8yXGTtVhMogynYytoMewYVFR541wauLhy1YV33zg445E49YA7"]}],"inputs":[{"hash":"20001842d6eff5129c11f7c053bf1209f0267bf223f1681c9cb9d19fc773a692","index":11}]}'
Send raw transaction
./mixin sendrawtransaction -n localhost:8001 -raw xx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment