49 OP_FROMALTSTACK = 0x6c,
81 OP_EQUALVERIFY = 0x88,
106 OP_NUMEQUALVERIFY = 0x9d,
107 OP_NUMNOTEQUAL = 0x9e,
109 OP_GREATERTHAN = 0xa0,
110 OP_LESSTHANOREQUAL = 0xa1,
111 OP_GREATERTHANOREQUAL = 0xa2,
123 OP_CODESEPARATOR = 0xab,
125 OP_CHECKSIGVERIFY = 0xad,
126 OP_CHECKMULTISIG = 0xae,
127 OP_CHECKMULTISIGVERIFY = 0xaf,
142 // template matching params
144 OP_SMALLINTEGER = 0xfa,
146 OP_PUBKEYHASH = 0xfd,
149 OP_INVALIDOPCODE = 0xff,
154 private byte[] scriptCode = {};
160 private string GetOpName(opcodetype opcode)
164 case opcodetype.OP_0:
166 case opcodetype.OP_PUSHDATA1:
167 return "OP_PUSHDATA1";
168 case opcodetype.OP_PUSHDATA2:
169 return "OP_PUSHDATA2";
170 case opcodetype.OP_PUSHDATA4:
171 return "OP_PUSHDATA4";
172 case opcodetype.OP_1NEGATE:
174 case opcodetype.OP_RESERVED:
175 return "OP_RESERVED";
176 case opcodetype.OP_1:
178 case opcodetype.OP_2:
180 case opcodetype.OP_3:
182 case opcodetype.OP_4:
184 case opcodetype.OP_5:
186 case opcodetype.OP_6:
188 case opcodetype.OP_7:
190 case opcodetype.OP_8:
192 case opcodetype.OP_9:
194 case opcodetype.OP_10:
196 case opcodetype.OP_11:
198 case opcodetype.OP_12:
200 case opcodetype.OP_13:
202 case opcodetype.OP_14:
204 case opcodetype.OP_15:
206 case opcodetype.OP_16:
210 case opcodetype.OP_NOP:
212 case opcodetype.OP_VER:
214 case opcodetype.OP_IF:
216 case opcodetype.OP_NOTIF:
218 case opcodetype.OP_VERIF:
220 case opcodetype.OP_VERNOTIF:
221 return "OP_VERNOTIF";
222 case opcodetype.OP_ELSE:
224 case opcodetype.OP_ENDIF:
226 case opcodetype.OP_VERIFY:
228 case opcodetype.OP_RETURN:
232 case opcodetype.OP_TOALTSTACK:
233 return "OP_TOALTSTACK";
234 case opcodetype.OP_FROMALTSTACK:
235 return "OP_FROMALTSTACK";
236 case opcodetype.OP_2DROP:
238 case opcodetype.OP_2DUP:
240 case opcodetype.OP_3DUP:
242 case opcodetype.OP_2OVER:
244 case opcodetype.OP_2ROT:
246 case opcodetype.OP_2SWAP:
248 case opcodetype.OP_IFDUP:
250 case opcodetype.OP_DEPTH:
252 case opcodetype.OP_DROP:
254 case opcodetype.OP_DUP:
256 case opcodetype.OP_NIP:
258 case opcodetype.OP_OVER:
260 case opcodetype.OP_PICK:
262 case opcodetype.OP_ROLL:
264 case opcodetype.OP_ROT:
266 case opcodetype.OP_SWAP:
268 case opcodetype.OP_TUCK:
272 case opcodetype.OP_CAT:
274 case opcodetype.OP_SUBSTR:
276 case opcodetype.OP_LEFT:
278 case opcodetype.OP_RIGHT:
280 case opcodetype.OP_SIZE:
284 case opcodetype.OP_INVERT:
286 case opcodetype.OP_AND:
288 case opcodetype.OP_OR:
290 case opcodetype.OP_XOR:
292 case opcodetype.OP_EQUAL:
294 case opcodetype.OP_EQUALVERIFY:
295 return "OP_EQUALVERIFY";
296 case opcodetype.OP_RESERVED1:
297 return "OP_RESERVED1";
298 case opcodetype.OP_RESERVED2:
299 return "OP_RESERVED2";
302 case opcodetype.OP_1ADD:
304 case opcodetype.OP_1SUB:
306 case opcodetype.OP_2MUL:
308 case opcodetype.OP_2DIV:
310 case opcodetype.OP_NEGATE:
312 case opcodetype.OP_ABS:
314 case opcodetype.OP_NOT:
316 case opcodetype.OP_0NOTEQUAL:
317 return "OP_0NOTEQUAL";
318 case opcodetype.OP_ADD:
320 case opcodetype.OP_SUB:
322 case opcodetype.OP_MUL:
324 case opcodetype.OP_DIV:
326 case opcodetype.OP_MOD:
328 case opcodetype.OP_LSHIFT:
330 case opcodetype.OP_RSHIFT:
332 case opcodetype.OP_BOOLAND:
334 case opcodetype.OP_BOOLOR:
336 case opcodetype.OP_NUMEQUAL:
337 return "OP_NUMEQUAL";
338 case opcodetype.OP_NUMEQUALVERIFY:
339 return "OP_NUMEQUALVERIFY";
340 case opcodetype.OP_NUMNOTEQUAL:
341 return "OP_NUMNOTEQUAL";
342 case opcodetype.OP_LESSTHAN:
343 return "OP_LESSTHAN";
344 case opcodetype.OP_GREATERTHAN:
345 return "OP_GREATERTHAN";
346 case opcodetype.OP_LESSTHANOREQUAL:
347 return "OP_LESSTHANOREQUAL";
348 case opcodetype.OP_GREATERTHANOREQUAL:
349 return "OP_GREATERTHANOREQUAL";
350 case opcodetype.OP_MIN:
352 case opcodetype.OP_MAX:
354 case opcodetype.OP_WITHIN:
358 case opcodetype.OP_RIPEMD160:
359 return "OP_RIPEMD160";
360 case opcodetype.OP_SHA1:
362 case opcodetype.OP_SHA256:
364 case opcodetype.OP_HASH160:
366 case opcodetype.OP_HASH256:
368 case opcodetype.OP_CODESEPARATOR:
369 return "OP_CODESEPARATOR";
370 case opcodetype.OP_CHECKSIG:
371 return "OP_CHECKSIG";
372 case opcodetype.OP_CHECKSIGVERIFY:
373 return "OP_CHECKSIGVERIFY";
374 case opcodetype.OP_CHECKMULTISIG:
375 return "OP_CHECKMULTISIG";
376 case opcodetype.OP_CHECKMULTISIGVERIFY:
377 return "OP_CHECKMULTISIGVERIFY";
380 case opcodetype.OP_NOP1:
382 case opcodetype.OP_NOP2:
384 case opcodetype.OP_NOP3:
386 case opcodetype.OP_NOP4:
388 case opcodetype.OP_NOP5:
390 case opcodetype.OP_NOP6:
392 case opcodetype.OP_NOP7:
394 case opcodetype.OP_NOP8:
396 case opcodetype.OP_NOP9:
398 case opcodetype.OP_NOP10:
401 // template matching params
402 case opcodetype.OP_PUBKEYHASH:
403 return "OP_PUBKEYHASH";
404 case opcodetype.OP_PUBKEY:
406 case opcodetype.OP_SMALLDATA:
407 return "OP_SMALLDATA";
409 case opcodetype.OP_INVALIDOPCODE:
410 return "OP_INVALIDOPCODE";
416 public override string ToString()
420 StringBuilder sb = new StringBuilder(scriptCode.Length * 2);
421 foreach (byte b in scriptCode)
423 sb.AppendFormat ("{0:x2}", b);
425 return sb.ToString();