Skip to content

Instantly share code, notes, and snippets.

@hanwencheng
hanwencheng / network-update.md
Last active February 5, 2020 15:31
Update Metadata and network specs Introduction for Parity Signer

Metadata and Network Specs Update on Parity Signer

Get the metadata of certain chain

Switch to the target chain.

use script on polkadot.js with code

const metadata = await api.runtimeMetadata.asCallsOnly.toHex();
@hanwencheng
hanwencheng / signingSample.md
Last active November 15, 2019 14:38
signing test

Test CheatSheet

  1. Recover Identity with seed split cradle example drum veteran swear cruel pizza guilt surface mansion film grant benefit educate marble cargo ignore bind include advance grunt exile grow.
  2. Create account under Kusama Network which is//kusama_CC2//default.
  3. Commet out this line. line 134 and line 137 in QRScanner.js.
  4. Click scan will direct lead to the message detail page and signing page.

Signing test related data

// kusama_CC2//default
@hanwencheng
hanwencheng / signingSample.js
Created November 14, 2019 22:23
signing test
const signedData = '0168b4c2a0ebc5bb68ebe6e3fe030cb8fabe4e649326a9fe973b0552e7e528f732754be818dfadd7aa6f2c4c84bfb53a51e0c2668f719251580755d68b751c4d8f';
const seed = 'split cradle example drum veteran swear cruel pizza guilt surface mansion film grant benefit educate marble cargo ignore bind include advance grunt exile grow'
const dataToSign = '49a00000100005301020a06171a5ad1be958012949789fb94a2ba91210a42e2a38b33ef5376b1c43450a40600ff94d3487c7d14e2a5c28abc8cc16cad9dfe5195562a594f82e0b290dd566d0b5c070010a5d4e875010000b90000000d667fd278ec412cd9fccdb066f09ed5b4cfd9c9afa9eb747213acb02b1e70bcda2680fb733de798a1b40472fb657afcb860537651f6b4fa5d884f3f20aeefff0ec11ec11ec11ec11ec11ec11ec11ec11ec11ec11ec11ec11ec11'
const networks = [
{
name: 'kusama',
genesisHash: "0xb28bd355a4cd1df46bc56a2949bce8feb84eebc864f1c3f1f77668bd3b6559b3",
prefix: 2,
decimals: 12,
pathID: 'kusama',
title: 'Kusama CC2',
unit: 'KSM',
color: '#e6007a',
@hanwencheng
hanwencheng / secure-key-storage.md
Last active March 11, 2025 07:10
Parity-Signer Secure Key Storage Proposal

Parity-Signer Secure Key Storage Proposal

Here I conclude the recent research and discussions with the storage of the seed/private key in parity-signer.

Current Implementation

secureStorage1 Currently, we require a user to input a pin code for encrypting the seed, and then put the encrypted seed together with other account data into a secure store. The secure store then uses the native KeysStore or KeyChain to store the encrypted account data.

Possible improvement

secureStorage2

const result = people.reduce((acc, person)=>{
if(person.age > 40 || person.age < 30)
return acc
acc[person.gender].push(person)
return acc;
}, {male :[], female:[]})
@hanwencheng
hanwencheng / tapi.go
Last active November 19, 2018 05:06
Go test script for Jingtum
package main
import (
"log"
"github.com/parnurzeal/gorequest"
"sync"
"time"
"strconv"
"os"
"fmt"
var mongoDbQueue = require('./mongodb-queue.js');
var logger = require('./logger.js').logger;
var async = require('async');
var respond = require('../lib/response-handler.js');
var Promise = require('bluebird');
var payments = require('../api/payments.js');
const queueCheckInterval = 3000;
const poolSize = 1000;
const visibilityTime = 500;