コード例 #1
0
 public static Script PayToScriptHash(Address addr)
 {
     List<ScriptElement> se = new List<ScriptElement>();
     se.Add(new ScriptElement(OpCode.OP_HASH160));
     se.Add(new ScriptElement(addr.ScriptHash));
     se.Add(new ScriptElement(OpCode.OP_EQUAL));
     return new Script(se.ToArray());
 }
コード例 #2
0
 public static Script PayToPubKeyHash(Address addr)
 {
     List<ScriptElement> se = new List<ScriptElement>();
     se.Add(new ScriptElement(OpCode.OP_DUP));
     se.Add(new ScriptElement(OpCode.OP_HASH160));
     se.Add(new ScriptElement(addr.PubKeyHash));
     se.Add(new ScriptElement(OpCode.OP_EQUALVERIFY));
     se.Add(new ScriptElement(OpCode.OP_CHECKSIG));
     return new Script(se.ToArray());
 }
コード例 #3
0
 public static Script PayToAddress(Address addr)
 {
     switch (addr.Type)
     {
         case Address.PUBKEYHASH:
             return PayToPubKeyHash(addr);
         case Address.SCRIPTHASH:
             return PayToScriptHash(addr);
         default:
             throw new ArgumentException("Invalid address");
     }
 }