├── .gitignore ├── LICENSE ├── pom.xml └── src └── org └── neo ├── smartcontract └── framework │ ├── ApiInterface.java │ ├── Appcall.java │ ├── EntryPoint.java │ ├── Helper.java │ ├── Nonemit.java │ ├── OpCode.java │ ├── ScriptContainer.java │ ├── SmartContract.java │ ├── Syscall.java │ └── services │ ├── neo │ ├── Account.java │ ├── Asset.java │ ├── Block.java │ ├── Blockchain.java │ ├── Contract.java │ ├── Header.java │ ├── Runtime.java │ ├── Storage.java │ ├── StorageContext.java │ ├── Transaction.java │ ├── TransactionAttribute.java │ ├── TransactionInput.java │ ├── TransactionOutput.java │ ├── TriggerType.java │ └── Validator.java │ └── system │ └── ExecutionEngine.java └── vm └── _OpCode.java /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled class file 2 | *.class 3 | 4 | # Log file 5 | *.log 6 | 7 | # BlueJ files 8 | *.ctxt 9 | 10 | # Mobile Tools for Java (J2ME) 11 | .mtj.tmp/ 12 | 13 | # Package Files # 14 | *.jar 15 | *.war 16 | *.ear 17 | *.zip 18 | *.tar.gz 19 | *.rar 20 | 21 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 22 | hs_err_pid* 23 | 24 | # eclipse ignore 25 | .classpath 26 | .project 27 | .settings/ 28 | 29 | # intelijj idea ignore 30 | .idea/ 31 | target/ 32 | *.iml 33 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 The Neo Project 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | org.neo 4 | neo-devpack-java 5 | 2.3.0 6 | NEO DevPack For Java 7 | https://github.com/neo-project/neo-devpack-java 8 | Java jar dependency for developing smart contracts on NEO platform. 9 | 10 | 11 | scm:git:git://github.com/neo-project/neo-devpack-java.git 12 | scm:git:ssh://github.com/neo-project/neo-devpack-java.git 13 | https://github.com/neo-project/neo-devpack-java/tree/master 14 | 15 | 16 | 17 | UTF-8 18 | 1.8 19 | 3.6.1 20 | 21 | 22 | 23 | 24 | MIT License 25 | https://github.com/neo-project/neo-devpack-java/blob/master/LICENSE 26 | may be downloaded from the Maven repository 27 | 28 | 29 | 30 | 31 | 32 | Erik Zhang 33 | erik@neo.org 34 | Neo Project 35 | https://neo.org 36 | 37 | 38 | 39 | Peter Szatmary 40 | peter.szatmary@gmail.com 41 | Peter Szatmary 42 | https://github.com/peterszatmary 43 | 44 | 45 | 46 | Luke Plaster 47 | me@lukep.org 48 | Luke Plaster 49 | https://lukep.org 50 | 51 | 52 | 53 | lights li 54 | lightsever@hotmail.com 55 | lights li 56 | http://www.cltri.com 57 | 58 | 59 | 60 | 61 | src 62 | 63 | 64 | maven-compiler-plugin 65 | ${maven.compiler.plugin.version} 66 | 67 | ${java.version} 68 | ${java.version} 69 | ${project.build.sourceEncoding} 70 | 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /src/org/neo/smartcontract/framework/ApiInterface.java: -------------------------------------------------------------------------------- 1 | package org.neo.smartcontract.framework; 2 | 3 | public interface ApiInterface { 4 | } 5 | -------------------------------------------------------------------------------- /src/org/neo/smartcontract/framework/Appcall.java: -------------------------------------------------------------------------------- 1 | package org.neo.smartcontract.framework; 2 | 3 | import java.lang.annotation.*; 4 | 5 | @Target(ElementType.METHOD) 6 | public @interface Appcall { 7 | String value(); 8 | } 9 | -------------------------------------------------------------------------------- /src/org/neo/smartcontract/framework/EntryPoint.java: -------------------------------------------------------------------------------- 1 | package org.neo.smartcontract.framework; 2 | 3 | import java.lang.annotation.*; 4 | import org.neo.smartcontract.framework.services.neo.*; 5 | 6 | @Target(ElementType.METHOD) 7 | public @interface EntryPoint { 8 | TriggerType value(); 9 | } 10 | -------------------------------------------------------------------------------- /src/org/neo/smartcontract/framework/Helper.java: -------------------------------------------------------------------------------- 1 | package org.neo.smartcontract.framework; 2 | 3 | import java.math.BigInteger; 4 | import org.neo.vm._OpCode; 5 | 6 | public class Helper { 7 | 8 | private Helper() { 9 | throw new IllegalStateException("Utility class"); 10 | } 11 | 12 | @Nonemit 13 | public native static BigInteger asBigInteger(byte[] source); 14 | 15 | @Nonemit 16 | public native static byte[] asByteArray(BigInteger source); 17 | 18 | @Nonemit 19 | public native static byte[] asByteArray(String source); 20 | 21 | @Nonemit 22 | public native static String asString(byte[] source); 23 | 24 | @OpCode(_OpCode.CAT) 25 | public native static byte[] concat(byte[] first, byte[] second); 26 | 27 | @OpCode(_OpCode.SUBSTR) 28 | public native static byte[] range(byte[] source, int index, int count); 29 | 30 | @OpCode(_OpCode.LEFT) 31 | public native static byte[] take(byte[] source, int count); 32 | } 33 | -------------------------------------------------------------------------------- /src/org/neo/smartcontract/framework/Nonemit.java: -------------------------------------------------------------------------------- 1 | package org.neo.smartcontract.framework; 2 | 3 | import java.lang.annotation.*; 4 | 5 | @Target(ElementType.METHOD) 6 | public @interface Nonemit { 7 | } 8 | -------------------------------------------------------------------------------- /src/org/neo/smartcontract/framework/OpCode.java: -------------------------------------------------------------------------------- 1 | package org.neo.smartcontract.framework; 2 | 3 | import java.lang.annotation.*; 4 | import org.neo.vm._OpCode; 5 | 6 | @Target(ElementType.METHOD) 7 | public @interface OpCode { 8 | _OpCode value(); 9 | } 10 | -------------------------------------------------------------------------------- /src/org/neo/smartcontract/framework/ScriptContainer.java: -------------------------------------------------------------------------------- 1 | package org.neo.smartcontract.framework; 2 | 3 | public interface ScriptContainer extends ApiInterface { 4 | } 5 | -------------------------------------------------------------------------------- /src/org/neo/smartcontract/framework/SmartContract.java: -------------------------------------------------------------------------------- 1 | package org.neo.smartcontract.framework; 2 | 3 | import org.neo.vm._OpCode; 4 | 5 | public class SmartContract { 6 | @OpCode(_OpCode.SHA1) 7 | protected native static byte[] sha1(byte[] data); 8 | 9 | @OpCode(_OpCode.SHA256) 10 | protected native static byte[] sha256(byte[] data); 11 | 12 | @OpCode(_OpCode.HASH160) 13 | protected native static byte[] hash160(byte[] data); 14 | 15 | @OpCode(_OpCode.HASH256) 16 | protected native static byte[] hash256(byte[] data); 17 | 18 | @OpCode(_OpCode.CHECKSIG) 19 | protected native static boolean verifySignature(byte[] signature, byte[] pubkey); 20 | 21 | @OpCode(_OpCode.CHECKMULTISIG) 22 | protected native static boolean verifySignatures(byte[][] signature, byte[][] pubkey); 23 | } 24 | -------------------------------------------------------------------------------- /src/org/neo/smartcontract/framework/Syscall.java: -------------------------------------------------------------------------------- 1 | package org.neo.smartcontract.framework; 2 | 3 | import java.lang.annotation.*; 4 | 5 | @Target(ElementType.METHOD) 6 | public @interface Syscall { 7 | String value(); 8 | } 9 | -------------------------------------------------------------------------------- /src/org/neo/smartcontract/framework/services/neo/Account.java: -------------------------------------------------------------------------------- 1 | package org.neo.smartcontract.framework.services.neo; 2 | 3 | import org.neo.smartcontract.framework.Syscall; 4 | 5 | public class Account { 6 | @Syscall("Neo.Account.GetScriptHash") 7 | public native byte[] scriptHash(); 8 | 9 | @Syscall("Neo.Account.GetVotes") 10 | public native byte[][] getVotes(); 11 | 12 | @Syscall("Neo.Account.SetVotes") 13 | public native void setVotes(byte[][] votes); 14 | 15 | @Syscall("Neo.Account.GetBalance") 16 | public native long getBalance(byte[] asset_id); 17 | } 18 | -------------------------------------------------------------------------------- /src/org/neo/smartcontract/framework/services/neo/Asset.java: -------------------------------------------------------------------------------- 1 | package org.neo.smartcontract.framework.services.neo; 2 | 3 | import org.neo.smartcontract.framework.Syscall; 4 | 5 | public class Asset { 6 | @Syscall("Neo.Asset.GetAssetId") 7 | public native byte[] assetId(); 8 | 9 | @Syscall("Neo.Asset.GetAssetType") 10 | public native byte assetType(); 11 | 12 | @Syscall("Neo.Asset.GetAmount") 13 | public native long amount(); 14 | 15 | @Syscall("Neo.Asset.GetAvailable") 16 | public native long available(); 17 | 18 | @Syscall("Neo.Asset.GetPrecision") 19 | public native byte precision(); 20 | 21 | @Syscall("Neo.Asset.GetOwner") 22 | public native byte[] owner(); 23 | 24 | @Syscall("Neo.Asset.GetAdmin") 25 | public native byte[] admin(); 26 | 27 | @Syscall("Neo.Asset.GetIssuer") 28 | public native byte[] issuer(); 29 | 30 | @Syscall("Neo.Asset.Create") 31 | public native static Asset create(byte asset_type, String name, long amount, byte precision, byte[] owner, 32 | byte[] admin, byte[] issuer); 33 | 34 | @Syscall("Neo.Asset.Renew") 35 | public native int renew(byte years); 36 | } 37 | -------------------------------------------------------------------------------- /src/org/neo/smartcontract/framework/services/neo/Block.java: -------------------------------------------------------------------------------- 1 | package org.neo.smartcontract.framework.services.neo; 2 | 3 | import org.neo.smartcontract.framework.Syscall; 4 | 5 | public class Block extends Header { 6 | @Syscall("Neo.Block.GetTransactionCount") 7 | public native int transactionCount(); 8 | 9 | @Syscall("Neo.Block.GetTransactions") 10 | public native Transaction[] transactions(); 11 | 12 | @Syscall("Neo.Block.GetTransaction") 13 | public native Transaction getTransaction(int index); 14 | } 15 | -------------------------------------------------------------------------------- /src/org/neo/smartcontract/framework/services/neo/Blockchain.java: -------------------------------------------------------------------------------- 1 | package org.neo.smartcontract.framework.services.neo; 2 | 3 | import org.neo.smartcontract.framework.Syscall; 4 | 5 | public class Blockchain { 6 | @Syscall("Neo.Blockchain.GetHeight") 7 | public native static int height(); 8 | 9 | @Syscall("Neo.Blockchain.GetHeader") 10 | public native static Header getHeader(int height); 11 | 12 | @Syscall("Neo.Blockchain.GetHeader") 13 | public native static Header getHeader(byte[] hash); 14 | 15 | @Syscall("Neo.Blockchain.GetBlock") 16 | public native static Block getBlock(int height); 17 | 18 | @Syscall("Neo.Blockchain.GetBlock") 19 | public native static Block getBlock(byte[] hash); 20 | 21 | @Syscall("Neo.Blockchain.GetTransaction") 22 | public native static Transaction getTransaction(byte[] hash); 23 | 24 | @Syscall("Neo.Blockchain.GetAccount") 25 | public native static Account getAccount(byte[] script_hash); 26 | 27 | @Syscall("Neo.Blockchain.GetValidators") 28 | public native static byte[][] getValidators(); 29 | 30 | @Syscall("Neo.Blockchain.GetAsset") 31 | public native static Asset getAsset(byte[] asset_id); 32 | 33 | @Syscall("Neo.Blockchain.GetContract") 34 | public native static Contract getContract(byte[] script_hash); 35 | } 36 | -------------------------------------------------------------------------------- /src/org/neo/smartcontract/framework/services/neo/Contract.java: -------------------------------------------------------------------------------- 1 | package org.neo.smartcontract.framework.services.neo; 2 | 3 | import org.neo.smartcontract.framework.Syscall; 4 | 5 | public class Contract { 6 | @Syscall("Neo.Contract.GetScript") 7 | public native byte[] script(); 8 | 9 | @Syscall("Neo.Contract.GetStorageContext") 10 | public native StorageContext storageContext(); 11 | 12 | @Syscall("Neo.Contract.Create") 13 | public native static Contract create(byte[] script, byte[] parameter_list, byte return_type, boolean need_storage, 14 | String name, String version, String author, String email, String description); 15 | 16 | @Syscall("Neo.Contract.Migrate") 17 | public native static Contract migrate(byte[] script, byte[] parameter_list, byte return_type, boolean need_storage, 18 | String name, String version, String author, String email, String description); 19 | 20 | @Syscall("Neo.Contract.Destroy") 21 | public native static void destroy(); 22 | } 23 | -------------------------------------------------------------------------------- /src/org/neo/smartcontract/framework/services/neo/Header.java: -------------------------------------------------------------------------------- 1 | package org.neo.smartcontract.framework.services.neo; 2 | 3 | import org.neo.smartcontract.framework.*; 4 | 5 | public class Header implements ScriptContainer { 6 | @Syscall("Neo.Header.GetHash") 7 | public native byte[] hash(); 8 | 9 | @Syscall("Neo.Header.GetVersion") 10 | public native int version(); 11 | 12 | @Syscall("Neo.Header.GetPrevHash") 13 | public native byte[] prevHash(); 14 | 15 | @Syscall("Neo.Header.GetMerkleRoot") 16 | public native byte[] merkleRoot(); 17 | 18 | @Syscall("Neo.Header.GetTimestamp") 19 | public native int timestamp(); 20 | 21 | @Syscall("Neo.Header.GetConsensusData") 22 | public native long consensusData(); 23 | 24 | @Syscall("Neo.Header.GetNextConsensus") 25 | public native byte[] nextConsensus(); 26 | } 27 | -------------------------------------------------------------------------------- /src/org/neo/smartcontract/framework/services/neo/Runtime.java: -------------------------------------------------------------------------------- 1 | package org.neo.smartcontract.framework.services.neo; 2 | 3 | import org.neo.smartcontract.framework.Syscall; 4 | 5 | public final class Runtime { 6 | @Syscall("Neo.Runtime.GetTrigger") 7 | public native static TriggerType trigger(); 8 | 9 | @Syscall("Neo.Runtime.CheckWitness") 10 | public native static boolean checkWitness(byte[] hashOrPubkey); 11 | 12 | @Syscall("Neo.Runtime.Notify") 13 | public native static void notify(Object... state); 14 | 15 | @Syscall("Neo.Runtime.Log") 16 | public native static void log(String message); 17 | 18 | @Syscall("Neo.Runtime.GetTime") 19 | public native static long time(); 20 | } 21 | -------------------------------------------------------------------------------- /src/org/neo/smartcontract/framework/services/neo/Storage.java: -------------------------------------------------------------------------------- 1 | package org.neo.smartcontract.framework.services.neo; 2 | 3 | import java.math.BigInteger; 4 | import org.neo.smartcontract.framework.Syscall; 5 | 6 | public final class Storage { 7 | @Syscall("Neo.Storage.GetContext") 8 | public native static StorageContext currentContext(); 9 | 10 | @Syscall("Neo.Storage.Get") 11 | public native static byte[] get(StorageContext context, byte[] key); 12 | 13 | @Syscall("Neo.Storage.Get") 14 | public native static byte[] get(StorageContext context, String key); 15 | 16 | @Syscall("Neo.Storage.Put") 17 | public native static void put(StorageContext context, byte[] key, byte[] value); 18 | 19 | @Syscall("Neo.Storage.Put") 20 | public native static void put(StorageContext context, byte[] key, BigInteger value); 21 | 22 | @Syscall("Neo.Storage.Put") 23 | public native static void put(StorageContext context, byte[] key, String value); 24 | 25 | @Syscall("Neo.Storage.Put") 26 | public native static void put(StorageContext context, String key, byte[] value); 27 | 28 | @Syscall("Neo.Storage.Put") 29 | public native static void put(StorageContext context, String key, BigInteger value); 30 | 31 | @Syscall("Neo.Storage.Put") 32 | public native static void put(StorageContext context, String key, String value); 33 | 34 | @Syscall("Neo.Storage.Delete") 35 | public native static void delete(StorageContext context, byte[] key); 36 | 37 | @Syscall("Neo.Storage.Delete") 38 | public native static void delete(StorageContext context, String key); 39 | } 40 | -------------------------------------------------------------------------------- /src/org/neo/smartcontract/framework/services/neo/StorageContext.java: -------------------------------------------------------------------------------- 1 | package org.neo.smartcontract.framework.services.neo; 2 | 3 | public class StorageContext { 4 | } 5 | -------------------------------------------------------------------------------- /src/org/neo/smartcontract/framework/services/neo/Transaction.java: -------------------------------------------------------------------------------- 1 | package org.neo.smartcontract.framework.services.neo; 2 | 3 | import org.neo.smartcontract.framework.*; 4 | 5 | public class Transaction implements ScriptContainer { 6 | @Syscall("Neo.Transaction.GetHash") 7 | public native byte[] hash(); 8 | 9 | @Syscall("Neo.Transaction.GetType") 10 | public native byte type(); 11 | 12 | @Syscall("Neo.Transaction.GetAttributes") 13 | public native TransactionAttribute[] attributes(); 14 | 15 | @Syscall("Neo.Transaction.GetInputs") 16 | public native TransactionInput[] inputs(); 17 | 18 | @Syscall("Neo.Transaction.GetOutputs") 19 | public native TransactionOutput[] outputs(); 20 | 21 | @Syscall("Neo.Transaction.GetReferences") 22 | public native TransactionOutput[] references(); 23 | } 24 | -------------------------------------------------------------------------------- /src/org/neo/smartcontract/framework/services/neo/TransactionAttribute.java: -------------------------------------------------------------------------------- 1 | package org.neo.smartcontract.framework.services.neo; 2 | 3 | import org.neo.smartcontract.framework.*; 4 | 5 | public class TransactionAttribute implements ApiInterface { 6 | @Syscall("Neo.Attribute.GetUsage") 7 | public native byte usage(); 8 | 9 | @Syscall("Neo.Attribute.GetData") 10 | public native byte[] data(); 11 | } 12 | -------------------------------------------------------------------------------- /src/org/neo/smartcontract/framework/services/neo/TransactionInput.java: -------------------------------------------------------------------------------- 1 | package org.neo.smartcontract.framework.services.neo; 2 | 3 | import org.neo.smartcontract.framework.*; 4 | 5 | public class TransactionInput implements ApiInterface { 6 | @Syscall("Neo.Input.GetHash") 7 | public native byte[] prevHash(); 8 | 9 | @Syscall("Neo.Input.GetIndex") 10 | public native short prevIndex(); 11 | } 12 | -------------------------------------------------------------------------------- /src/org/neo/smartcontract/framework/services/neo/TransactionOutput.java: -------------------------------------------------------------------------------- 1 | package org.neo.smartcontract.framework.services.neo; 2 | 3 | import org.neo.smartcontract.framework.*; 4 | 5 | public class TransactionOutput implements ApiInterface { 6 | @Syscall("Neo.Output.GetAssetId") 7 | public native byte[] assetId(); 8 | 9 | @Syscall("Neo.Output.GetValue") 10 | public native long value(); 11 | 12 | @Syscall("Neo.Output.GetScriptHash") 13 | public native byte[] scriptHash(); 14 | } 15 | -------------------------------------------------------------------------------- /src/org/neo/smartcontract/framework/services/neo/TriggerType.java: -------------------------------------------------------------------------------- 1 | package org.neo.smartcontract.framework.services.neo; 2 | 3 | public enum TriggerType { 4 | Verification(0x00), 5 | VerificationR (0x01), 6 | Application(0x10), 7 | ApplicationR(0x11); 8 | 9 | private byte value; 10 | 11 | private TriggerType(int value) { 12 | this.value = (byte) value; 13 | } 14 | 15 | public byte value() { 16 | return value; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/org/neo/smartcontract/framework/services/neo/Validator.java: -------------------------------------------------------------------------------- 1 | package org.neo.smartcontract.framework.services.neo; 2 | 3 | import org.neo.smartcontract.framework.Syscall; 4 | 5 | public final class Validator { 6 | @Syscall("Neo.Validator.Register") 7 | public native static Validator register(byte[] pubkey); 8 | } 9 | -------------------------------------------------------------------------------- /src/org/neo/smartcontract/framework/services/system/ExecutionEngine.java: -------------------------------------------------------------------------------- 1 | package org.neo.smartcontract.framework.services.system; 2 | 3 | import org.neo.smartcontract.framework.*; 4 | 5 | public final class ExecutionEngine { 6 | @Syscall("System.ExecutionEngine.GetScriptContainer") 7 | public native static ScriptContainer scriptContainer(); 8 | 9 | @Syscall("System.ExecutionEngine.GetExecutingScriptHash") 10 | public native static byte[] executingScriptHash(); 11 | 12 | @Syscall("System.ExecutionEngine.GetCallingScriptHash") 13 | public native static byte[] callingScriptHash(); 14 | 15 | @Syscall("System.ExecutionEngine.GetEntryScriptHash") 16 | public native static byte[] entryScriptHash(); 17 | } 18 | -------------------------------------------------------------------------------- /src/org/neo/vm/_OpCode.java: -------------------------------------------------------------------------------- 1 | package org.neo.vm; 2 | 3 | public enum _OpCode 4 | { 5 | // Constants 6 | PUSH0(0x00), // An empty array of bytes is pushed onto the stack. 7 | PUSHF(PUSH0), 8 | PUSHBYTES1(0x01), // 0x01-0x4B The next opcode bytes is data to be pushed onto the stack 9 | PUSHBYTES75(0x4B), 10 | PUSHDATA1(0x4C), // The next byte contains the number of bytes to be pushed onto the stack. 11 | PUSHDATA2(0x4D), // The next two bytes contain the number of bytes to be pushed onto the stack. 12 | PUSHDATA4(0x4E), // The next four bytes contain the number of bytes to be pushed onto the stack. 13 | PUSHM1(0x4F), // The number -1 is pushed onto the stack. 14 | PUSH1(0x51), // The number 1 is pushed onto the stack. 15 | PUSHT(PUSH1), 16 | PUSH2(0x52), // The number 2 is pushed onto the stack. 17 | PUSH3(0x53), // The number 3 is pushed onto the stack. 18 | PUSH4(0x54), // The number 4 is pushed onto the stack. 19 | PUSH5(0x55), // The number 5 is pushed onto the stack. 20 | PUSH6(0x56), // The number 6 is pushed onto the stack. 21 | PUSH7(0x57), // The number 7 is pushed onto the stack. 22 | PUSH8(0x58), // The number 8 is pushed onto the stack. 23 | PUSH9(0x59), // The number 9 is pushed onto the stack. 24 | PUSH10(0x5A), // The number 10 is pushed onto the stack. 25 | PUSH11(0x5B), // The number 11 is pushed onto the stack. 26 | PUSH12(0x5C), // The number 12 is pushed onto the stack. 27 | PUSH13(0x5D), // The number 13 is pushed onto the stack. 28 | PUSH14(0x5E), // The number 14 is pushed onto the stack. 29 | PUSH15(0x5F), // The number 15 is pushed onto the stack. 30 | PUSH16(0x60), // The number 16 is pushed onto the stack. 31 | 32 | // Flow control 33 | NOP(0x61), // Does nothing. 34 | JMP(0x62), 35 | JMPIF(0x63), 36 | JMPIFNOT(0x64), 37 | CALL(0x65), 38 | RET(0x66), 39 | APPCALL(0x67), 40 | SYSCALL(0x68), 41 | TAILCALL(0x69), 42 | 43 | // Stack 44 | DUPFROMALTSTACK(0x6A), 45 | TOALTSTACK(0x6B), // Puts the input onto the top of the alt stack. Removes it from the main stack. 46 | FROMALTSTACK(0x6C), // Puts the input onto the top of the main stack. Removes it from the alt stack. 47 | XDROP(0x6D), 48 | XSWAP(0x72), 49 | XTUCK(0x73), 50 | DEPTH(0x74), // Puts the number of stack items onto the stack. 51 | DROP(0x75), // Removes the top stack item. 52 | DUP(0x76), // Duplicates the top stack item. 53 | NIP(0x77), // Removes the second-to-top stack item. 54 | OVER(0x78), // Copies the second-to-top stack item to the top. 55 | PICK(0x79), // The item n back in the stack is copied to the top. 56 | ROLL(0x7A), // The item n back in the stack is moved to the top. 57 | ROT(0x7B), // The top three items on the stack are rotated to the left. 58 | SWAP(0x7C), // The top two items on the stack are swapped. 59 | TUCK(0x7D), // The item at the top of the stack is copied and inserted before the second-to-top item. 60 | 61 | // Splice 62 | CAT(0x7E), // Concatenates two strings. 63 | SUBSTR(0x7F), // Returns a section of a string. 64 | LEFT(0x80), // Keeps only characters left of the specified point in a string. 65 | RIGHT(0x81), // Keeps only characters right of the specified point in a string. 66 | SIZE(0x82), // Returns the length of the input string. 67 | 68 | // Bitwise logic 69 | INVERT(0x83), // Flips all of the bits in the input. 70 | AND(0x84), // Boolean and between each bit in the inputs. 71 | OR(0x85), // Boolean or between each bit in the inputs. 72 | XOR(0x86), // Boolean exclusive or between each bit in the inputs. 73 | EQUAL(0x87), // Returns 1 if the inputs are exactly equal, 0 otherwise. 74 | //OP_EQUALVERIFY(0x88), // Same as OP_EQUAL, but runs OP_VERIFY afterward. 75 | //OP_RESERVED1(0x89), // Transaction is invalid unless occuring in an unexecuted OP_IF branch 76 | //OP_RESERVED2(0x8A), // Transaction is invalid unless occuring in an unexecuted OP_IF branch 77 | 78 | // Arithmetic 79 | // Note: Arithmetic inputs are limited to signed 32-bit integers, but may overflow their output. 80 | INC(0x8B), // 1 is added to the input. 81 | DEC(0x8C), // 1 is subtracted from the input. 82 | SIGN(0x8D), 83 | NEGATE(0x8F), // The sign of the input is flipped. 84 | ABS(0x90), // The input is made positive. 85 | NOT(0x91), // If the input is 0 or 1, it is flipped. Otherwise the output will be 0. 86 | NZ(0x92), // Returns 0 if the input is 0. 1 otherwise. 87 | ADD(0x93), // a is added to b. 88 | SUB(0x94), // b is subtracted from a. 89 | MUL(0x95), // a is multiplied by b. 90 | DIV(0x96), // a is divided by b. 91 | MOD(0x97), // Returns the remainder after dividing a by b. 92 | SHL(0x98), // Shifts a left b bits, preserving sign. 93 | SHR(0x99), // Shifts a right b bits, preserving sign. 94 | BOOLAND(0x9A), // If both a and b are not 0, the output is 1. Otherwise 0. 95 | BOOLOR(0x9B), // If a or b is not 0, the output is 1. Otherwise 0. 96 | NUMEQUAL(0x9C), // Returns 1 if the numbers are equal, 0 otherwise. 97 | NUMNOTEQUAL(0x9E), // Returns 1 if the numbers are not equal, 0 otherwise. 98 | LT(0x9F), // Returns 1 if a is less than b, 0 otherwise. 99 | GT(0xA0), // Returns 1 if a is greater than b, 0 otherwise. 100 | LTE(0xA1), // Returns 1 if a is less than or equal to b, 0 otherwise. 101 | GTE(0xA2), // Returns 1 if a is greater than or equal to b, 0 otherwise. 102 | MIN(0xA3), // Returns the smaller of a and b. 103 | MAX(0xA4), // Returns the larger of a and b. 104 | WITHIN(0xA5), // Returns 1 if x is within the specified range (left-inclusive), 0 otherwise. 105 | 106 | // Crypto 107 | //RIPEMD160(0xA6), // The input is hashed using RIPEMD-160. 108 | SHA1(0xA7), // The input is hashed using SHA-1. 109 | SHA256(0xA8), // The input is hashed using SHA-256. 110 | HASH160(0xA9), 111 | HASH256(0xAA), 112 | CHECKSIG(0xAC), 113 | CHECKMULTISIG(0xAE), 114 | 115 | // Array 116 | ARRAYSIZE(0xC0), 117 | PACK(0xC1), 118 | UNPACK(0xC2), 119 | PICKITEM(0xC3), 120 | SETITEM(0xC4), 121 | NEWARRAY(0xC5), // Used as a reference type 122 | NEWSTRUCT(0xC6), // Used as a value type 123 | 124 | // Exceptions 125 | THROW(0xF0), 126 | THROWIFNOT(0xF1); 127 | 128 | private int value; 129 | 130 | private _OpCode(int value) 131 | { 132 | this.value = value; 133 | } 134 | 135 | private _OpCode(_OpCode op) 136 | { 137 | this.value = op.value; 138 | } 139 | 140 | public int value() 141 | { 142 | return this.value; 143 | } 144 | } 145 | --------------------------------------------------------------------------------